/** * 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); }
public void startCacheSynchronization() { RemoteCommandManager cm = new RemoteCommandManager((AbstractSession) getSession()); // set propagate command synchronously for testing cm.setShouldPropagateAsynchronously(false); cm.getDiscoveryManager().setAnnouncementDelay(0); // ovewrite default to use RMI registry naming service cm.getTransportManager().setNamingServiceType(TransportManager.REGISTRY_NAMING_SERVICE); // set full rmi URL of local host cm.setUrl("rmi://localhost:1099"); // turn on cache sync with RCM ((AbstractSession) getSession()).setShouldPropagateChanges(true); cm.setServerPlatform( ((org.eclipse.persistence.sessions.DatabaseSession) getSession()).getServerPlatform()); cm.initialize(); // Sleep to allow RCM to startup and find each session. try { Thread.sleep(2000); } catch (Exception ignore) { } }