public final class MessagingService extends java.lang.Object implements MessagingServiceMBean
Modifier and Type | Class and Description |
---|---|
static class |
MessagingService.Verb |
Modifier and Type | Field and Description |
---|---|
static java.util.EnumMap<MessagingService.Verb,IVersionedSerializer<?>> |
callbackDeserializers
A Map of what kind of serializer to wire up to a REQUEST_RESPONSE callback, based on outbound Verb.
|
static int |
current_version |
static java.util.EnumSet<MessagingService.Verb> |
DROPPABLE_VERBS
Verbs it's okay to drop if the request has been queued longer than the request timeout.
|
static java.lang.String |
FAILURE_CALLBACK_PARAM |
static java.lang.String |
FAILURE_RESPONSE_PARAM |
static java.lang.String |
MBEAN_NAME |
static byte[] |
ONE_BYTE |
static int |
PROTOCOL_MAGIC
we preface every message with this number so the recipient can validate the sender is sane
|
static java.util.EnumMap<MessagingService.Verb,IVersionedSerializer<?>> |
verbSerializers
Messages we receive in IncomingTcpConnection have a Verb that tells us what kind of message it is.
|
static java.util.EnumMap<MessagingService.Verb,Stage> |
verbStages |
static int |
VERSION_12 |
static int |
VERSION_20 |
static int |
VERSION_21 |
Modifier and Type | Method and Description |
---|---|
int |
addCallback(IAsyncCallback cb,
MessageOut<? extends IMutation> message,
java.net.InetAddress to,
long timeout,
ConsistencyLevel consistencyLevel,
boolean allowHints) |
int |
addCallback(IAsyncCallback cb,
MessageOut message,
java.net.InetAddress to,
long timeout,
boolean failureCallback) |
void |
addLatency(java.net.InetAddress address,
long latency) |
boolean |
areAllNodesAtLeast21() |
void |
clearCallbacksUnsafe() |
void |
convict(java.net.InetAddress ep)
called from gossiper when it notices a node is not responding.
|
void |
destroyConnectionPool(java.net.InetAddress to) |
static int |
getBits(int packed,
int start,
int count) |
java.util.Map<java.lang.String,java.lang.Long> |
getCommandCompletedTasks()
Completed tasks for Command(Mutations, Read etc) TCP Connections
|
java.util.Map<java.lang.String,java.lang.Long> |
getCommandDroppedTasks()
Dropped tasks for Command(Mutations, Read etc) TCP Connections
|
java.util.Map<java.lang.String,java.lang.Integer> |
getCommandPendingTasks()
Pending tasks for Command(Mutations, Read etc) TCP Connections
|
int |
getCommandPendingTasks(java.net.InetAddress address) |
OutboundTcpConnection |
getConnection(java.net.InetAddress to,
MessageOut msg) |
OutboundTcpConnectionPool |
getConnectionPool(java.net.InetAddress to) |
java.util.Map<java.lang.String,java.lang.Integer> |
getDroppedMessages()
dropped message counts for server lifetime
|
int |
getRawVersion(java.net.InetAddress endpoint) |
java.util.Map<java.lang.String,java.lang.Integer> |
getRecentlyDroppedMessages()
dropped message counts since last called
|
java.util.Map<java.lang.String,java.lang.Long> |
getRecentTimeoutsPerHost()
Number of timeouts since last check per host.
|
long |
getRecentTotalTimouts()
Number of timeouts since last check.
|
CallbackInfo |
getRegisteredCallback(int messageId) |
long |
getRegisteredCallbackAge(int messageId) |
java.util.Map<java.lang.String,java.lang.Long> |
getResponseCompletedTasks()
Completed tasks for Response(GOSSIP & RESPONSE) TCP Connections
|
java.util.Map<java.lang.String,java.lang.Integer> |
getResponsePendingTasks()
Pending tasks for Response(GOSSIP & RESPONSE) TCP Connections
|
java.util.Map<java.lang.String,java.lang.Long> |
getTimeoutsPerHost()
Number of timeouts per host
|
long |
getTotalTimeouts()
Total number of timeouts happened on this node
|
IVerbHandler |
getVerbHandler(MessagingService.Verb type)
This method returns the verb handler associated with the registered
verb.
|
int |
getVersion(java.net.InetAddress endpoint) |
int |
getVersion(java.lang.String endpoint) |
void |
incrementDroppedMessages(MessagingService.Verb verb) |
static MessagingService |
instance() |
boolean |
isListening() |
boolean |
knowsVersion(java.net.InetAddress endpoint) |
void |
listen(java.net.InetAddress localEp)
Listen on the specified port.
|
void |
maybeAddLatency(IAsyncCallback cb,
java.net.InetAddress address,
long latency)
Track latency information for the dynamic snitch
|
void |
receive(MessageIn message,
int id,
long timestamp) |
void |
register(ILatencySubscriber subcriber) |
void |
registerVerbHandlers(MessagingService.Verb verb,
IVerbHandler verbHandler)
Register a verb and the corresponding verb handler with the
Messaging Service.
|
CallbackInfo |
removeRegisteredCallback(int messageId) |
void |
resetVersion(java.net.InetAddress endpoint) |
void |
sendOneWay(MessageOut message,
java.net.InetAddress to) |
void |
sendOneWay(MessageOut message,
int id,
java.net.InetAddress to)
Send a message to a given endpoint.
|
void |
sendReply(MessageOut message,
int id,
java.net.InetAddress to) |
int |
sendRR(MessageOut<? extends IMutation> message,
java.net.InetAddress to,
AbstractWriteResponseHandler handler,
boolean allowHints)
Send a mutation message to a given endpoint.
|
<T> AsyncOneResponse<T> |
sendRR(MessageOut message,
java.net.InetAddress to) |
int |
sendRR(MessageOut message,
java.net.InetAddress to,
IAsyncCallback cb) |
int |
sendRR(MessageOut message,
java.net.InetAddress to,
IAsyncCallback cb,
long timeout,
boolean failureCallback)
Send a non-mutation message to a given endpoint.
|
int |
sendRRWithFailure(MessageOut message,
java.net.InetAddress to,
IAsyncCallbackWithFailure cb) |
void |
setCallbackForTests(int messageId,
CallbackInfo callback) |
int |
setVersion(java.net.InetAddress endpoint,
int version) |
void |
shutdown()
Wait for callbacks and don't allow any more to be created (since they could require writing hints)
|
static void |
validateMagic(int magic) |
void |
waitUntilListening() |
public static final java.lang.String MBEAN_NAME
public static final int VERSION_12
public static final int VERSION_20
public static final int VERSION_21
public static final int current_version
public static final java.lang.String FAILURE_CALLBACK_PARAM
public static final byte[] ONE_BYTE
public static final java.lang.String FAILURE_RESPONSE_PARAM
public static final int PROTOCOL_MAGIC
public static final java.util.EnumMap<MessagingService.Verb,Stage> verbStages
public static final java.util.EnumMap<MessagingService.Verb,IVersionedSerializer<?>> verbSerializers
public static final java.util.EnumMap<MessagingService.Verb,IVersionedSerializer<?>> callbackDeserializers
public static final java.util.EnumSet<MessagingService.Verb> DROPPABLE_VERBS
public static MessagingService instance()
public void maybeAddLatency(IAsyncCallback cb, java.net.InetAddress address, long 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, long latency)
public void convict(java.net.InetAddress ep)
public void listen(java.net.InetAddress localEp) throws ConfigurationException
localEp
- InetAddress whose port to listen on.ConfigurationException
public void waitUntilListening()
public boolean isListening()
public void destroyConnectionPool(java.net.InetAddress to)
public OutboundTcpConnectionPool getConnectionPool(java.net.InetAddress to)
public OutboundTcpConnection getConnection(java.net.InetAddress to, MessageOut msg)
public void registerVerbHandlers(MessagingService.Verb verb, IVerbHandler verbHandler)
verb
- verbHandler
- handler for the specified verbpublic IVerbHandler getVerbHandler(MessagingService.Verb type)
type
- for which the verb handler is soughtpublic int addCallback(IAsyncCallback cb, MessageOut message, java.net.InetAddress to, long timeout, boolean failureCallback)
public int addCallback(IAsyncCallback cb, MessageOut<? extends IMutation> message, java.net.InetAddress to, long timeout, ConsistencyLevel consistencyLevel, boolean allowHints)
public int sendRR(MessageOut message, java.net.InetAddress to, IAsyncCallback cb)
public int sendRRWithFailure(MessageOut message, java.net.InetAddress to, IAsyncCallbackWithFailure cb)
public int sendRR(MessageOut message, java.net.InetAddress to, IAsyncCallback cb, long timeout, boolean failureCallback)
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().timeout
- the timeout used for expirationpublic int sendRR(MessageOut<? extends IMutation> message, java.net.InetAddress to, AbstractWriteResponseHandler handler, boolean allowHints)
message
- message to be sent.to
- endpoint to which the message needs to be senthandler
- callback interface which is used to pass the responses or
suggest that a timeout occurred to the invoker of the send().public void sendOneWay(MessageOut message, java.net.InetAddress to)
public void sendReply(MessageOut message, int id, java.net.InetAddress to)
public void sendOneWay(MessageOut message, int id, java.net.InetAddress to)
message
- messages to be sent.to
- endpoint to which the message needs to be sentpublic <T> AsyncOneResponse<T> sendRR(MessageOut message, java.net.InetAddress to)
public void register(ILatencySubscriber subcriber)
public void clearCallbacksUnsafe()
public void shutdown()
public void receive(MessageIn message, int id, long timestamp)
public void setCallbackForTests(int messageId, CallbackInfo callback)
public CallbackInfo getRegisteredCallback(int messageId)
public CallbackInfo removeRegisteredCallback(int messageId)
public long getRegisteredCallbackAge(int messageId)
public static void validateMagic(int magic) throws java.io.IOException
java.io.IOException
public static int getBits(int packed, int start, int count)
public boolean areAllNodesAtLeast21()
public int setVersion(java.net.InetAddress endpoint, int version)
public void resetVersion(java.net.InetAddress endpoint)
public int getVersion(java.net.InetAddress endpoint)
public int getVersion(java.lang.String endpoint) throws java.net.UnknownHostException
getVersion
in interface MessagingServiceMBean
java.net.UnknownHostException
public int getRawVersion(java.net.InetAddress endpoint)
public boolean knowsVersion(java.net.InetAddress endpoint)
public void incrementDroppedMessages(MessagingService.Verb verb)
public java.util.Map<java.lang.String,java.lang.Integer> getCommandPendingTasks()
MessagingServiceMBean
getCommandPendingTasks
in interface MessagingServiceMBean
public int getCommandPendingTasks(java.net.InetAddress address)
public java.util.Map<java.lang.String,java.lang.Long> getCommandCompletedTasks()
MessagingServiceMBean
getCommandCompletedTasks
in interface MessagingServiceMBean
public java.util.Map<java.lang.String,java.lang.Long> getCommandDroppedTasks()
MessagingServiceMBean
getCommandDroppedTasks
in interface MessagingServiceMBean
public java.util.Map<java.lang.String,java.lang.Integer> getResponsePendingTasks()
MessagingServiceMBean
getResponsePendingTasks
in interface MessagingServiceMBean
public java.util.Map<java.lang.String,java.lang.Long> getResponseCompletedTasks()
MessagingServiceMBean
getResponseCompletedTasks
in interface MessagingServiceMBean
public java.util.Map<java.lang.String,java.lang.Integer> getDroppedMessages()
MessagingServiceMBean
getDroppedMessages
in interface MessagingServiceMBean
public java.util.Map<java.lang.String,java.lang.Integer> getRecentlyDroppedMessages()
MessagingServiceMBean
getRecentlyDroppedMessages
in interface MessagingServiceMBean
public long getTotalTimeouts()
MessagingServiceMBean
getTotalTimeouts
in interface MessagingServiceMBean
public long getRecentTotalTimouts()
MessagingServiceMBean
getRecentTotalTimouts
in interface MessagingServiceMBean
public java.util.Map<java.lang.String,java.lang.Long> getTimeoutsPerHost()
MessagingServiceMBean
getTimeoutsPerHost
in interface MessagingServiceMBean
public java.util.Map<java.lang.String,java.lang.Long> getRecentTimeoutsPerHost()
MessagingServiceMBean
getRecentTimeoutsPerHost
in interface MessagingServiceMBean
Copyright © 2014 The Apache Software Foundation