}
else
{
//Some other remoting internal thing, e.g. PING, DISCONNECT, add listener etc
packet = new SerializedPacket(req);
}
}
else if (obj instanceof InvocationResponse)
{
InvocationResponse resp = (InvocationResponse)obj;
Object param = resp.getResult();
if (param instanceof ResponseSupport)
{
// A JBM invocation response
packet = (ResponseSupport)param;
if (trace) { log.trace("JBM Response"); }
}
else if (param instanceof List)
{
// List of polled Callbacks, this is how messages are delivered when using
// polled callbacks e.g. the HTTP transport
packet = new PolledCallbacksDelivery((List)param, resp.getSessionId());
}
else if (param == null)
{
// Null response
packet = new NullResponse();
if (trace) { log.trace("Null Response"); }
}
else
{
// Return value from some remoting internal invocation e.g. PONG - return value from PING
packet = new SerializedPacket(obj);
}
}
else
{
//Actually this should never occur
packet = new SerializedPacket(obj);
}
if (trace) { log.trace("Writing packet: " + packet); }
packet.write(dos);