【问题标题】:How to pool a Java object in WebSphere Application Server 7.0?如何在 WebSphere Application Server 7.0 中对 Java 对象进行池化?
【发布时间】:2013-05-21 09:14:58
【问题描述】:

我有一个简单的类对象,我想在WebSphere Application Server 7.0 中汇集。

我的 Java 类如下所示:

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;}
}

如何在 WAS 7.0 中合并 SimpleBean?我看到 WAS 中有一个Object pool managers,但我不知道是否应该在那里设置池。我也不知道怎么用。

【问题讨论】:

  • 我不明白你想做什么。池 SimpleBean 是什么意思??
  • @VKSingla:我想汇集一个我编写的简单 Java 类。我班的名字是SimpleBean.java

标签: java websphere websphere-7 pool


【解决方案1】:

有关开发和配置的更多信息,请参阅 WebSphere Application Server 7.0 信息中心中的 Object pools 主题。

【讨论】:

  • 嗨,拜托!谢谢!我尝试了那个教程,但是当我运行代码时它给了我一个错误,arrayListPool = opm.getPool(ArrayList.class);。错误是:com.ibm.ws.objectpool.ObjectPoolImpl incompatible with com.ibm.security.krb5.wss.util.ObjectPool。想知道更详细的教程吗?此外,WebSphere 是如何知道它将为ArrayListString 汇集的?用户是否不需要指定他希望在 WAS 中池化的对象?
  • 那个错误意味着你的源代码导入了错误的ObjectPool;更新您的代码以改为导入 com.ibm.websphere.objectpool.ObjectPool。对象池不是流行的编程模型扩展,所以我知道它们的存在但没有使用它们的经验,抱歉。
  • 谢谢!我能够让它工作。正如您所说,问题出在我导入的包上。只是澄清一下,你真的指的是com.ibm.websphere.objectpool.ObjectPool'? Because I can't find it. The package I imported is com.ibm.websphere.asynchbeans.pool.ObjectPool`,我已经能够访问对象池了。另外,对象池不是流行的编程模型扩展是什么意思?您是指 Websphere 的池化还是一般的对象池化?
  • 因为我还可以在 Spring 这个应用程序框架中进行池化。我只是在检查 WebSphere 中的池是如何工作的。我应该使用 Spring 的池还是 Websphere 的池?再次感谢!
  • 哎呀,是的,我不确定我从哪里得到了虚假的包名;对不起。我没有使用任何一种池实现的经验,因此我建议使用最简单且具有您需要的功能的一种。
猜你喜欢
  • 1970-01-01
  • 2012-11-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-12
相关资源
最近更新 更多