channel.send(service_msg);
}
}
private Object handleStateRequest(Event evt, boolean hasReturnValue) {
StateTransferInfo info=(StateTransferInfo)evt.getArg();
String id=info.state_id;
String original_id=id;
Address requester=info.target; // the sender of the state request
if(id == null) {
if(log.isWarnEnabled()) {
log.warn("Invalid state request " + info + " arrived at Multiplexer, dropping it");
}
return new StateTransferInfo(null, original_id, 0L, null);
}
try {
int index=id.indexOf(SEPARATOR);
if(index > -1) {
info.state_id=id.substring(index + SEPARATOR_LEN);
id=id.substring(0, index); // similar reuse as above...
}
else {
info.state_id=null;
}
MuxChannel mux_ch=services.get(id);
//JGRP-616
if(mux_ch == null) {
if(log.isWarnEnabled())
log.warn("State provider " + channel.getLocalAddress()
+ " does not have service with id "
+ id
+ ", returning null state");
return new StateTransferInfo(null, original_id, 0L, null);
}
// state_id will be null, get regular state from the service named state_id
StateTransferInfo ret=(StateTransferInfo)passToMuxChannel(mux_ch,
evt,
fifo_queue,
requester,
id,
hasReturnValue);
if(ret != null) {
ret.state_id=original_id;
}
else {
return new StateTransferInfo(null, original_id, 0L, null);
}
return ret;
}
catch(Throwable ex) {
if(log.isErrorEnabled())
log.error("failed returning the application state, will return null", ex);
return new StateTransferInfo(null, original_id, 0L, null);
}
}