Search in sources :

Example 1 with RemoteCommandManager

use of org.eclipse.persistence.sessions.coordination.RemoteCommandManager in project eclipselink by eclipse-ee4j.

the class SessionsFactory method buildRemoteCommandManagerConfig.

/**
 * INTERNAL:
 */
protected void buildRemoteCommandManagerConfig(RemoteCommandManagerConfig rcmConfig, AbstractSession session) {
    if (rcmConfig != null) {
        RemoteCommandManager rcm = new RemoteCommandManager(session);
        // Commands
        processCommandsConfig(rcmConfig.getCommandsConfig(), rcm);
        // Transport Manager - will set the built TransportManager on the given
        // Remote command manager that is passed in
        buildTransportManager(rcmConfig.getTransportManagerConfig(), rcm);
        // Channel - XML Schema default is TopLinkCommandChannel
        rcm.setChannel(rcmConfig.getChannel());
    }
}
Also used : RemoteCommandManager(org.eclipse.persistence.sessions.coordination.RemoteCommandManager)

Example 2 with RemoteCommandManager

use of org.eclipse.persistence.sessions.coordination.RemoteCommandManager in project eclipselink by eclipse-ee4j.

the class RCMDistributedServer method run.

/**
 * This method starts the server and makes the dispatcher available
 * Creation date: (7/21/00 9:58:37 AM)
 */
@Override
public void run() {
    RemoteCommandManager cm = new RemoteCommandManager((AbstractSession) session);
    // 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) session).setShouldPropagateChanges(true);
    cm.setServerPlatform(new NoServerPlatform(new DatabaseSessionImpl()));
    cm.initialize();
}
Also used : DatabaseSessionImpl(org.eclipse.persistence.internal.sessions.DatabaseSessionImpl) RemoteCommandManager(org.eclipse.persistence.sessions.coordination.RemoteCommandManager) NoServerPlatform(org.eclipse.persistence.platform.server.NoServerPlatform) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Example 3 with RemoteCommandManager

use of org.eclipse.persistence.sessions.coordination.RemoteCommandManager in project eclipselink by eclipse-ee4j.

the class JGroupsConfigurationTest method test.

@Override
protected void test() throws Throwable {
    AbstractSession session = getAbstractSession();
    RemoteCommandManager rcm = new RemoteCommandManager(session);
    TransportManager transport = (TransportManager) Class.forName("org.eclipse.persistence.sessions.coordination.jgroups.JGroupsTransportManager").getConstructor().newInstance();
    rcm.setTransportManager(transport);
    transport.createLocalConnection();
    RemoteConnection connection = transport.getConnectionToLocalHost();
    try {
        int multicastPort = getMulticastPort(connection);
        Assert.assertEquals("Default multicast port different than expected", 45588, multicastPort);
    } catch (Exception x) {
        Assert.fail("Failed to retrieve multicast port: " + x.getMessage());
    } finally {
        connection.close();
    }
    rcm = new RemoteCommandManager(session);
    transport = (TransportManager) Class.forName("org.eclipse.persistence.sessions.coordination.jgroups.JGroupsTransportManager").getConstructor().newInstance();
    transport.setConfig("org/eclipse/persistence/testing/config/distributedservers/rcm/jgroups/jgroups-udp-config.xml");
    rcm.setTransportManager(transport);
    transport.createLocalConnection();
    connection = transport.getConnectionToLocalHost();
    try {
        int multicastPort = getMulticastPort(connection);
        Assert.assertEquals("Configured multicast port different than expected", 45678, multicastPort);
    } catch (Exception x) {
        Assert.fail("Failed to retrieve multicast port: " + x.getMessage());
    } finally {
        connection.close();
    }
}
Also used : RemoteCommandManager(org.eclipse.persistence.sessions.coordination.RemoteCommandManager) TransportManager(org.eclipse.persistence.sessions.coordination.TransportManager) RemoteConnection(org.eclipse.persistence.internal.sessions.coordination.RemoteConnection) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession)

Example 4 with RemoteCommandManager

use of org.eclipse.persistence.sessions.coordination.RemoteCommandManager in project eclipselink by eclipse-ee4j.

the class JPARCMLocalChangeSetTestSuite method initializeRCMOnSession.

public void initializeRCMOnSession(ServerSession session) {
    RemoteCommandManager rcm = new RemoteCommandManager(session);
    rcm.setShouldPropagateAsynchronously(true);
    session.setCommandManager(rcm);
    session.setShouldPropagateChanges(true);
    resetLocalConnection(session);
}
Also used : RemoteCommandManager(org.eclipse.persistence.sessions.coordination.RemoteCommandManager)

Example 5 with RemoteCommandManager

use of org.eclipse.persistence.sessions.coordination.RemoteCommandManager in project eclipselink by eclipse-ee4j.

the class DistributedCacheMergeTest method buildSession.

protected Server buildSession(String sessionName) throws Exception {
    ServerSession session = null;
    Project p = getNewProject();
    DatabaseLogin theLogin = originalSession.getLogin();
    p.setLogin(originalSession.getLogin());
    session = (ServerSession) p.createServerSession();
    session.setSessionLog(getSession().getSessionLog());
    RemoteCommandManager cm = new RemoteCommandManager(session);
    // set propagate command asynchronously for testing
    cm.setShouldPropagateAsynchronously(true);
    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:41099");
    // turn on cache sync with RCM
    session.setShouldPropagateChanges(true);
    cm.setServerPlatform(getSession().getServerPlatform());
    cm.initialize();
    // Sleep to allow RCM to startup and find each session.
    try {
        Thread.sleep(2000);
    } catch (Exception ignore) {
    }
    return session;
}
Also used : Project(org.eclipse.persistence.sessions.Project) EmployeeProject(org.eclipse.persistence.testing.models.employee.relational.EmployeeProject) DatabaseLogin(org.eclipse.persistence.sessions.DatabaseLogin) ServerSession(org.eclipse.persistence.sessions.server.ServerSession) RemoteCommandManager(org.eclipse.persistence.sessions.coordination.RemoteCommandManager) TestErrorException(org.eclipse.persistence.testing.framework.TestErrorException)

Aggregations

RemoteCommandManager (org.eclipse.persistence.sessions.coordination.RemoteCommandManager)12 TransportManager (org.eclipse.persistence.sessions.coordination.TransportManager)4 TestErrorException (org.eclipse.persistence.testing.framework.TestErrorException)4 AbstractSession (org.eclipse.persistence.internal.sessions.AbstractSession)3 JMSTopicTransportManager (org.eclipse.persistence.sessions.coordination.jms.JMSTopicTransportManager)3 Enumeration (java.util.Enumeration)2 Vector (java.util.Vector)2 SecurableObjectHolder (org.eclipse.persistence.internal.security.SecurableObjectHolder)2 JMSPublishingTransportManager (org.eclipse.persistence.sessions.coordination.jms.JMSPublishingTransportManager)2 RMITransportManager (org.eclipse.persistence.sessions.coordination.rmi.RMITransportManager)2 PrivilegedActionException (java.security.PrivilegedActionException)1 NamingException (javax.naming.NamingException)1 SessionLoaderException (org.eclipse.persistence.exceptions.SessionLoaderException)1 ValidationException (org.eclipse.persistence.exceptions.ValidationException)1 EntityManagerFactoryProvider.getConfigPropertyAsString (org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.getConfigPropertyAsString)1 PrivilegedInvokeConstructor (org.eclipse.persistence.internal.security.PrivilegedInvokeConstructor)1 PrivilegedNewInstanceFromClass (org.eclipse.persistence.internal.security.PrivilegedNewInstanceFromClass)1 DatabaseSessionImpl (org.eclipse.persistence.internal.sessions.DatabaseSessionImpl)1 RemoteConnection (org.eclipse.persistence.internal.sessions.coordination.RemoteConnection)1 JMSTopicRemoteConnection (org.eclipse.persistence.internal.sessions.coordination.jms.JMSTopicRemoteConnection)1