0

I have simple class object which I want to pool in WebSphere Application Server 7.0.

My Java class looks like this:

SimpleBean
{
    String str1;
    String str2;

    SimpleBean()
    {str1="This is str1";}

    public void setStr1(String str1)
    {this.str1 = str1;}

    public void setStr2(String str2)
    {this.str2 = str2;}

    public String getStr1()
    {return str1;}

    public String getStr2()
    {return str2;}
}

How do I pool SimpleBean in WAS 7.0? I saw that there's an Object pool managers in WAS but I don't know if the pooling should be setup up there. Also I don't know how to use it.

Arci
  • 6,647
  • 20
  • 70
  • 98

1 Answers1

2

See the Object pools topic in the WebSphere Application Server 7.0 InfoCenter for more information on developing and configuring.

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
  • Hi, bkail! Thanks! I tried that tutorial but it gives me an error when I run the code, `arrayListPool = opm.getPool(ArrayList.class);`. The error is: `com.ibm.ws.objectpool.ObjectPoolImpl incompatible with com.ibm.security.krb5.wss.util.ObjectPool`. Would you know a more detailed tutorial? Also, how did WebSphere know that it will be pooling for `ArrayList` and `String`? Is there no need for the user to specify what object he wishes to pool in WAS? – Arci May 23 '13 at 05:35
  • 1
    That error means that your source code is importing the wrong ObjectPool; update your code to import com.ibm.websphere.objectpool.ObjectPool instead. Object pools are not a popular programming model extension, so I am aware of their existence but have no experience with using them, sorry. – Brett Kail May 23 '13 at 17:27
  • Thanks! I was able to make it work. As you have said, the problem is with the package I imported. Just a clarification though, are you really referring to `com.ibm.websphere.objectpool.ObjectPool'? Because I can't find it. The package I imported is `com.ibm.websphere.asynchbeans.pool.ObjectPool` and I was able to access the object pool already. Also, what do you mean with object pools are not a popular programming model extension? Are you referring to Websphere's pooling or object pooling in general? – Arci May 24 '13 at 09:37
  • Because I was also able to pool in Spring, an application framework. I'm just checking how the pooling in WebSphere works. Should I use rather use Spring's pooling or Websphere's pooling? Thanks again! – Arci May 24 '13 at 09:38
  • Oops, yes, I'm not sure where I got the bogus package name from; sorry. I don't have experience with either pooling implementation, so I would recommend using the one that's easiest and has the features you need. – Brett Kail May 24 '13 at 14:26