【发布时间】:2014-09-16 22:19:26
【问题描述】:
概括地说,我有一个 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 应用程序)以避免并发超时异常的最佳方法是什么?
【问题讨论】:
标签: java jboss ejb memcached spymemcached