[teiid-commits] teiid SVN: r3701 - branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Mon Nov 28 13:49:16 EST 2011
Author: shawkins
Date: 2011-11-28 13:49:16 -0500 (Mon, 28 Nov 2011)
New Revision: 3701
Modified:
branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
Log:
TEIID-1673 update to any cast logic and removing unnecessary remote calls
Modified: branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
===================================================================
--- branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-11-28 18:05:45 UTC (rev 3700)
+++ branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java 2011-11-28 18:49:16 UTC (rev 3701)
@@ -140,30 +140,31 @@
} catch (InvocationTargetException e) {
throw e.getCause();
}
- Vector<Address> dests = null;
- synchronized (remoteMembers) {
- dests = new Vector<Address>(remoteMembers);
+ if (!remoteMembers.isEmpty()) {
+ ReplicatedObject ro = (ReplicatedObject)object;
+ String stateId = (String)args[0];
+ LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "replicating state", stateId); //$NON-NLS-1$
+ JGroupsOutputStream oStream = new JGroupsOutputStream(disp, null, stateId, (short)(methodMap.size() - 3));
+ try {
+ ro.getState(stateId, oStream);
+ } finally {
+ oStream.close();
+ }
+ LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "sent state", stateId); //$NON-NLS-1$
}
- ReplicatedObject ro = (ReplicatedObject)object;
- String stateId = (String)args[0];
- LogManager.logDetail(LogConstants.CTX_RUNTIME, object, "replicating state", stateId); //$NON-NLS-1$
- JGroupsOutputStream oStream = new JGroupsOutputStream(disp, dests, stateId, (short)(methodMap.size() - 3));
- try {
- ro.getState(stateId, oStream);
- } finally {
- oStream.close();
- }
- LogManager.logTrace(LogConstants.CTX_RUNTIME, object, "sent state", stateId); //$NON-NLS-1$
return result;
}
MethodCall call=new MethodCall(methodNum, args);
Vector<Address> dests = null;
if (annotation.remoteOnly()) {
synchronized (remoteMembers) {
+ if (remoteMembers.isEmpty()) {
+ return null;
+ }
dests = new Vector<Address>(remoteMembers);
}
}
- RspList responses = disp.callRemoteMethods(dests, call, annotation.asynch()?GroupRequest.GET_NONE:GroupRequest.GET_ALL, annotation.timeout());
+ RspList responses = disp.callRemoteMethods(dests, call, annotation.asynch()?GroupRequest.GET_NONE:GroupRequest.GET_ALL, annotation.timeout(), dests != null);
if (annotation.asynch()) {
return null;
}
@@ -184,7 +185,7 @@
}
return null;
} catch(Exception e) {
- throw new RuntimeException(method + " " + args + " failed"); //$NON-NLS-1$ //$NON-NLS-2$
+ throw new RuntimeException(method + " " + args + " failed", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -374,10 +375,10 @@
if(log.isTraceEnabled())
log.trace("[sender=" + req.getSrc() + "], method_call: " + method_call); //$NON-NLS-1$ //$NON-NLS-2$
- if(method_lookup == null)
- throw new Exception("MethodCall uses ID=" + method_call.getId() + ", but method_lookup has not been set"); //$NON-NLS-1$ //$NON-NLS-2$
-
if (method_call.getId() >= methodList.size() - 3) {
+ if (req.getSrc().equals(local_addr)) {
+ return null;
+ }
Serializable address = req.getSrc();
String stateId = (String)method_call.getArgs()[0];
List<?> key = Arrays.asList(stateId, address);
Modified: branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java
===================================================================
--- branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java 2011-11-28 18:05:45 UTC (rev 3700)
+++ branches/7.6.x/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsOutputStream.java 2011-11-28 18:49:16 UTC (rev 3701)
@@ -51,7 +51,7 @@
this.dests=dests;
this.stateId=stateId;
this.methodOffset = methodOffset;
- disp.callRemoteMethods(this.dests, new MethodCall(methodOffset, new Object[] {stateId}), GroupRequest.GET_NONE, 0);
+ disp.callRemoteMethods(this.dests, new MethodCall(methodOffset, new Object[] {stateId}), GroupRequest.GET_NONE, 0, dests != null);
}
public void close() throws IOException {
@@ -60,7 +60,7 @@
}
flush();
try {
- disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 2), new Object[] {stateId}), GroupRequest.GET_NONE, 0);
+ disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 2), new Object[] {stateId}), GroupRequest.GET_NONE, 0, dests != null);
} catch(Exception e) {
}
closed=true;
@@ -72,7 +72,7 @@
if(index == 0) {
return;
}
- disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 1), new Object[] {stateId, Arrays.copyOf(buffer, index)}), GroupRequest.GET_NONE, 0);
+ disp.callRemoteMethods(dests, new MethodCall((short)(methodOffset + 1), new Object[] {stateId, Arrays.copyOf(buffer, index)}), GroupRequest.GET_NONE, 0, dests != null);
index=0;
} catch(Exception e) {
throw new IOException(e);
More information about the teiid-commits
mailing list