在高层次上,我有一个MemcachedPoolService类,它有两个方法:getClientInstance()和returnClientInstance(client).正如所料,getClientInstance()向调用者返回MemcachedClient(spymemcachced)的实例,而returnClientInstance(client)将MemcachedClient返回给池.MemcachedPoolService需要可供其他所有需要访问Memcached的@Stateless服务(注入)使用.
目前我将MemcachedPoolService标记为@Singleton,但是当多个客户端尝试访问该应用程序时,我收到以下错误:
[0m[31m16:54:22,968 ERROR [org.jboss.as.ejb3.invocation] (http-/0.0.0.0:8080-10) JBAS014134: EJB Invocation failed on component MemcachedPoolService for method public net.spy.memcached.MemcachedClient com.apexlab.cache.MemcachedPoolService.getClientInstance(): javax.ejb.EJBTransactionRolledbackException: JBAS014373: EJB 3.1 PFD2 4.8.5.5.1 concurrent access timeout on org.jboss.invocation.InterceptorContext$Invocation@24bf375e - could not obtain lock within 5000MILLISECONDS
为生产环境设置我的MemcachedPoolService(以及我的Web应用程序)以避免获取并发超时异常的最佳方法是什么?