package org.jboss.mq.il.jvm;
import java.util.Properties;
import javax.naming.InitialContext;
import org.jboss.mq.GenericConnectionFactory;
import org.jboss.mq.il.ServerIL;
import org.jboss.mq.il.ServerILFactory;
public class JVMServerILService extends org.jboss.mq.il.ServerILJMXService implements JVMServerILServiceMBean {
public String getName() {
return "JBossMQ-JVMServerIL";
}
public ServerIL getServerIL() {
return new JVMServerIL( lookupJMSServer() );
}
public java.util.Properties getClientConnectionProperties() {
Properties rc = super.getClientConnectionProperties();
rc.setProperty( ServerILFactory.CLIENT_IL_SERVICE_KEY, "org.jboss.mq.il.jvm.JVMClientILService" );
rc.setProperty( ServerILFactory.SERVER_IL_FACTORY_KEY, "org.jboss.mq.il.jvm.JVMServerILFactory" );
return rc;
}
public void startService()
throws Exception {
super.startService();
bindJNDIReferences();
}
public void stopService() {
try {
unbindJNDIReferences();
} catch ( Exception e ) {
log.error("Problem stopping JVMServerILService", e);
}
}
public void bindJNDIReferences()
throws javax.naming.NamingException {
GenericConnectionFactory gcf = new GenericConnectionFactory( getServerIL(), getClientConnectionProperties() );
org.jboss.mq.SpyConnectionFactory scf = new org.jboss.mq.SpyConnectionFactory( gcf );
org.jboss.mq.SpyXAConnectionFactory sxacf = new org.jboss.mq.SpyXAConnectionFactory( gcf );
InitialContext ctx = new InitialContext();
org.jboss.naming.NonSerializableFactory.rebind( ctx, getConnectionFactoryJNDIRef(), scf );
org.jboss.naming.NonSerializableFactory.rebind( ctx, getXAConnectionFactoryJNDIRef(), sxacf );
}
}