if (trace) { log.trace("read acknowledge()"); }  return request; } case ACKNOWLEDGE_BATCH:
if (trace) { log.trace("read acknowledgeDelivery()"); }  return request; } case ACKNOWLEDGE_LIST:
   public Object read(InputStream in, Map map) throws IOException, ClassNotFoundException   {                  DataInputStream dis;            if (in instanceof DataInputStream)      {         dis = (DataInputStream)in;               }      else      {                 //Further sanity check         if (in instanceof ObjectInputStream)         {            throw new IllegalArgumentException("Invalid stream - are you sure you have configured socket wrappers?");         }                  //This would be the case for the HTTP transport for example         //Wrap the stream                  //TODO Ideally remoting would let us wrap this before invoking the marshaller         //but this does not appear to be possible         dis = new DataInputStream(in);      }            // First byte read is always version      byte version = dis.readByte();      byte formatType = (byte)dis.read();      if (trace) { log.trace("reading, format type is " + formatType); }            try      {            switch (formatType)         {            case SERIALIZED:            {               // Delegate to serialization               Object ret = deserialize(dis);                  if (trace) { log.trace("read using standard serialization"); }                  return ret;            }            case SEND:            {               MethodInvocation mi = readHeader(dis);                  byte messageType = dis.readByte();                  JBossMessage m = (JBossMessage)MessageFactory.createMessage(messageType);                  m.read(dis);                  Object[] args = new Object[] {m};                  mi.setArguments(args);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read send()"); }                  return request;            }            case MORE:            {               MethodInvocation mi = readHeader(dis);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read activate()"); }                  return request;            }                     case SEND_TRANSACTION:            {               MethodInvocation mi = readHeader(dis);                  TransactionRequest tr = new TransactionRequest();                  tr.read(dis);                  Object[] args = new Object[] {tr};                  mi.setArguments(args);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read sendTransaction()"); }                  return request;            }            case GET_ID_BLOCK:            {               MethodInvocation mi = readHeader(dis);                  int size = dis.readInt();                  Object[] args = new Object[] {new Integer(size)};                  mi.setArguments(args);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read getIdBlock()"); }                  return request;            }            case ACKNOWLEDGE:            {               MethodInvocation mi = readHeader(dis);                              long l = dis.readLong();                              Object[] args = new Object[] {new DefaultAck(l)};                  mi.setArguments(args);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read acknowledge()"); }                  return request;            }            case ACKNOWLEDGE_BATCH:            {               MethodInvocation mi = readHeader(dis);                                          int num = dis.readInt();                              List acks = new ArrayList(num);                              for (int i = 0; i < num; i++)               {                  long l = dis.readLong();                                                      acks.add(new DefaultAck(l));               }                                          Object[] args = new Object[] {acks};                  mi.setArguments(args);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read acknowledge()"); }                  return request;            }            case CANCEL_DELIVERIES:            {               MethodInvocation mi = readHeader(dis);                  int size = dis.readInt();                  List acks = new ArrayList(size);                  for (int i = 0; i < size; i++)               {                  Cancel cancel = new Cancel();                                    cancel.read(dis);                                    acks.add(cancel);               }                  Object[] args = new Object[] {acks};                  mi.setArguments(args);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read cancelDeliveries()"); }                  return request;            }            case RECOVER_DELIVERIES:            {               MethodInvocation mi = readHeader(dis);                  int size = dis.readInt();                  List dels = new ArrayList(size);                  for (int i = 0; i < size; i++)               {                  DeliveryRecovery d = new DeliveryRecovery();                                    d.read(dis);                                    dels.add(d);               }                  Object[] args = new Object[] {dels};                  mi.setArguments(args);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read unackedAckInfos()"); }                  return request;            }            case CONFIRM_DELIVERY:            {               MethodInvocation mi = readHeader(dis);                  int count = dis.readInt();                                    Object[] args = new Object[] {new Integer(count)};                  mi.setArguments(args);                  InvocationRequest request =                  new InvocationRequest(null, ServerPeer.REMOTING_JMS_SUBSYSTEM,                                        new MessagingMarshallable(version, mi), null, null, null);                  if (trace) { log.trace("read confirmDelivery()"); }                  return request;            }            case ID_BLOCK_RESPONSE:            {               IdBlock block = new IdBlock();                  block.read(dis);                  InvocationResponse resp = new InvocationResponse(null, new MessagingMarshallable(version, block), false, null);                  if (trace) { log.trace("read id block response"); }                  return resp;            }            case HANDLE_MESSAGE_RESPONSE:            {               HandleMessageResponse res = new HandleMessageResponse();                  res.read(dis);                  InvocationResponse resp = new InvocationResponse(null, new MessagingMarshallable(version, res), false, null);                  if (trace) { log.trace("read handle message response"); }                  return resp;            }            case BROWSE_MESSAGE_RESPONSE:            {               byte type = dis.readByte();                              JBossMessage msg = (JBossMessage)MessageFactory.createMessage(type);                              msg.read(dis);                              InvocationResponse resp = new InvocationResponse(null, new MessagingMarshallable(version, msg), false, null);                  if (trace) { log.trace("read browse message response"); }                  return resp;            }            case BROWSE_MESSAGES_RESPONSE:            {               int num = dis.readInt();                              Message[] msgs = new Message[num];                              for (int i = 0; i < num; i++)               {                  byte type = dis.readByte();                                    JBossMessage msg = (JBossMessage)MessageFactory.createMessage(type);                                    msg.read(dis);                                    msgs[i] = msg;               }                              InvocationResponse resp = new InvocationResponse(null, new MessagingMarshallable(version, msgs), false, null);                  if (trace) { log.trace("read browse message response"); }                  return resp;            }            case NULL_RESPONSE:            {                   InvocationResponse resp =                  new InvocationResponse(null, new MessagingMarshallable(version, null), false, null);                  if (trace) { log.trace("read null response"); }                  return resp;            }            case CALLBACK:            {               String sessionId = dis.readUTF();               ClientDelivery dr = new ClientDelivery();                              dr.read(dis);               // Recreate Callback.               MessagingMarshallable mm = new MessagingMarshallable(version, dr);               Callback callback = new Callback(mm);               InternalInvocation ii                  = new InternalInvocation(InternalInvocation.HANDLECALLBACK, new Object[]{callback});               InvocationRequest request                  = new InvocationRequest(sessionId, CallbackManager.JMS_CALLBACK_SUBSYSTEM,                                          ii, null, null, null);                  if (trace) { log.trace("read callback()"); }                  return request;            }            case CALLBACK_LIST:            {               // Recreate ArrayList of Callbacks (for Callback polling).               String sessionId = dis.readUTF();               int size = dis.readInt();               ArrayList callbackList = new ArrayList(size);               for (int i = 0; i < size; i++)               {                  // We don't use acknowledgeable push callbacks                  ClientDelivery delivery = new ClientDelivery();                  delivery.read(dis);                  MessagingMarshallable mm = new MessagingMarshallable(version, delivery);                  Callback callback = new Callback(mm);                  callbackList.add(callback);               }               return new InvocationResponse(sessionId, callbackList, false, null);            }            default:            {               throw new IllegalStateException("Invalid format type " + formatType);            }         }      }      catch (Exception e)      {         IOException e2 = new IOException(e.getMessage());         e2.setStackTrace(e.getStackTrace());         throw e2;      }   }