|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cassandra.net.MessagingService
public class MessagingService
Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
Field Summary | |
---|---|
static java.lang.String |
responseStage_
|
static java.lang.String |
responseVerbHandler_
|
Constructor Summary | |
---|---|
protected |
MessagingService()
|
Method Summary | |
---|---|
static int |
byteArrayToInt(byte[] bytes)
|
static int |
byteArrayToInt(byte[] bytes,
int offset)
|
static short |
byteArrayToShort(byte[] bytes)
|
static short |
byteArrayToShort(byte[] bytes,
int offset)
|
java.lang.Object |
clone()
|
static java.nio.ByteBuffer |
constructStreamHeader(boolean compress,
boolean stream)
|
static void |
debugOn(boolean on)
|
void |
deregisterAllVerbHandlers(EndPoint localEndPoint)
Deregister all verbhandlers corresponding to localEndPoint. |
void |
deregisterVerbHandlers(java.lang.String type)
Deregister a verbhandler corresponding to the verb from the Messaging Service. |
static IAsyncResult |
getAsyncResult(java.lang.String key)
|
static int |
getBits(int x,
int p,
int n)
|
static TcpConnection |
getConnection(EndPoint from,
EndPoint to)
|
static org.apache.cassandra.net.TcpConnectionManager |
getConnectionPool(EndPoint from,
EndPoint to)
|
static java.util.concurrent.ExecutorService |
getDeserilizationExecutor()
|
static IMessagingService |
getMessagingInstance()
|
static ConnectionStatistics[] |
getPoolStatistics()
|
static byte[] |
getProtocol()
|
static java.util.concurrent.ExecutorService |
getReadExecutor()
|
static IAsyncCallback |
getRegisteredCallback(java.lang.String key)
|
static SerializerType |
getSerializerType()
|
IVerbHandler |
getVerbHandler(java.lang.String type)
This method returns the verb handler associated with the registered verb. |
static int |
getVersion()
|
static java.util.concurrent.ExecutorService |
getWriteExecutor()
|
byte[] |
hash(java.lang.String type,
byte[] data)
|
static boolean |
isDebugOn()
|
static boolean |
isEqual(byte[] digestA,
byte[] digestB)
|
static boolean |
isLocalEndPoint(EndPoint ep)
|
static boolean |
isProtocolValid(byte[] protocol)
|
static boolean |
isStreaming()
|
void |
listen(EndPoint localEp,
boolean isHttp)
Listen on the specified port. |
void |
listenUDP(EndPoint localEp)
Listen on the specified port. |
static java.nio.ByteBuffer |
packIt(byte[] bytes,
boolean compress,
boolean stream,
boolean listening)
|
static void |
receive(Message message)
|
void |
registerVerbHandlers(java.lang.String type,
IVerbHandler verbHandler)
Register a verb and the corresponding verb handler with the Messaging Service. |
static void |
removeAsyncResult(java.lang.String key)
|
static void |
removeRegisteredCallback(java.lang.String key)
|
void |
sendOneWay(Message message,
EndPoint to)
Send a message to a given endpoint. |
java.lang.String |
sendRR(Message[][] messages,
EndPoint[][] to,
IAsyncCallback cb)
Send a message to a given endpoint. |
IAsyncResult |
sendRR(Message[] messages,
EndPoint[] to)
Send a message to a given endpoint. |
java.lang.String |
sendRR(Message[] messages,
EndPoint[] to,
IAsyncCallback cb)
Send a message to a given endpoint. |
IAsyncResult |
sendRR(Message message,
EndPoint to)
Send a message to a given endpoint. |
java.lang.String |
sendRR(Message message,
EndPoint[] to,
IAsyncCallback cb)
Send a message to the given set of endpoints and informs the MessagingService to wait for at least howManyResults responses to determine success
of failure. |
java.lang.String |
sendRR(Message message,
EndPoint to,
IAsyncCallback cb)
Send a message to a given endpoint. |
void |
sendUdpOneWay(Message message,
EndPoint to)
Send a message to a given endpoint. |
static void |
serializerType(java.lang.String type)
|
static void |
setStreamingMode(boolean bVal)
|
static void |
setVersion(int version)
|
static void |
shutdown()
|
void |
stream(java.lang.String file,
long startPosition,
long total,
EndPoint from,
EndPoint to)
Stream a file from source to destination. |
static byte[] |
toByteArray(int i)
|
static byte[] |
toByteArray(short s)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String responseVerbHandler_
public static final java.lang.String responseStage_
Constructor Detail |
---|
protected MessagingService()
Method Detail |
---|
public static boolean isDebugOn()
public static void debugOn(boolean on)
public static SerializerType getSerializerType()
public static void serializerType(java.lang.String type)
public static int getVersion()
public static void setVersion(int version)
public static IMessagingService getMessagingInstance()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public byte[] hash(java.lang.String type, byte[] data)
public void listen(EndPoint localEp, boolean isHttp) throws java.io.IOException
IMessagingService
listen
in interface IMessagingService
localEp
- EndPoint whose port to listen on.isHttp
- specify if the port is an Http port.
java.io.IOException
public void listenUDP(EndPoint localEp)
IMessagingService
listenUDP
in interface IMessagingService
localEp
- EndPoint whose port to listen on.public static org.apache.cassandra.net.TcpConnectionManager getConnectionPool(EndPoint from, EndPoint to)
public static ConnectionStatistics[] getPoolStatistics()
public static TcpConnection getConnection(EndPoint from, EndPoint to) throws java.io.IOException
java.io.IOException
public void registerVerbHandlers(java.lang.String type, IVerbHandler verbHandler)
IMessagingService
registerVerbHandlers
in interface IMessagingService
type
- name of the verb.verbHandler
- handler for the specified verbpublic void deregisterAllVerbHandlers(EndPoint localEndPoint)
IMessagingService
deregisterAllVerbHandlers
in interface IMessagingService
public void deregisterVerbHandlers(java.lang.String type)
IMessagingService
deregisterVerbHandlers
in interface IMessagingService
type
- name of the verb.public IVerbHandler getVerbHandler(java.lang.String type)
IMessagingService
getVerbHandler
in interface IMessagingService
type
- for which the verb handler is sought
public java.lang.String sendRR(Message message, EndPoint[] to, IAsyncCallback cb)
IMessagingService
howManyResults
responses to determine success
of failure.
sendRR
in interface IMessagingService
message
- message to be sent.to
- endpoints to which the message needs to be sentcb
- callback interface which is used to pass the responses
public java.lang.String sendRR(Message message, EndPoint to, IAsyncCallback cb)
IMessagingService
sendRR
in interface IMessagingService
message
- message to be sent.to
- endpoint to which the message needs to be sentcb
- callback interface which is used to pass the responses or
suggest that a timeout occured to the invoker of the send().
suggest that a timeout occured to the invoker of the send().
public java.lang.String sendRR(Message[] messages, EndPoint[] to, IAsyncCallback cb)
IMessagingService
messages
array is sent to the ith element in the to
array.This method assumes
there is a one-one mapping between the messages
array and
the to
array. Otherwise an IllegalArgumentException will be thrown.
This method also informs the MessagingService to wait for at least
howManyResults
responses to determine success of failure.
sendRR
in interface IMessagingService
messages
- messages to be sent.to
- endpoints to which the message needs to be sentcb
- callback interface which is used to pass the responses or
suggest that a timeout occured to the invoker of the send().
public IAsyncResult sendRR(Message[] messages, EndPoint[] to)
IMessagingService
messages
array is sent to the ith element in the to
array.This method assumes
there is a one-one mapping between the messages
array and
the to
array. Otherwise an IllegalArgumentException will be thrown.
This method also informs the MessagingService to wait for at least
howManyResults
responses to determine success of failure.
sendRR
in interface IMessagingService
messages
- messages to be sent.to
- endpoints to which the message needs to be sent
public java.lang.String sendRR(Message[][] messages, EndPoint[][] to, IAsyncCallback cb)
IMessagingService
messages
array is sent to the ith element in the to
array.This method assumes
there is a one-one mapping between the messages
array and
the to
array. Otherwise an IllegalArgumentException will be thrown.
The idea is that multi-groups of messages are grouped as one logical message
whose results are harnessed via the IAsyncResult
sendRR
in interface IMessagingService
messages
- groups of grouped messages.to
- destination for the groups of messagescb
- the callback handler to be invoked for the responses
public void sendOneWay(Message message, EndPoint to)
IMessagingService
sendOneWay
in interface IMessagingService
message
- messages to be sent.to
- endpoint to which the message needs to be sentpublic IAsyncResult sendRR(Message message, EndPoint to)
IMessagingService
sendRR
in interface IMessagingService
message
- message to be sent.to
- endpoint to which the message needs to be sent
public void sendUdpOneWay(Message message, EndPoint to)
IMessagingService
sendUdpOneWay
in interface IMessagingService
message
- messages to be sent.to
- endpoint to which the message needs to be sentpublic void stream(java.lang.String file, long startPosition, long total, EndPoint from, EndPoint to)
IMessagingService
stream
in interface IMessagingService
file
- name of file to stream.
param start position inside the file
param total number of bytes to stream
param to endpoint to which we need to stream the file.public static boolean isStreaming()
public static void setStreamingMode(boolean bVal)
public static void shutdown()
public static void receive(Message message)
public static boolean isLocalEndPoint(EndPoint ep)
public static IAsyncCallback getRegisteredCallback(java.lang.String key)
public static void removeRegisteredCallback(java.lang.String key)
public static IAsyncResult getAsyncResult(java.lang.String key)
public static void removeAsyncResult(java.lang.String key)
public static byte[] getProtocol()
public static java.util.concurrent.ExecutorService getReadExecutor()
public static java.util.concurrent.ExecutorService getWriteExecutor()
public static java.util.concurrent.ExecutorService getDeserilizationExecutor()
public static boolean isProtocolValid(byte[] protocol)
public static boolean isEqual(byte[] digestA, byte[] digestB)
public static byte[] toByteArray(int i)
public static byte[] toByteArray(short s)
public static short byteArrayToShort(byte[] bytes)
public static short byteArrayToShort(byte[] bytes, int offset)
public static int getBits(int x, int p, int n)
public static int byteArrayToInt(byte[] bytes)
public static int byteArrayToInt(byte[] bytes, int offset)
public static java.nio.ByteBuffer packIt(byte[] bytes, boolean compress, boolean stream, boolean listening)
public static java.nio.ByteBuffer constructStreamHeader(boolean compress, boolean stream)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |