Author: shawkins
Date: 2011-11-08 12:48:30 -0500 (Tue, 08 Nov 2011)
New Revision: 3619
Modified:
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
Log:
TEIID-1673 giving each vdb its own cluster name
Modified:
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
===================================================================
---
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-11-08
13:42:58 UTC (rev 3618)
+++
trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-11-08
17:48:30 UTC (rev 3619)
@@ -297,6 +297,9 @@
}
public void stop(Object object) {
+ if (!Proxy.isProxyClass(object.getClass())) {
+ return;
+ }
ReplicatedInvocationHandler<?> handler = (ReplicatedInvocationHandler<?>)
Proxy.getInvocationHandler(object);
Channel c = handler.disp.getChannel();
handler.disp.stop();
@@ -423,24 +426,30 @@
});
T replicatedProxy = (T)
Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]
{iface}, proxy);
-
- channel.connect(clusterName);
- if (object instanceof ReplicatedObject) {
- ((ReplicatedObject)object).setLocalAddress(channel.getLocalAddress());
- boolean getState = channel.getState(null, startTimeout);
- if (getState) {
- boolean loaded = proxy.state_promise.getResult(startTimeout);
- if (loaded) {
- LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "loaded");
//$NON-NLS-1$
+ boolean success = false;
+ try {
+ channel.connect(mux_id);
+ if (object instanceof ReplicatedObject) {
+ ((ReplicatedObject)object).setLocalAddress(channel.getLocalAddress());
+ boolean getState = channel.getState(null, startTimeout);
+ if (getState) {
+ boolean loaded = proxy.state_promise.getResult(startTimeout);
+ if (loaded) {
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "loaded");
//$NON-NLS-1$
+ } else {
+ LogManager.logWarning(LogConstants.CTX_RUNTIME, object + " load
timeout"); //$NON-NLS-1$
+ }
} else {
- LogManager.logWarning(LogConstants.CTX_RUNTIME, object + " load timeout");
//$NON-NLS-1$
+ LogManager.logInfo(LogConstants.CTX_RUNTIME, object + " first member or timeout
exceeded"); //$NON-NLS-1$
}
- } else {
- LogManager.logInfo(LogConstants.CTX_RUNTIME, object + " first member or timeout
exceeded"); //$NON-NLS-1$
}
+ success = true;
+ return replicatedProxy;
+ } finally {
+ if (!success) {
+ channel.close();
+ }
}
-
- return replicatedProxy;
}
}