P
- the class of the payload vertex.T
- the class of the value carried by the message.public abstract class MessageWritable<P,T>
extends java.lang.Object
implements org.apache.hadoop.io.Writable
Modifier and Type | Field and Description |
---|---|
protected P |
payloadVertex |
protected int |
ttl |
protected T |
value |
Constructor and Description |
---|
MessageWritable()
Parameter-less constructor.
|
MessageWritable(P payloadVertex,
int ttl,
T value)
Constructor setting payload vertex id, value and time to live.
|
MessageWritable(P payloadVertex,
T value)
Constructor with only payload vertex id and value.
|
Modifier and Type | Method and Description |
---|---|
P |
getPayloadVertex()
Returns the payload vertex.
|
int |
getTTL()
Method that returns the time to live of the message.
|
T |
getValue() |
boolean |
isAZombie()
Method to check if the message should survive or be scrapped.
|
abstract MessageWritable<P,T> |
propagate()
This method propagates the message by creating a new MessageWritable and copying the containing values.
|
abstract MessageWritable<P,T> |
propagateAndDie()
This method propagates the message by creating a new MessageWritable and copying the containing values.
|
void |
readFields(java.io.DataInput in) |
void |
setValue(T value) |
protected abstract void |
specificRead(java.io.DataInput in)
Method that guarantees that extending classes are serialized properly.
|
protected abstract void |
specificWrite(java.io.DataOutput out)
Method that guarantees that extending classes are de-serialized properly.
|
void |
write(java.io.DataOutput out) |
public MessageWritable()
public MessageWritable(P payloadVertex, int ttl, T value)
payloadVertex
- ttl
- value
- public P getPayloadVertex()
public int getTTL()
public T getValue()
public boolean isAZombie()
public abstract MessageWritable<P,T> propagate()
public abstract MessageWritable<P,T> propagateAndDie()
public void readFields(java.io.DataInput in) throws java.io.IOException
readFields
in interface org.apache.hadoop.io.Writable
java.io.IOException
public void setValue(T value)
protected abstract void specificRead(java.io.DataInput in) throws java.io.IOException
in
- java.io.IOException
protected abstract void specificWrite(java.io.DataOutput out) throws java.io.IOException
out
- java.io.IOException
public void write(java.io.DataOutput out) throws java.io.IOException
write
in interface org.apache.hadoop.io.Writable
java.io.IOException