if (null != clusterResponse && null != failure) {
clusterHandler.getLogger().debug("Failed to write to ClusterResponse", failure);
try {
info.setOutputStream(new CountingOutputStream(rawOut));
oos = new ObjectOutputStream(info.getOutputStream());
clusterResponse.setMetaData(clientProtocol);
clusterResponse.writeExternal(oos);
oos.flush();
} catch (final IOException ie) {
final String m = "Failed to write to ClusterResponse: " + ie.getMessage();
clusterHandler.getLogger().error(m, ie);
throw Exceptions.newIOException(m, ie);
}
throw failure;
}
}
requestTypeByte = ois.readByte();
requestType = RequestType.valueOf(requestTypeByte);
if (requestType == RequestType.NOP_REQUEST) {
return;
}
// Exceptions should not be thrown from these methods
// They should handle their own exceptions and clean
// things up with the client accordingly.
final Response response;
switch (requestType) {
case EJB_REQUEST:
response = processEjbRequest(ois, clientProtocol);
break;
case JNDI_REQUEST:
response = processJndiRequest(ois, clientProtocol);
break;
case AUTH_REQUEST:
response = processAuthRequest(ois, clientProtocol);
break;
default:
logger.error("\"" + requestType + " " + clientProtocol.getSpec() + "\" FAIL \"Unknown request type " + requestType);
return;
}
try {
info.setOutputStream(new CountingOutputStream(rawOut));
final CountingOutputStream cos = info.getOutputStream();
//Let client know we are using the requested protocol to respond
clientProtocol.writeExternal(cos);
cos.flush();
oos = new ObjectOutputStream(cos);
clusterHandler.processResponse(clusterResponse, oos, clientProtocol);
oos.flush();