Author: ron.sigal(a)jboss.com
Date: 2008-12-29 16:39:01 -0500 (Mon, 29 Dec 2008)
New Revision: 4766
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
Log:
JBREM-1073: Added facility to rethrow an InvalidStateException as a
CannotConnectException.
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java
===================================================================
---
remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-12-28
03:20:03 UTC (rev 4765)
+++
remoting2/branches/2.2/src/main/org/jboss/remoting/MicroRemoteClientInvoker.java 2008-12-29
21:39:01 UTC (rev 4766)
@@ -42,6 +42,7 @@
private LeasePinger leasePinger = null;
private String invokerSessionID = new GUID().toString();
private boolean parentFirstClassLoading = true;
+ private boolean changeInvalidStateToCannotConnect = false;
public MicroRemoteClientInvoker(InvokerLocator locator)
{
@@ -176,16 +177,26 @@
System.arraycopy(serverStackTrace, 0, completeStackTrace, 0,
serverStackTrace.length);
System.arraycopy(clientStackTrace, 0, completeStackTrace,
serverStackTrace.length, clientStackTrace.length);
+ Throwable responseException = null;
+ if (e instanceof ServerInvoker.InvalidStateException &&
changeInvalidStateToCannotConnect)
+ {
+ responseException = new CannotConnectException(e.getMessage(),
e.getCause());
+ }
+ else
+ {
+ responseException = e;
+ }
+
if (e.getCause() != null)
{
- e.getCause().setStackTrace(completeStackTrace);
+ responseException.getCause().setStackTrace(completeStackTrace);
}
else
{
- e.setStackTrace(completeStackTrace);
+ responseException.setStackTrace(completeStackTrace);
}
- throw e;
+ throw responseException;
}
if (trace) { log.trace(this + " received InvocationResponse so going to
return response's return value of " + returnValue);}
@@ -498,6 +509,13 @@
parentFirst = Boolean.valueOf(sflag).booleanValue();
}
parentFirstClassLoading = parentFirst;
+
+ flag = configuration.get(Remoting.CHANGE_INVALID_STATE_TO_CANNOT_CONNECT);
+ if (flag != null)
+ {
+ String sflag = flag.toString();
+ changeInvalidStateToCannotConnect = Boolean.valueOf(sflag).booleanValue();
+ }
}
/**
Show replies by date