User: chirino
Date: 01/11/08 22:26:36
Added: src/main/org/jboss/mq/il/ha HAClientIL.java
HAClientILService.java HAServerIL.java
HAServerILService.java HAServerILServiceMBean.java
Log:
Created a new JBossMQ IL that uses the HA framework.
Revision Changes Path
1.1 jbossmx/src/main/org/jboss/mq/il/ha/HAClientIL.java
Index: HAClientIL.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.mq.il.ha;
import org.jboss.mq.Connection;
import org.jboss.mq.il.ClientIL;
import org.jboss.mq.il.rmi.RMIClientIL;
/**
* The HA implementation of the ClientIL object.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class HAClientIL extends RMIClientIL
{
HAClientIL(Connection c) throws java.rmi.RemoteException
{
super(c);
}
}
1.1 jbossmx/src/main/org/jboss/mq/il/ha/HAClientILService.java
Index: HAClientILService.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.mq.il.ha;
import org.jboss.mq.il.rmi.RMIClientILService;
/**
* The HA implementation of the RMIClientILService object
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class HAClientILService extends RMIClientILService {
}
1.1 jbossmx/src/main/org/jboss/mq/il/ha/HAServerIL.java
Index: HAServerIL.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.mq.il.ha;
import org.jboss.mq.server.JMSServer;
import org.jboss.mq.il.rmi.RMIServerIL;
/**
* The HA implementation of the ServerIL object
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class HAServerIL extends RMIServerIL
{
public HAServerIL(JMSServer s)
throws java.rmi.RemoteException
{
super(s);
}
}
1.1 jbossmx/src/main/org/jboss/mq/il/ha/HAServerILService.java
Index: HAServerILService.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.mq.il.ha;
import java.util.Properties;
import javax.management.*;
import javax.naming.InitialContext;
import org.jboss.mq.GenericConnectionFactory;
import org.jboss.ha.framework.server.HARMIServerImpl;
import org.jboss.ha.framework.interfaces.HAPartition;
import org.jboss.ha.framework.interfaces.LoadBalancePolicy;
import org.jboss.mq.il.ServerIL;
import org.jboss.mq.il.ServerILJMXService;
import org.jboss.mq.server.JMSServer;
import org.jboss.mq.il.ServerILFactory;
/**
* Implements the ServerILJMXService which is used to manage the HA IL.
* Almost the same as the RMI IL except that we used the HARMIServerImpl
* object to make the object HA via the jboss cluster.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @version $Revision: 1.1 $
*/
public class HAServerILService
extends org.jboss.mq.il.ServerILJMXService
implements HAServerILServiceMBean {
public final static String DEFAULT_PARTITION = "DefaultPartition";
protected ServerIL serverILProxy;
protected HAServerIL serverIL;
protected HAPartition partition;
protected HARMIServerImpl harmi;
protected String partitionName = DEFAULT_PARTITION;
protected String loadBalancePolicy =
"org.jboss.ha.framework.interfaces.FirstAvailable";
protected Class loadBalancePolicyClass;
/**
* Gives this JMX service a name.
*
* @return The Name value
*/
public String getName() {
return "JBossMQ-HAServerIL";
}
/**
* Used to construct the GenericConnectionFactory (bindJNDIReferences()
* builds it)
*
* @return The ServerIL value
* @returns ServerIL the instance of this IL
*/
public ServerIL getServerIL() {
return serverILProxy;
}
/**
* Used to construct the GenericConnectionFactory (bindJNDIReferences()
* builds it) Sets up the connection properties need by a client to use this
* IL
*
* @return The ClientConnectionProperties value
*/
public java.util.Properties getClientConnectionProperties() {
Properties rc = super.getClientConnectionProperties();
rc.setProperty(
ServerILFactory.CLIENT_IL_SERVICE_KEY,
"org.jboss.mq.il.ha.HAClientILService");
return rc;
}
/**
* Starts this IL, and binds it to JNDI
*
* @exception Exception Description of Exception
*/
public void startService() throws Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
log.info("Using " + loadBalancePolicy + " for jms connection load
balancing");
loadBalancePolicyClass = cl.loadClass(loadBalancePolicy);
// The serverIL object is the RMI object we are going to make HA
serverIL = new HAServerIL(lookupJMSServer());
partition =
(HAPartition) new InitialContext().lookup("/HAPartition/" +
partitionName);
harmi =
new HARMIServerImpl(
partition,
getConnectionFactoryJNDIRef(),
ServerIL.class,
serverIL);
serverILProxy =
(ServerIL) harmi.createHAStub(
(LoadBalancePolicy)
loadBalancePolicyClass.newInstance());
bindJNDIReferences();
}
/**
* Stops this IL, and unbinds it from JNDI
*/
public void stopService() {
try {
unbindJNDIReferences();
harmi.destroy();
} catch (Exception ex) {
log.error(ex);
throw new RuntimeException("Error starting
JRMPContainerInvokerHA");
}
}
//////////////////////////////////////////////////////////////////
//
// Methods used for managing this object via JMX
//
//////////////////////////////////////////////////////////////////
/**
* Gets the partitionName
* @return Returns a String
*/
public String getPartitionName() {
return partitionName;
}
/**
* Sets the partitionName
* @param partitionName The partitionName to set
*/
public void setPartitionName(String partitionName) {
this.partitionName = partitionName;
}
/**
* Gets the loadBalancePolicy
* @return Returns a String
*/
public String getLoadBalancePolicy() {
return loadBalancePolicy;
}
/**
* Sets the loadBalancePolicy
* @param loadBalancePolicy The loadBalancePolicy to set
*/
public void setLoadBalancePolicy(String loadBalancePolicy) {
this.loadBalancePolicy = loadBalancePolicy;
}
}
1.1 jbossmx/src/main/org/jboss/mq/il/ha/HAServerILServiceMBean.java
Index: HAServerILServiceMBean.java
===================================================================
/*
* JBossMQ, the OpenSource JMS implementation
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.mq.il.ha;
import java.lang.Object;
/**
* This interface is used to define which methods will be exposed via JMX.
*
* @created August 16, 2001
*/
public interface HAServerILServiceMBean extends
org.jboss.mq.il.ServerILJMXServiceMBean {
public String getPartitionName();
public void setPartitionName(String partitionName);
public String getLoadBalancePolicy();
public void setLoadBalancePolicy(String loadBalancePolicy);
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development