Methods Summary |
---|
public java.lang.Object | createProxy()
// try
{
Object containerId = container.getObjectName().getCanonicalName();
String stackName = "ClusteredStatelessSessionClientInterceptors";
if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
{
stackName = binding.interceptorStack();
}
AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
/*
Object[] args = {new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null), wrapper, lbPolicy)};
return proxyConstructor.newInstance(args);
*/
String partitionName = ((StatelessContainer) container).getPartitionName();
proxy = constructProxy(new StatelessClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null),
wrapper, lbPolicy, partitionName));
return proxy;
}
/*
catch (InstantiationException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalAccessException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (IllegalArgumentException e)
{
throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
}
catch (InvocationTargetException e)
{
throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
}
*/
|
protected StatelessHandleImpl | getHandle()
StatelessHandleImpl handle = new StatelessHandleImpl();
RemoteBinding remoteBinding = (RemoteBinding)advisor.resolveAnnotation(RemoteBinding.class);
if (remoteBinding != null)
handle.jndiName = remoteBinding.jndiBinding();
return handle;
|
protected java.lang.Class[] | getInterfaces()
Class[] remoteInterfaces = ProxyFactoryHelper.getRemoteInterfaces(container);
Class[] interfaces = new Class[remoteInterfaces.length + 1];
System.arraycopy(remoteInterfaces, 0, interfaces, 0, remoteInterfaces.length);
interfaces[remoteInterfaces.length] = JBossProxy.class;
return interfaces;
|
protected void | initializeJndiName()
jndiName = ProxyFactoryHelper.getRemoteJndiName(container, binding);
|
public synchronized void | replicantsChanged(java.lang.String key, java.util.List newReplicants, int newReplicantsViewId)
try
{
// Update the FamilyClusterInfo with the new targets
ArrayList targets = new ArrayList(newReplicants);
wrapper.get().updateClusterInfo(targets, newReplicantsViewId);
// Rebind the proxy as the old one has been serialized
if (proxy != null)
bindProxy(proxy);
}
catch (Exception e)
{
log.error(e);
}
|
public void | setRemoteBinding(org.jboss.annotation.ejb.RemoteBinding binding)
this.binding = binding;
|
public void | start()
String clientBindUrl = ProxyFactoryHelper.getClientBindUrl(binding);
locator = new InvokerLocator(clientBindUrl);
Clustered clustered = (Clustered) advisor.resolveAnnotation(Clustered.class);
if (clustered == null) throw new RuntimeException("Could not find @Clustered annotation. Cannot deploy.");
String partitionName = ((StatelessContainer) container).getPartitionName();
proxyFamilyName = ((StatelessContainer) container).getDeploymentQualifiedName() + locator.getProtocol() + partitionName;
HAPartition partition = (HAPartition) container.getInitialContext().lookup("/HAPartition/" + partitionName);
hatarget = new HATarget(partition, proxyFamilyName, locator, HATarget.ENABLE_INVOCATIONS);
ClusteringTargetsRepository.initTarget(proxyFamilyName, hatarget.getReplicants());
((StatelessContainer) container).getClusterFamilies().put(proxyFamilyName, hatarget);
if (clustered.loadBalancePolicy() == null || clustered.loadBalancePolicy().equals(LoadBalancePolicy.class))
{
lbPolicy = new RandomRobin();
}
else
{
lbPolicy = (LoadBalancePolicy) clustered.loadBalancePolicy().newInstance();
}
wrapper = new FamilyWrapper(proxyFamilyName, hatarget.getReplicants());
this.drm = partition.getDistributedReplicantManager();
drm.registerListener(proxyFamilyName, this);
super.start();
|
public void | stop()
super.stop();
proxy = null;
hatarget.destroy();
drm.unregisterListener(proxyFamilyName, this);
((StatelessContainer) container).getClusterFamilies().remove(proxyFamilyName);
|