use of org.apache.openejb.client.ClusterRequest in project tomee by apache.
the class ClusterRequestHandler method processRequest.
@Override
public ClusterResponse processRequest(final ObjectInputStream in, final ProtocolMetaData metaData) throws Exception {
final ClusterRequest req = new ClusterRequest();
req.setMetaData(metaData);
final ClusterResponse res = new ClusterResponse();
res.setMetaData(metaData);
try {
req.readExternal(in);
} catch (IOException e) {
res.setFailure(e);
return res;
} catch (ClassNotFoundException e) {
res.setFailure(new IOException().initCause(e));
return res;
}
final ClusterMetaData currentClusterMetaData = data.current();
if (req.getClusterMetaDataVersion() < currentClusterMetaData.getVersion()) {
if (logger.isDebugEnabled()) {
final URI[] locations = currentClusterMetaData.getLocations();
if (locations.length < 10) {
logger.debug("Sending client updated cluster locations: [" + Join.join(", ", locations) + "]");
} else {
logger.debug("Sending client updated cluster locations: " + locations.length + " locations total");
}
}
res.setUpdatedMetaData(currentClusterMetaData);
} else {
res.setCurrent();
}
return res;
}
Aggregations