1 24 package org.objectweb.joram.shared.client; 25 26 import java.io.Externalizable ; 27 import java.io.InputStream ; 28 import java.io.OutputStream ; 29 import java.io.IOException ; 30 31 import org.objectweb.joram.shared.stream.Streamable; 32 import org.objectweb.joram.shared.stream.StreamUtil; 33 34 38 public abstract class AbstractJmsRequest extends AbstractJmsMessage { 39 44 protected volatile int requestId = -1; 45 46 49 public final void setRequestId(int requestId) { 50 this.requestId = requestId; 51 } 52 53 54 public final synchronized int getRequestId() { 55 return requestId; 56 } 57 58 62 protected String target = null; 63 64 65 public final void setTarget(String target) { 66 this.target = target; 67 } 68 69 70 public final String getTarget() { 71 return target; 72 } 73 74 77 public AbstractJmsRequest() {} 78 79 85 public AbstractJmsRequest(String target) { 86 this.target = target; 87 } 88 89 public final String toString() { 90 StringBuffer strbuf = new StringBuffer (); 91 toString(strbuf); 92 return strbuf.toString(); 93 } 94 95 public void toString(StringBuffer strbuf) { 96 strbuf.append('(').append(super.toString()); 97 strbuf.append(",requestId=").append(requestId); 98 strbuf.append(",target=").append(target); 99 strbuf.append(')'); 100 } 101 102 105 106 112 public void writeTo(OutputStream os) throws IOException { 113 StreamUtil.writeTo(requestId, os); 114 StreamUtil.writeTo(target, os); 115 } 116 117 123 public void readFrom(InputStream is) throws IOException { 124 requestId = StreamUtil.readIntFrom(is); 125 target = StreamUtil.readStringFrom(is); 126 } 127 } 128 | Popular Tags |