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 |
MBEAN_NAME |
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 |
Modifier and Type | Method and Description |
---|---|
int |
addCallback(IAsyncCallback cb,
MessageOut message,
java.net.InetAddress to,
long timeout) |
void |
addLatency(java.net.InetAddress address,
long latency) |
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
|
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.
|
java.lang.Integer |
getVersion(java.net.InetAddress address) |
int |
getVersion(java.lang.String address) |
void |
incrementDroppedMessages(MessagingService.Verb verb) |
static MessagingService |
instance() |
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) |
<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)
Send a message to a given endpoint.
|
void |
setCallbackForTests(int messageId,
CallbackInfo callback) |
int |
setVersion(java.net.InetAddress address,
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 |
waitForStreaming() |
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 current_version
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 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)
public int sendRR(MessageOut message, java.net.InetAddress to, IAsyncCallback cb)
public int sendRR(MessageOut message, java.net.InetAddress to, IAsyncCallback cb, long timeout)
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().timeout
- the timeout used for expirationpublic 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 waitForStreaming() throws java.lang.InterruptedException
java.lang.InterruptedException
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 int setVersion(java.net.InetAddress address, int version)
public void resetVersion(java.net.InetAddress endpoint)
public java.lang.Integer getVersion(java.net.InetAddress address)
public int getVersion(java.lang.String address) throws java.net.UnknownHostException
getVersion
in interface MessagingServiceMBean
java.net.UnknownHostException
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 © 2013 The Apache Software Foundation