diff options
author | Rafael H. Schloming <rhs@apache.org> | 2008-06-09 16:07:17 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2008-06-09 16:07:17 +0000 |
commit | 806b7385b193bf83d89c375155d2ae0a8edbf796 (patch) | |
tree | 95b0aecce5f9ac994b51375561ae52c8d58ecc90 /qpid/java | |
parent | 6082eebc95fa16798f92936dbc6143da9618d203 (diff) | |
download | qpid-python-806b7385b193bf83d89c375155d2ae0a8edbf796.tar.gz |
QPID-901: added logging of sync bit and command-id
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@665733 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
4 files changed, 51 insertions, 3 deletions
diff --git a/qpid/java/common/src/main/java/org/apache/qpidity/transport/Channel.java b/qpid/java/common/src/main/java/org/apache/qpidity/transport/Channel.java index 2e11329c5b..fb8918eb7b 100644 --- a/qpid/java/common/src/main/java/org/apache/qpidity/transport/Channel.java +++ b/qpid/java/common/src/main/java/org/apache/qpidity/transport/Channel.java @@ -212,4 +212,9 @@ public class Channel extends Invoker throw new UnsupportedOperationException(); } + public String toString() + { + return String.format("%s:%s", connection, channel); + } + } diff --git a/qpid/java/common/src/main/java/org/apache/qpidity/transport/Method.java b/qpid/java/common/src/main/java/org/apache/qpidity/transport/Method.java index f2063fe964..f72ebd570c 100644 --- a/qpid/java/common/src/main/java/org/apache/qpidity/transport/Method.java +++ b/qpid/java/common/src/main/java/org/apache/qpidity/transport/Method.java @@ -40,6 +40,7 @@ public abstract class Method extends Struct implements ProtocolEvent // XXX: command subclass? private int id; + private boolean idSet = false; private boolean sync = false; public final int getId() @@ -50,6 +51,7 @@ public abstract class Method extends Struct implements ProtocolEvent void setId(int id) { this.id = id; + this.idSet = true; } public final boolean isSync() @@ -80,4 +82,36 @@ public abstract class Method extends Struct implements ProtocolEvent } } + public String toString() + { + if (getEncodedTrack() != Frame.L4) + { + return super.toString(); + } + + StringBuilder str = new StringBuilder(); + + if (idSet) + { + str.append("id="); + str.append(id); + } + + if (sync) + { + if (str.length() > 0) + { + str.append(" "); + } + str.append(" [sync]"); + } + + if (str.length() > 0) + { + str.append(" "); + } + str.append(super.toString()); + return str.toString(); + } + } diff --git a/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java b/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java index a0229adf1e..54125eb03f 100644 --- a/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java +++ b/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java @@ -123,6 +123,12 @@ public class Session extends Invoker return commandsIn++; } + void identify(Method cmd) + { + cmd.setId(nextCommandId()); + log.debug("ID: [%s] %s", this.channel, cmd); + } + public void processed(Method command) { processed(command.getId()); @@ -155,7 +161,7 @@ public class Session extends Invoker } } - public void flushProcessed() + public void flushProcessed() { RangeSet copy; synchronized (processedLock) @@ -244,6 +250,7 @@ public class Session extends Invoker synchronized (commands) { int next = commandsOut++; + m.setId(next); if (next == 0) { sessionCommandPoint(0, 0); @@ -357,7 +364,9 @@ public class Session extends Invoker } else { - throw new RuntimeException("timed out waiting for sync"); + throw new RuntimeException + (String.format + ("timed out waiting for sync: complete = %s, point = %s", maxComplete, point)); } } } diff --git a/qpid/java/common/src/main/java/org/apache/qpidity/transport/SessionDelegate.java b/qpid/java/common/src/main/java/org/apache/qpidity/transport/SessionDelegate.java index deb3ee156d..bd56149b34 100644 --- a/qpid/java/common/src/main/java/org/apache/qpidity/transport/SessionDelegate.java +++ b/qpid/java/common/src/main/java/org/apache/qpidity/transport/SessionDelegate.java @@ -40,7 +40,7 @@ public abstract class SessionDelegate } public void command(Session ssn, Method method) { - method.setId(ssn.nextCommandId()); + ssn.identify(method); method.dispatch(ssn, this); if (!method.hasPayload()) { |