diff options
author | slewis | 2005-01-25 17:37:34 +0000 |
---|---|---|
committer | slewis | 2005-01-25 17:37:34 +0000 |
commit | 6deba63c54d7da0a1bc725dcca3162359e1a03d0 (patch) | |
tree | c1b3649379d1e6e772b6c0a422249e851c72d6d3 | |
parent | 6a44a5b8dc0ef93c3d35b031a1669c374102367b (diff) | |
download | org.eclipse.ecf-6deba63c54d7da0a1bc725dcca3162359e1a03d0.tar.gz org.eclipse.ecf-6deba63c54d7da0a1bc725dcca3162359e1a03d0.tar.xz org.eclipse.ecf-6deba63c54d7da0a1bc725dcca3162359e1a03d0.zip |
Bug fix for server problem with handling ContainerMessages directed to specific container in group
4 files changed, 55 insertions, 18 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/.options b/framework/bundles/org.eclipse.ecf.provider/.options index 61534c249..19965ce51 100644 --- a/framework/bundles/org.eclipse.ecf.provider/.options +++ b/framework/bundles/org.eclipse.ecf.provider/.options @@ -2,8 +2,10 @@ org.eclipse.ecf.provider/debug = true org.eclipse.ecf.provider/debug/filter = * org.eclipse.ecf.provider/debug/flag = true org.eclipse.ecf.provider/debug/connection = true +org.eclipse.ecf.provider/debug/connectionping = false org.eclipse.ecf.provider/debug/container = true org.eclipse.ecf.provider/debug/sharedobjectwrapper = true +org.eclipse.ecf.provider/debug/sharedobjectcontext = true org.eclipse.ecf.provider/debug/sharedobjectmanager = true org.eclipse.ecf.provider/debug/gmm = true org.eclipse.ecf.provider/debug/containerfactory = true diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java index 374a32936..42eff182e 100644 --- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java +++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/comm/tcp/Client.java @@ -73,6 +73,7 @@ public final class Client implements ISynchAsynchConnection { public static final String PROTOCOL = "ecftcp"; public static final Trace debug = Trace.create("connection"); + public static final Trace pingdebug = Trace.create("connectionping"); public static final int SNDR_PRIORITY = Thread.NORM_PRIORITY; public static final int RCVR_PRIORITY = Thread.NORM_PRIORITY; // Default close timeout is 1.5 seconds @@ -245,6 +246,7 @@ public final class Client implements ISynchAsynchConnection { inputStream = new ExObjectInputStream(socket.getInputStream(), compatibility); // send connect data + debug("send:" + address + ":" + port + ":" + data); sendIt(new ConnectRequestMessage(anURI, (Serializable) data)); ConnectResultMessage res = null; res = (ConnectResultMessage) readObject(); @@ -285,6 +287,7 @@ public final class Client implements ISynchAsynchConnection { break; try { // Actually send message + debug("send:" + address + ":" + port + ":" + aMsg); sendIt(aMsg); // Successful...remove message from queue queue.removeHead(); @@ -331,7 +334,6 @@ public final class Client implements ISynchAsynchConnection { private void sendIt(Serializable snd) throws IOException { // Write object to output stream - debug("send:" + address + ":" + port + ":" + snd); synchronized (outputStream) { outputStream.writeObject(snd); outputStream.flush(); @@ -353,6 +355,7 @@ public final class Client implements ISynchAsynchConnection { private void sendClose(Serializable snd) throws IOException { isClosing = true; + debug("send:" + address + ":" + port + ":" + snd); sendIt(snd); if (isClosing) { try { @@ -405,21 +408,28 @@ public final class Client implements ISynchAsynchConnection { try { // We've received some data, so the connection is alive receiveResp(); - debug("recv:" + address + ":" + port + ":" + rcv); // Handle all messages if (rcv instanceof SynchMessage) { // Handle synch message. The only valid synch message is // 'close'. + debug("recv:" + address + ":" + port + ":" + rcv); handler.handleSynchEvent(new SynchConnectionEvent(this, ((SynchMessage) rcv).getData())); } else if (rcv instanceof AsynchMessage) { + debug("recv:" + address + ":" + port + ":" + rcv); Serializable d = ((AsynchMessage) rcv).getData(); // Handle asynch messages. handler.handleAsynchEvent(new AsynchConnectionEvent(this, d)); } else if (rcv instanceof PingMessage) { + if (Trace.ON && pingdebug != null) { + pingdebug.msg("recv:" + address + ":" + port + ":" + rcv); + } // Handle ping by sending response back immediately sendIt(pingResp); } else if (rcv instanceof PingResponseMessage) { + if (Trace.ON && pingdebug != null) { + pingdebug.msg("recv:" + address + ":" + port + ":" + rcv); + } // Do nothing with ping response } else throw new IOException("Invalid message received."); @@ -465,6 +475,9 @@ public final class Client implements ISynchAsynchConnection { // interval, then ping waitForPing = true; // Actually send ping instance + if (Trace.ON && pingdebug != null) { + pingdebug.msg("recv:" + address + ":" + port + ":" + ping); + } sendIt(ping); if (waitForPing) { try { @@ -498,7 +511,9 @@ public final class Client implements ISynchAsynchConnection { break; } } - debug("ping:" + address + ":" + port + " terminating"); + if (Trace.ON && pingdebug != null) { + pingdebug.msg("ping:" + address + ":" + port + " terminating"); + } } }, "ping:" + address + ":" + port); } diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java index 6ffeb3c15..b06abcaa1 100644 --- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java +++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java @@ -903,19 +903,8 @@ public abstract class SOContainer implements ISharedObjectContainer { debug("Ignoring ContainerMessage from null sender...ignoring"); return null; } - ID toID = contmess.getToContainerID(); - if (toID == null) { - return contmess; - } else { - if (toID.equals(getID())) { - return contmess; - } else { - debug("Ignoring ContainerMessage from " + fromID + " to " - + toID); - return null; - } - } - // OK + //OK..let it continue on it's journey + return contmess; } else { debug("Ignoring invalid ContainerMessage:" + mess); return null; diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java index 609bc9ec2..9af211983 100644 --- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java +++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContext.java @@ -24,8 +24,10 @@ import org.eclipse.ecf.core.SharedObjectContainerJoinException; import org.eclipse.ecf.core.SharedObjectDescription; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.util.QueueEnqueue; +import org.eclipse.ecf.provider.Trace; public class SOContext implements ISharedObjectContext { + static Trace debug = Trace.create("sharedobjectcontext"); protected SOContainer container = null; protected ID sharedObjectID; protected ID homeContainerID; @@ -43,6 +45,19 @@ public class SOContext implements ISharedObjectContext { this.queue = queue; } + protected void trace(String msg) { + if (Trace.ON && debug != null) { + debug.msg(msg); + } + } + + protected void traceDump(String msg, Throwable e) { + if (Trace.ON && debug != null) { + debug.dumpStack(e, msg); + } + } + + protected synchronized void makeInactive() { container = null; properties = null; @@ -98,9 +113,12 @@ public class SOContext implements ISharedObjectContext { public synchronized void joinGroup(ID groupID, Object loginData) throws SharedObjectContainerJoinException { if (isInactive()) { + trace("joinGroup("+groupID+") CONTEXT INACTIVE"); return; - } else + } else { + trace("joinGroup("+groupID+")"); container.joinGroup(groupID, loginData); + } } /* @@ -110,9 +128,12 @@ public class SOContext implements ISharedObjectContext { */ public synchronized void leaveGroup() { if (isInactive()) { + trace("leaveGroup() CONTEXT INACTIVE"); return; - } else + } else { + trace("leaveGroup()"); container.leaveGroup(); + } } /* @@ -172,8 +193,10 @@ public class SOContext implements ISharedObjectContext { public synchronized void sendCreate(ID toContainerID, SharedObjectDescription sd) throws IOException { if (isInactive()) { + trace("sendCreate("+toContainerID+","+sd+") CONTEXT INACTIVE"); return; } else { + trace("sendCreate("+toContainerID+","+sd+")"); container.sendCreate(sharedObjectID, toContainerID, sd); } } @@ -183,8 +206,10 @@ public class SOContext implements ISharedObjectContext { */ public void sendCreateResponse(ID toContainerID, Throwable throwable, long identifier) throws IOException { if (isInactive()) { + trace("sendCreateResponse("+toContainerID+","+throwable+","+identifier+") CONTEXT INACTIVE"); return; } else { + trace("sendCreateResponse("+toContainerID+","+throwable+","+identifier+")"); container.sendCreateResponse(toContainerID, sharedObjectID, throwable, identifier); } } @@ -196,8 +221,10 @@ public class SOContext implements ISharedObjectContext { */ public synchronized void sendDispose(ID toContainerID) throws IOException { if (isInactive()) { + trace("sendDispose("+toContainerID+") CONTEXT INACTIVE"); return; } else { + trace("sendDispose("+toContainerID+")"); container.sendDispose(toContainerID, sharedObjectID); } } @@ -210,8 +237,10 @@ public class SOContext implements ISharedObjectContext { */ public void sendMessage(ID toContainerID, Object data) throws IOException { if (isInactive()) { + trace("sendMessage("+toContainerID+","+data+") CONTEXT INACTIVE"); return; } else { + trace("sendMessage("+toContainerID+","+data+") CONTEXT INACTIVE"); container.sendMessage(toContainerID, sharedObjectID, data); } } @@ -232,8 +261,10 @@ public class SOContext implements ISharedObjectContext { */ public IOSGIService getServiceAccess() { if (isInactive()) { + trace("getServiceAccess() CONTEXT INACTIVE returning null"); return null; } else { + trace("getServiceAccess()"); return container.getOSGIServiceInterface(); } } |