Author: rajith
Date: Wed Nov 28 12:53:51 2007
New Revision: 599144
URL: http://svn.apache.org/viewvc?rev=599144&view=rev
Log:
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.
Modified:
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java
Modified:
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java?rev=599144&r1=599143&r2=599144&view=diff
==============================================================================
---
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java
(original)
+++
incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/transport/Session.java
Wed Nov 28 12:53:51 2007
@@ -41,17 +41,17 @@
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 @@
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 @@
commands.notifyAll();
log.debug("%s commands remaining: %s", this, commands);
}
- }
}
void complete(long mark)
@@ -220,10 +217,9 @@
{
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);
}
}