1 24 25 package org.objectweb.dream.protocol.causality; 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 import org.objectweb.dream.util.Util; 36 37 40 public class CausalityChunkImpl extends AbstractChunk 41 implements 42 CausalityChunk, 43 Externalizable 44 { 45 46 private Object causalityStamp; 47 48 52 55 public Object getCausalityStamp() 56 { 57 return causalityStamp; 58 } 59 60 63 public void setCausalityStamp(Object stamp) 64 { 65 causalityStamp = stamp; 66 } 67 68 74 public ChunkType getType() 75 { 76 return TYPE; 77 } 78 79 82 public void transfertState(Chunk newInstance) 83 { 84 ((CausalityChunk) newInstance).setCausalityStamp(getCausalityStamp()); 85 } 86 87 90 public void recycle() 91 { 92 causalityStamp = null; 93 } 94 95 99 102 public void readExternal(ObjectInput in) throws IOException , 103 ClassNotFoundException 104 { 105 causalityStamp = Util.readObject(in); 106 } 107 108 111 public void writeExternal(ObjectOutput out) throws IOException 112 { 113 Util.writeObject(out, causalityStamp); 114 } 115 116 } | Popular Tags |