我有一個這樣的類:辛格爾頓與集羣
@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 –