summaryrefslogtreecommitdiff
path: root/java/common/src
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
commitac161c0a176aafe342d69e2203d4f36bbb96ee48 (patch)
tree65d9fde99317e1a0ea4322760c3d57dc1f293155 /java/common/src
parent04fb4fdba88145a473b9a3a56ac6fd531af89af2 (diff)
downloadqpid-python-ac161c0a176aafe342d69e2203d4f36bbb96ee48.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/qpid@599144 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
-rw-r--r--java/common/src/main/java/org/apache/qpidity/transport/Session.java30
1 files changed, 13 insertions, 17 deletions
diff --git a/java/common/src/main/java/org/apache/qpidity/transport/Session.java b/java/common/src/main/java/org/apache/qpidity/transport/Session.java
index bf16a6c0d8..5a8a92fcf4 100644
--- a/java/common/src/main/java/org/apache/qpidity/transport/Session.java
+++ b/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);
}
}