CoreGroupCommunicationService.this.log.debug("getState called for service " + serviceName);
StateTransferProvider provider = stateProviders.get(serviceName);
if (provider != null) {
MarshalledValueOutputStream mvos = null;
Object state = provider.getCurrentState();
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
mvos = new MarshalledValueOutputStream(baos);
mvos.writeObject(state);
mvos.flush();
mvos.close();
return baos.toByteArray();
} catch (Exception ex) {
CoreGroupCommunicationService.this.log.error("getState failed for service " + serviceName, ex);
} finally {
if (mvos != null) {
try {
mvos.close();
} catch (IOException ignored) {
log.debug("Caught exception closing stream used for marshalling state", ignored);
}
}
}