Object obj = versionedRead(inputStream, invoker, getClass().getClassLoader(), version);
// setting timestamp since about to start processing
lastRequestHandledTimestamp = System.currentTimeMillis();
InvocationRequest req = null;
boolean createdInvocationRequest = false;
boolean isError = false;
if(obj instanceof InvocationRequest)
{
req = (InvocationRequest)obj;
}
else
{
req = createInvocationRequest(obj, socketWrapper);
createdInvocationRequest = true;
performVersioning = false;
}
Object resp = null;
try
{
// Make absolutely sure thread interrupted is cleared.
Thread.interrupted();
if(trace) { log.trace("about to call " + invoker + ".invoke()"); }
// handle socket-specific invocations
if ("$GET_CLIENT_LOCAL_ADDRESS$".equals(req.getParameter()))
{
Socket s = socketWrapper.getSocket();
InetAddress a = s.getInetAddress();
resp = new InvocationResponse(req.getSessionId(), a, false, null);
}
else
{
// call transport on the subclass, get the result to handback
resp = invoker.invoke(req);
}
if(trace) { log.trace(invoker + ".invoke() returned " + resp); }
}
catch (Throwable ex)
{
resp = ex;
isError = true;
if (trace) log.trace(invoker + ".invoke() call failed", ex);
}
Thread.interrupted(); // clear interrupted state so we don't fail on socket writes
if(isOneway(req.getRequestPayload()))
{
if(trace) { log.trace("oneway request, writing no reply on the wire"); }
}
else
{
if(!createdInvocationRequest)
{
// need to return invocation response
if(trace) { log.trace("creating response instance"); }
resp = new InvocationResponse(req.getSessionId(), resp, isError, req.getReturnPayload());
}
OutputStream outputStream = socketWrapper.getOutputStream();
if (performVersioning)
{