|
||||||||||
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
Field Summary | |
---|---|
static MessagingService |
instance
|
static int |
PROTOCOL_MAGIC
we preface every message with this number so the recipient can validate the sender is sane |
Constructor Summary | |
---|---|
protected |
MessagingService()
|
Method Summary | |
---|---|
void |
addLatency(java.net.InetAddress address,
double latency)
|
java.lang.Object |
clone()
|
static java.nio.ByteBuffer |
constructStreamHeader(boolean compress)
|
void |
convict(java.net.InetAddress ep)
called by failure detection code to notify that housekeeping should be performed on downed sockets. |
static int |
getBits(int x,
int p,
int n)
|
static OutboundTcpConnection |
getConnection(java.net.InetAddress to,
Message msg)
|
static org.apache.cassandra.net.OutboundTcpConnectionPool |
getConnectionPool(java.net.InetAddress to)
|
static long |
getRegisteredCallbackAge(java.lang.String messageId)
|
IVerbHandler |
getVerbHandler(StorageService.Verb type)
This method returns the verb handler associated with the registered verb. |
byte[] |
hash(java.lang.String type,
byte[] data)
|
static int |
incrementDroppedMessages(StorageService.Verb verb)
|
void |
listen(java.net.InetAddress localEp)
Listen on the specified port. |
void |
maybeAddLatency(IMessageCallback cb,
java.net.InetAddress address,
double latency)
Track latency information for the dynamic snitch |
static java.nio.ByteBuffer |
packIt(byte[] bytes,
boolean compress)
|
static void |
receive(Message message)
|
void |
register(ILatencySubscriber subcriber)
|
void |
registerVerbHandlers(StorageService.Verb verb,
IVerbHandler verbHandler)
Register a verb and the corresponding verb handler with the Messaging Service. |
static Pair<java.net.InetAddress,IMessageCallback> |
removeRegisteredCallback(java.lang.String messageId)
|
void |
sendOneWay(Message message,
java.net.InetAddress to)
Send a message to a given endpoint. |
IAsyncResult |
sendRR(Message message,
java.net.InetAddress to)
|
java.lang.String |
sendRR(Message message,
java.net.InetAddress to,
IAsyncCallback cb)
Send a message to a given endpoint. |
static void |
shutdown()
|
void |
stream(java.lang.String file,
long startPosition,
long endPosition,
java.net.InetAddress from,
java.net.InetAddress to)
Stream a file from source to destination. |
static void |
validateMagic(int magic)
|
static void |
waitFor()
blocks until the processing pools are empty and done. |
void |
waitUntilListening()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PROTOCOL_MAGIC
public static final MessagingService instance
Constructor Detail |
---|
protected MessagingService()
Method Detail |
---|
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public void maybeAddLatency(IMessageCallback cb, java.net.InetAddress address, double latency)
cb:
- the callback associated with this message -- this lets us know if it's a message type we're interested inaddress:
- the host that replied to the messagelatency
- public void addLatency(java.net.InetAddress address, double latency)
public byte[] hash(java.lang.String type, byte[] data)
public void convict(java.net.InetAddress ep)
public void listen(java.net.InetAddress localEp) throws java.io.IOException
localEp
- InetAddress whose port to listen on.
java.io.IOException
public void waitUntilListening()
public static org.apache.cassandra.net.OutboundTcpConnectionPool getConnectionPool(java.net.InetAddress to)
public static OutboundTcpConnection getConnection(java.net.InetAddress to, Message msg)
public void registerVerbHandlers(StorageService.Verb verb, IVerbHandler verbHandler)
verb
- verbHandler
- handler for the specified verbpublic IVerbHandler getVerbHandler(StorageService.Verb type)
type
- for which the verb handler is sought
public java.lang.String sendRR(Message message, java.net.InetAddress to, IAsyncCallback cb)
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 occurred to the invoker of the send().
suggest that a timeout occurred to the invoker of the send().
public void sendOneWay(Message message, java.net.InetAddress to)
message
- messages to be sent.to
- endpoint to which the message needs to be sentpublic IAsyncResult sendRR(Message message, java.net.InetAddress to)
public void stream(java.lang.String file, long startPosition, long endPosition, java.net.InetAddress from, java.net.InetAddress to)
file
- name of file to stream.startPosition
- position inside the fileendPosition
- to
- endpoint to which we need to stream the file.public void register(ILatencySubscriber subcriber)
public static void waitFor() throws java.lang.InterruptedException
java.lang.InterruptedException
public static void shutdown()
public static void receive(Message message)
public static Pair<java.net.InetAddress,IMessageCallback> removeRegisteredCallback(java.lang.String messageId)
public static long getRegisteredCallbackAge(java.lang.String messageId)
public static void validateMagic(int magic) throws java.io.IOException
java.io.IOException
public static int getBits(int x, int p, int n)
public static java.nio.ByteBuffer packIt(byte[] bytes, boolean compress)
public static java.nio.ByteBuffer constructStreamHeader(boolean compress)
public static int incrementDroppedMessages(StorageService.Verb verb)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |