1 22 package org.jboss.mq.il.uil2.msgs; 23 24 import java.io.ObjectOutputStream ; 25 import java.io.IOException ; 26 import java.io.ObjectInputStream ; 27 import org.jboss.mq.ConnectionToken; 28 29 33 public class ConnectionTokenMsg extends BaseMsg 34 { 35 ConnectionToken token; 36 37 public ConnectionTokenMsg() 38 { 39 this(null); 40 } 41 public ConnectionTokenMsg(ConnectionToken token) 42 { 43 super(MsgTypes.m_setSpyDistributedConnection); 44 this.token = token; 45 } 46 47 public ConnectionToken getToken() 48 { 49 return token; 50 } 51 52 public void trimReply() 53 { 54 token = null; 55 } 56 57 public void write(ObjectOutputStream out) throws IOException 58 { 59 super.write(out); 60 int hasToken = token != null ? 1 : 0; 61 out.writeByte(hasToken); 62 if (hasToken == 1) 63 out.writeObject(token); 64 } 65 public void read(ObjectInputStream in) throws IOException , ClassNotFoundException 66 { 67 super.read(in); 68 int hasToken = in.readByte(); 69 if (hasToken == 1) 70 token = (ConnectionToken) in.readObject(); 71 } 72 } 73 | Popular Tags |