only do delayStop () for SecurityExceptions

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1210503 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2011-12-05 15:44:26 +00:00
parent da7f9962c6
commit 712303e6ec
1 changed files with 6 additions and 3 deletions

View File

@ -290,8 +290,10 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
if (responseRequired) { if (responseRequired) {
response = new ExceptionResponse(e); response = new ExceptionResponse(e);
//still need to close this down - incase the peer of this transport doesn't play nice if(e instanceof java.lang.SecurityException){
delayedStop(2000); //still need to close this down - incase the peer of this transport doesn't play nice
delayedStop(2000, "Failed with SecurityException: " + e.getLocalizedMessage());
}
} else { } else {
serviceException(e); serviceException(e);
} }
@ -909,7 +911,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
} }
} }
public void delayedStop(final int waitTime) { public void delayedStop(final int waitTime, final String reason) {
if (waitTime > 0) { if (waitTime > 0) {
try { try {
DefaultThreadPools.getDefaultTaskRunnerFactory().execute(new Runnable() { DefaultThreadPools.getDefaultTaskRunnerFactory().execute(new Runnable() {
@ -917,6 +919,7 @@ public class TransportConnection implements Connection, Task, CommandVisitor {
try { try {
Thread.sleep(waitTime); Thread.sleep(waitTime);
stopAsync(); stopAsync();
LOG.info("Stopping " + transport.getRemoteAddress() + " because " + reason);
} catch (InterruptedException e) { } catch (InterruptedException e) {
} }
} }