case Event.MSG: {
Message msg = (Message) evt.getArg();
MuxHeader hdr = (MuxHeader) msg.getHeader(MUX_ID);
if (hdr != null) {
short id = hdr.getId();
UpHandler handler = handlers.get(id);
return (handler != null) ? handler.up(evt) : new NoMuxHandler(id);
}
break;
}
case Event.GET_APPLSTATE:
case Event.GET_STATE_OK:
case Event.STATE_TRANSFER_OUTPUTSTREAM:
case Event.STATE_TRANSFER_INPUTSTREAM: {
StateTransferInfo info=(StateTransferInfo)evt.getArg();
String state_id=info.state_id;
UpHandler basicHandler = null;
boolean multipleBasic = false;
for (UpHandler uh: handlers.values())
{
if (uh instanceof StateTransferFilter)
{
if (((StateTransferFilter) uh).accepts(state_id))
{
return (uh.up(evt));
}
}
else if (basicHandler == null)
{
basicHandler = uh;
}
else
{
multipleBasic = true;
}
}
if (basicHandler != null)
{
if (multipleBasic)
{
// TODO throw exception
log.warn("Received state transfer related event with more " +
"than one basic UpHandler registered. Arbitrarily " +
"picking a handler to handle request");
}
return basicHandler.up(evt);
}
// else let default handler handle it below
break;
}
case Event.BLOCK: