summaryrefslogtreecommitdiff
path: root/qpid/java/common
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2007-11-28 20:53:51 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2007-11-28 20:53:51 +0000
commit8537de78e4c0a36ace6e0b82026042f6c8164e1b (patch)
tree4eb02340688d97c7ba988801e4496fce4220a7b9 /qpid/java/common
parent2665a7c4d0a991094b5a7a43f026f76691a441e8 (diff)
downloadqpid-python-8537de78e4c0a36ace6e0b82026042f6c8164e1b.tar.gz
Modified the code to not keep the command in the map if "enable_command_replay" is false.
However we still need to keep the command_id to implement sync properly. By default "enable_command_replay" is false. The earlier implementation completely avoided incrementing the command count and putting it in the map. This causes a problem as it will break the contract for sync. When the client code calls sync we need to only return when the broker has sent the EM that is at or above that command_id. So we need to keep that around. Keeping track of command_ids is different from keeping commands around. We keep commands around for reply, but we need to keep track of command_id's to implement the execution layer properly. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@599144 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/common')
-rw-r--r--qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java30
1 files changed, 13 insertions, 17 deletions
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 bf16a6c0d8..5a8a92fcf4 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
@@ -41,17 +41,17 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class Session extends Invoker
{
- static
+ static
{
- String enableReplay = "enable_replay";
- try
- {
- ENABLE_REPLAY = new Boolean(System.getProperties().getProperty(enableReplay, "false"));
- }
- catch (Exception e)
- {
- ENABLE_REPLAY = false;
- }
+ String enableReplay = "enable_command_replay";
+ try
+ {
+ ENABLE_REPLAY = new Boolean(System.getProperties().getProperty(enableReplay, "false"));
+ }
+ catch (Exception e)
+ {
+ ENABLE_REPLAY = false;
+ }
}
private static boolean ENABLE_REPLAY = false;
private static final Logger log = Logger.get(Session.class);
@@ -190,8 +190,6 @@ public class Session extends Invoker
void complete(long lower, long upper)
{
log.debug("%s complete(%d, %d)", this, lower, upper);
- if( ENABLE_REPLAY )
- {
synchronized (commands)
{
for (long id = lower; id <= upper; id++)
@@ -201,7 +199,6 @@ public class Session extends Invoker
commands.notifyAll();
log.debug("%s commands remaining: %s", this, commands);
}
- }
}
void complete(long mark)
@@ -220,10 +217,9 @@ public class Session extends Invoker
{
synchronized (commands)
{
- if(ENABLE_REPLAY)
- {
- commands.put(commandsOut++, m);
- }
+ // You only need to keep the command if you need command level replay.
+ // If not we only need to keep track of commands to make sync work
+ commands.put(commandsOut++,(ENABLE_REPLAY?m:null));
channel.method(m);
}
}