public void run() { int fd; ResponseCallback cb = new ResponseCallback(mComm, mEvent); try { if (mEvent.payload.remaining() < 2) throw new ProtocolException("Truncated message"); int version = (int) mEvent.payload.get(); if (version != VERSION) throw new ProtocolException( "Close parameters version mismatch, expected " + VERSION + ", got " + version); int encoding_length = Serialization.DecodeVInt32(mEvent.payload); int start_position = mEvent.payload.position(); fd = mEvent.payload.getInt(); if ((mEvent.payload.position() - start_position) < encoding_length) mEvent.payload.position(start_position + encoding_length); mBroker.Close(cb, fd); } catch (Exception e) { int error = cb.error(Error.PROTOCOL_ERROR, e.getMessage()); log.severe("Protocol error (CLOSE) - " + e.getMessage()); if (error != Error.OK) log.severe("Problem sending (CLOSE) error back to client - " + Error.GetText(error)); } }
public void run() { String fileName; ResponseCallback cb = new ResponseCallback(mComm, mEvent); try { if ((fileName = Serialization.DecodeString(mEvent.payload)) == null) throw new ProtocolException("Filename not properly encoded in request packet"); mBroker.Remove(cb, fileName); } catch (ProtocolException e) { int error = cb.error(Error.PROTOCOL_ERROR, e.getMessage()); log.severe("Protocol error (REMOVE) - " + e.getMessage()); if (error != Error.OK) log.severe("Problem sending (REMOVE) error back to client - " + Error.GetText(error)); } }