git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1390931 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2012-09-27 10:28:20 +00:00
parent c02acbd3d4
commit 3f49df7d70

View File

@ -24,7 +24,7 @@ import java.util.concurrent.locks.ReentrantLock;
*/
public class MutexTransport extends TransportFilter {
private final ReentrantLock wreiteLock = new ReentrantLock();
private final ReentrantLock writeLock = new ReentrantLock();
private boolean syncOnCommand;
public MutexTransport(Transport next) {
@ -40,11 +40,11 @@ public class MutexTransport extends TransportFilter {
@Override
public void onCommand(Object command) {
if (syncOnCommand) {
wreiteLock.lock();
writeLock.lock();
try {
transportListener.onCommand(command);
} finally {
wreiteLock.unlock();
writeLock.unlock();
}
} else {
transportListener.onCommand(command);
@ -53,41 +53,41 @@ public class MutexTransport extends TransportFilter {
@Override
public FutureResponse asyncRequest(Object command, ResponseCallback responseCallback) throws IOException {
wreiteLock.lock();
writeLock.lock();
try {
return next.asyncRequest(command, null);
} finally {
wreiteLock.unlock();
writeLock.unlock();
}
}
@Override
public void oneway(Object command) throws IOException {
wreiteLock.lock();
writeLock.lock();
try {
next.oneway(command);
} finally {
wreiteLock.unlock();
writeLock.unlock();
}
}
@Override
public Object request(Object command) throws IOException {
wreiteLock.lock();
writeLock.lock();
try {
return next.request(command);
} finally {
wreiteLock.unlock();
writeLock.unlock();
}
}
@Override
public Object request(Object command, int timeout) throws IOException {
wreiteLock.lock();
writeLock.lock();
try {
return next.request(command, timeout);
} finally {
wreiteLock.unlock();
writeLock.unlock();
}
}