コード例 #1
0
 public void waitUntilUnlocked(long timeToWaitBeforeVerify) throws InterruptedException {
   if (isLocked()) {
     long n = timeToWaitBeforeVerify / 100;
     for (int i = 0; i < n && isLocked(); i++) {
       if (isStateEnabled(UNLOCKED_BY_SOURCE_SESSION)) {
         // source session remote connection has been removed
         if (sourceSession
             .getCommandManager()
             .getTransportManager()
             .getConnectionsToExternalServices()
             .isEmpty()) {
           // the following line unlocks, unless UNLOCKED_BY_SOURCE_SESSION state is disabled
           unlock(UNLOCKED_BY_SOURCE_SESSION);
         }
       }
       if (isLocked()) {
         Thread.sleep(100);
       }
     }
     if (isLocked()) {
       unlock(UNLOCKED_BY_TIMER);
     } else if (state == UNLOCKED_BY_TARGET_LISTENER) {
       Thread.sleep(100);
     }
   }
 }
コード例 #2
0
 /**
  * PUBLIC: Processes the received RCM messaged from a JMS provider for cache coordination. This
  * will use the local connection from the configured TransportManager from the session's
  * RemoteCommandManager.
  *
  * @param message
  * @param session
  */
 public static void processJMSMessage(javax.jms.Message message, AbstractSession session) {
   RemoteCommandManager rcm = (RemoteCommandManager) session.getCommandManager();
   if (rcm.isStopped()) {
     throw RemoteCommandManagerException.remoteCommandManagerIsClosed();
   }
   JMSTopicRemoteConnection connection =
       (JMSTopicRemoteConnection) rcm.getTransportManager().getConnectionToLocalHost();
   connection.onMessage(message);
 }