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 final class ConsumerReceiveRequest extends AbstractJmsRequest { 39 40 private String selector; 41 42 43 public void setSelector(String selector) { 44 this.selector = selector; 45 } 46 47 48 public String getSelector() { 49 return selector; 50 } 51 52 53 private long timeToLive; 54 55 56 public void setTimeToLive(long timeToLive) { 57 this.timeToLive = timeToLive; 58 } 59 60 61 public long getTimeToLive() { 62 return timeToLive; 63 } 64 65 66 private boolean queueMode; 67 68 69 public void setQueueMode(boolean queueMode) { 70 this.queueMode = queueMode; 71 } 72 73 74 public boolean getQueueMode() { 75 return queueMode; 76 } 77 78 private boolean receiveAck; 79 80 public void setReceiveAck(boolean receiveAck) { 81 this.receiveAck = receiveAck; 82 } 83 84 public final boolean getReceiveAck() { 85 return receiveAck; 86 } 87 88 protected int getClassId() { 89 return CONSUMER_RECEIVE_REQUEST; 90 } 91 92 102 public ConsumerReceiveRequest(String targetName, String selector, 103 long timeToLive, boolean queueMode) { 104 super(targetName); 105 this.selector = selector; 106 this.timeToLive = timeToLive; 107 this.queueMode = queueMode; 108 receiveAck = false; 109 } 110 111 114 public ConsumerReceiveRequest() {} 115 116 119 120 126 public void writeTo(OutputStream os) throws IOException { 127 super.writeTo(os); 128 StreamUtil.writeTo(selector, os); 129 StreamUtil.writeTo(timeToLive, os); 130 StreamUtil.writeTo(queueMode, os); 131 StreamUtil.writeTo(receiveAck, os); 132 } 133 134 140 public void readFrom(InputStream is) throws IOException { 141 super.readFrom(is); 142 selector = StreamUtil.readStringFrom(is); 143 timeToLive = StreamUtil.readLongFrom(is); 144 queueMode = StreamUtil.readBooleanFrom(is); 145 receiveAck = StreamUtil.readBooleanFrom(is); 146 } 147 } 148 | Popular Tags |