我有一个这样的类:辛格尔顿与集群
@Singleton
public class RecoveryWorker {
@Schedule(minute = "*/1", hour = "*", persistent = false)
public void run() {
// heavy db queries ~ 2sec
...
}
...
}
有哪个有这个单,并与同一个Oracle DB
有时候我有错误的原理2个wildfly实例:
RROR [org.jboss.as.ejb3] (EJB default - 10) JBAS014120: Error invoking timeout for timer: [id=66ed65c4-3a2d-4343-870d-5f7a46a7742c timedObjectId=com.package.Worker auto-timer?:true persistent?:false [email protected]950e6 initialExpiration=null intervalDuration(in milli sec)=0 nextExpiration=Wed Jun 15 00:01:00 CEST 2016 timerState=IN_TIMEOUT info=null: javax.ejb.ConcurrentAccessTimeoutException: JBAS014373: EJB 3.1 PFD2 4.8.5.5.1 concurrent access timeout on [email protected] - could not obtain lock within 5000MILLISECONDS
我想知道这个块是怎么发生的(Oracle有机械阻塞表或其他东西?)在一个时间内在几个实例中运行一个单例的最佳实践是什么?
看看http://stackoverflow.com/questions/27952769/clustered-singleton-using-wildfly和https://docs.jboss.org/author/display/WFLY10/HA+Singleton+Features,如果你正在使用Wildfly 10 –