Methods Summary |
---|
public org.jboss.invocation.Invoker | createProxy(javax.management.ObjectName targetName, org.jboss.ha.framework.interfaces.LoadBalancePolicy policy, java.lang.String proxyFamilyName)
Integer hash = new Integer(targetName.hashCode());
HATarget target = (HATarget) targetMap.get(hash);
if (target == null)
{
throw new IllegalStateException("The targetName("+targetName
+ "), hashCode("+hash+") not found");
}
Invoker proxy = new HttpInvokerProxyHA(target.getReplicants(), target.getCurrentViewId (),
policy, proxyFamilyName);
return proxy;
|
protected void | destroyService()
// Export references to the bean
Registry.unbind(serviceName);
|
public java.io.Serializable | getStub()
return super.getInvokerURL();
|
public java.lang.Object | invoke(org.jboss.invocation.Invocation invocation)Invoke a Remote interface method.
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
try
{
Integer nameHash = (Integer) invocation.getObjectName();
ObjectName mbean = (ObjectName) Registry.lookup(nameHash);
// The cl on the thread should be set in another interceptor
Object[] args = {invocation};
String[] sig = {"org.jboss.invocation.Invocation"};
Object rtn = super.getServer().invoke(mbean,
"invoke", args, sig);
// Update the targets list if the client view is out of date
Long clientViewId = (Long) invocation.getValue("CLUSTER_VIEW_ID");
HARMIResponse rsp = new HARMIResponse();
HATarget target = (HATarget) targetMap.get(nameHash);
if (target == null)
{
throw new IllegalStateException("The name for hashCode("+nameHash+") was not found");
}
if (clientViewId.longValue() != target.getCurrentViewId())
{
rsp.newReplicants = new ArrayList(target.getReplicants());
rsp.currentViewId = target.getCurrentViewId();
}
rsp.response = rtn;
// Return the raw object and let the http layer marshall it
return rsp;
}
catch (Exception e)
{
// Unwrap any JMX exceptions
e = (Exception) JMXExceptionDecoder.decode(e);
// Don't send JMX exception back to client to avoid needing jmx
if( e instanceof JMException )
e = new GenericClusteringException (GenericClusteringException.COMPLETED_NO, e.getMessage());
// Only log errors if trace is enabled
if( log.isTraceEnabled() )
log.trace("operation failed", e);
throw e;
}
finally
{
Thread.currentThread().setContextClassLoader(oldCl);
}
|
public void | registerBean(javax.management.ObjectName targetName, org.jboss.ha.framework.server.HATarget target)
Integer hash = new Integer(targetName.hashCode());
log.debug("Registered targetName("+targetName+"), hash="+hash
+ ", target="+target);
if (targetMap.containsKey(hash))
{
throw new IllegalStateException("Duplicate targetName("+targetName
+ ") hashCode: "+hash);
}
targetMap.put(hash, target);
|
protected void | startService()
// Public --------------------------------------------------------
// Export the Invoker interface
ObjectName name = super.getServiceName();
Registry.bind(name, this);
// Make sure the invoker URL is valid
super.checkInvokerURL();
log.debug("Bound HttpHA invoker for JMX node");
|
protected void | stopService()
// Unxport the Invoker interface
ObjectName name = super.getServiceName();
Registry.unbind(name);
log.debug("Unbound HttpHA invoker for JMX node");
|
public void | unregisterBean(javax.management.ObjectName targetName)
Integer hash = new Integer(targetName.hashCode());
targetMap.remove(hash);
log.debug("Unregistered targetName("+targetName+"), hash="+hash);
|