applied patch for AMQ-1146

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@546482 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2007-06-12 13:42:52 +00:00
parent 0eae2880cc
commit a6cb80ceb0
1 changed files with 78 additions and 70 deletions

View File

@ -69,6 +69,7 @@ public class InactivityMonitor extends TransportFilter {
private void writeCheck() { private void writeCheck() {
synchronized(writeChecker) {
if( inSend.get() ) { if( inSend.get() ) {
log.trace("A send is in progress"); log.trace("A send is in progress");
return; return;
@ -86,10 +87,11 @@ public class InactivityMonitor extends TransportFilter {
} }
commandSent.set(false); commandSent.set(false);
}
} }
private void readCheck() { private void readCheck() {
synchronized(readChecker) {
if( inReceive.get() ) { if( inReceive.get() ) {
log.trace("A receive is in progress"); log.trace("A receive is in progress");
return; return;
@ -105,7 +107,10 @@ public class InactivityMonitor extends TransportFilter {
commandReceived.set(false); commandReceived.set(false);
} }
}
public void onCommand(Object command) { public void onCommand(Object command) {
synchronized(readChecker) {
inReceive.set(true); inReceive.set(true);
try { try {
if( command.getClass() == WireFormatInfo.class ) { if( command.getClass() == WireFormatInfo.class ) {
@ -124,9 +129,11 @@ public class InactivityMonitor extends TransportFilter {
commandReceived.set(true); commandReceived.set(true);
} }
} }
}
public void oneway(Object o) throws IOException { public void oneway(Object o) throws IOException {
synchronized(writeChecker) {
// Disable inactivity monitoring while processing a command. // Disable inactivity monitoring while processing a command.
inSend.set(true); inSend.set(true);
commandSent.set(true); commandSent.set(true);
@ -142,6 +149,7 @@ public class InactivityMonitor extends TransportFilter {
inSend.set(false); inSend.set(false);
} }
} }
}
public void onException(IOException error) { public void onException(IOException error) {
if( monitorStarted.get() ) { if( monitorStarted.get() ) {