Spring for Apache Hadoop

org.springframework.yarn.integration.ip.mind
Class MindRpcMessageHolder

java.lang.Object
  extended by org.springframework.yarn.integration.ip.mind.MindRpcMessageHolder

public class MindRpcMessageHolder
extends java.lang.Object

Mind request and response contains a set of headers and a content. This is similar to http traffict. This holder keeps those separated and makes it easier to work with payloads.

Author:
Janne Valkealahti

Constructor Summary
MindRpcMessageHolder(java.util.Map<java.lang.String,java.lang.String> headers, byte[] content)
          Constructs holder instance with a map of headers and a content.
MindRpcMessageHolder(java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String content)
          Constructs holder instance with a map of headers and a content.
 
Method Summary
 byte[] getContent()
          Gets the content of this holder.
 java.util.Map<java.lang.String,java.lang.String> getHeaders()
          Gets headers of this holder.
 void setContent(byte[] content)
          Sets the content of this holder.
 void setContent(java.lang.String content)
          Sets the content of this holder.
 void setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
          Sets the headers of this holder.
 byte[] toBytes()
          Gets the complete protocol representation of this holder as array of bytes.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MindRpcMessageHolder

public MindRpcMessageHolder(java.util.Map<java.lang.String,java.lang.String> headers,
                            java.lang.String content)
Constructs holder instance with a map of headers and a content.

Parameters:
headers - the headers
content - the content

MindRpcMessageHolder

public MindRpcMessageHolder(java.util.Map<java.lang.String,java.lang.String> headers,
                            byte[] content)
Constructs holder instance with a map of headers and a content.

Parameters:
headers - the headers
content - the content
Method Detail

setHeaders

public void setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Sets the headers of this holder. Overrides any previous headers.

Parameters:
headers - the headers

setContent

public void setContent(byte[] content)
Sets the content of this holder.

Parameters:
content - the content

setContent

public void setContent(java.lang.String content)
Sets the content of this holder.

Parameters:
content - the content

getHeaders

public java.util.Map<java.lang.String,java.lang.String> getHeaders()
Gets headers of this holder.

Returns:
the map of headers

getContent

public byte[] getContent()
Gets the content of this holder.

Returns:
content of this holder.

toBytes

public byte[] toBytes()
Gets the complete protocol representation of this holder as array of bytes. This array is then send over the channel.

Returns:
byte array of protocol message

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Spring for Apache Hadoop