}
/*----------------------------------*/
/* Get output streams */
/*----------------------------------*/
ObjectOutput objectOut;
try {
objectOut = new ObjectOutputStream(out);
} catch (IOException e) {
throw newIOException("Cannot open object output stream to server: ", e);
}
/*----------------------------------*/
/* Write ServerMetaData */
/*----------------------------------*/
try {
server.writeExternal(objectOut);
} catch (IOException e) {
throw newIOException("Cannot write the ServerMetaData to the server: ", e);
}
/*----------------------------------*/
/* Write ClusterMetaData */
/*----------------------------------*/
try {
ClusterRequest clusterRequest = new ClusterRequest(cluster);
objectOut.write(clusterRequest.getRequestType().getCode());
clusterRequest.writeExternal(objectOut);
} catch (Throwable e) {
throw newIOException("Cannot write the ClusterMetaData to the server: ", e);
}
/*----------------------------------*/
/* Write request type */
/*----------------------------------*/
try {
objectOut.write(req.getRequestType().getCode());
} catch (IOException e) {
throw newIOException("Cannot write the request type to the server: ", e);
}
/*----------------------------------*/
/* Write request */
/*----------------------------------*/
try {
req.writeExternal(objectOut);
objectOut.flush();
out.flush();
} catch (java.io.NotSerializableException e) {
throw new IllegalArgumentException("Object is not serializable: " + e.getMessage());