1 22 package org.jboss.mq.il.jvm; 23 24 import java.util.Properties ; 25 26 import javax.naming.InitialContext ; 27 28 import org.jboss.mq.GenericConnectionFactory; 29 import org.jboss.mq.il.ServerIL; 30 import org.jboss.mq.il.ServerILFactory; 31 32 42 public class JVMServerILService extends org.jboss.mq.il.ServerILJMXService implements JVMServerILServiceMBean 43 { 44 45 50 public String getName() 51 { 52 return "JBossMQ-JVMServerIL"; 53 } 54 55 62 public ServerIL getServerIL() 63 { 64 return new JVMServerIL(getJMSServer()); 65 } 66 67 74 public java.util.Properties getClientConnectionProperties() 75 { 76 Properties rc = super.getClientConnectionProperties(); 77 rc.setProperty(ServerILFactory.CLIENT_IL_SERVICE_KEY, "org.jboss.mq.il.jvm.JVMClientILService"); 78 rc.setProperty(ServerILFactory.SERVER_IL_FACTORY_KEY, "org.jboss.mq.il.jvm.JVMServerILFactory"); 79 return rc; 80 } 81 82 87 public void startService() throws Exception 88 { 89 super.startService(); 90 bindJNDIReferences(); 91 } 92 93 96 public void stopService() 97 { 98 try 99 { 100 unbindJNDIReferences(); 101 } 102 catch (Exception e) 103 { 104 log.error("Problem stopping JVMServerILService", e); 105 } 106 } 107 108 113 public void bindJNDIReferences() throws javax.naming.NamingException 114 { 115 116 GenericConnectionFactory gcf = new GenericConnectionFactory(getServerIL(), getClientConnectionProperties()); 117 org.jboss.mq.SpyConnectionFactory scf = new org.jboss.mq.SpyConnectionFactory(gcf); 118 org.jboss.mq.SpyXAConnectionFactory sxacf = new org.jboss.mq.SpyXAConnectionFactory(gcf); 119 120 InitialContext ctx = getInitialContext(); 122 org.jboss.naming.NonSerializableFactory.rebind(ctx, getConnectionFactoryJNDIRef(), scf); 123 org.jboss.naming.NonSerializableFactory.rebind(ctx, getXAConnectionFactoryJNDIRef(), sxacf); 124 125 } 126 } 127 | Popular Tags |