users@glassfish.java.net

Re: EclipseLink Coordinated Cache

From: <glassfish_at_javadesktop.org>
Date: Thu, 11 Jun 2009 11:19:22 PDT

I seem to have EclipseLink working in GlassFish. I chose to use JMS for Cache Coordination rather than RMI. I created a SessionCustomizer to handle this as follows:

        public void customize(Session session) throws Exception {
                RemoteCommandManager rcm = new RemoteCommandManager((CommandProcessor) session);
                java.util.Properties props = new java.util.Properties();
                props.put(Context.PROVIDER_URL,"");
                props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
                
        JMSTopicTransportManager tm = new JMSTopicTransportManager(rcm);
        tm.setLocalContextProperties(props);
        tm.setRemoteContextProperties(props);
        tm.setTopicName("jms/cacheCoordinationTopic");
        tm.setTopicConnectionFactoryName("jms/ConnectionFactory");
        tm.setUserName("admin");
        tm.setPassword("admin");

        rcm.setTransportManager(tm);

        ((DatabaseSession)session).setCommandManager(rcm);
        ((DatabaseSession)session).setShouldPropagateChanges(true);

        rcm.initialize();
        }

We found it best if you use a stand-alone JMS server, such as OpenMQ, and configure GlassFish to utilize that for the JMS Messaging rather than relying on the EMBEDDED JMS server that comes pre-configured in GlassFish.
[Message sent by forum member 'cmathrusse' (cmathrusse)]

http://forums.java.net/jive/thread.jspa?messageID=350760