1 24 25 package org.objectweb.dream.queue; 26 27 import java.io.Externalizable ; 28 import java.io.IOException ; 29 import java.io.ObjectInput ; 30 import java.io.ObjectOutput ; 31 32 import org.objectweb.dream.message.AbstractChunk; 33 import org.objectweb.dream.message.Chunk; 34 import org.objectweb.dream.message.ChunkType; 35 36 39 public class SequenceNumberChunkImpl extends AbstractChunk 40 implements 41 SequenceNumberChunk, 42 Externalizable 43 { 44 45 protected long sn; 46 47 51 54 public long getSequenceNumber() 55 { 56 return sn; 57 } 58 59 62 public void setSequenceNumber(long sn) 63 { 64 this.sn = sn; 65 } 66 67 71 74 public ChunkType getType() 75 { 76 return TYPE; 77 } 78 79 82 public void transfertState(Chunk newInstance) 83 { 84 ((SequenceNumberChunk) newInstance).setSequenceNumber(getSequenceNumber()); 85 } 86 87 90 public void recycle() 91 { 92 sn = -1; 93 } 94 95 99 102 public void readExternal(ObjectInput in) throws IOException , 103 ClassNotFoundException 104 { 105 sn = in.readLong(); 106 } 107 108 111 public void writeExternal(ObjectOutput out) throws IOException 112 { 113 out.writeLong(sn); 114 } 115 116 } | Popular Tags |