Class StompCommonClient
- java.lang.Object
-
- org.ovirt.vdsm.jsonrpc.client.reactors.ReactorClient
-
- org.ovirt.vdsm.jsonrpc.client.reactors.stomp.StompCommonClient
-
- Direct Known Subclasses:
PlainClient,SSLClient
public abstract class StompCommonClient extends ReactorClient
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ovirt.vdsm.jsonrpc.client.reactors.ReactorClient
ReactorClient.MessageListener
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.CountDownLatchconnectedstatic java.lang.StringDEFAULT_REQUEST_QUEUEstatic java.lang.StringDEFAULT_RESPONSE_QUEUEprotected java.nio.ByteBufferheaderBufferprivate static org.slf4j.LoggerLOGprotected Messagemessageprotected java.util.concurrent.CountDownLatchsubscribedprotected java.util.List<java.lang.String>subscriptionIds-
Fields inherited from class org.ovirt.vdsm.jsonrpc.client.reactors.ReactorClient
BUFFER_SIZE, channel, CLIENT_CLOSED, eventListeners, half, ibuff, key, outbox, policy, reactor
-
-
Constructor Summary
Constructors Constructor Description StompCommonClient(Reactor reactor, java.lang.String hostname, int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]buildNetworkResponse(java.lang.String reason)Builds network issue message for specific protocol.protected voidclean()Cleans internal state.java.util.concurrent.Future<java.lang.Void>close()protected voidemitOnMessageReceived(Message message)java.lang.StringgetEventQueue()private MessagegetMessage(java.nio.ByteBuffer buffer, int read)java.lang.StringgetRequestQueue()java.lang.StringgetResponseQueue()private voidlogMessageInTrace(byte[] message)protected voidprocessIncoming()Process incoming channel.(package private) voidprocessMessage(Message message)voidsend(byte[] message)protected voidsendHeartbeat()Client sends protocol specific heartbeat messagevoidsendNow(byte[] message)private voidupdateOps()voidupdatePolicyWithHeartbeat(java.lang.String heartbeat, boolean client)voidvalidate(ClientPolicy policy)Validates policy when it is set.-
Methods inherited from class org.ovirt.vdsm.jsonrpc.client.reactors.ReactorClient
addEventListener, closeChannel, connect, disconnect, emitOnMessageReceived, getClientId, getConnectionId, getHostname, getPeerCertificates, getPostConnectCallback, getRetryPolicy, getSelectionKey, isInInit, isOpen, now, performAction, postConnect, postDisconnect, process, processOutgoing, read, removeEventListener, scheduleTask, sendMessage, setClientPolicy, updateInterestedOps, updateLastIncomingHeartbeat, updateLastOutgoingHeartbeat, write
-
-
-
-
Field Detail
-
DEFAULT_REQUEST_QUEUE
public static final java.lang.String DEFAULT_REQUEST_QUEUE
- See Also:
- Constant Field Values
-
DEFAULT_RESPONSE_QUEUE
public static final java.lang.String DEFAULT_RESPONSE_QUEUE
- See Also:
- Constant Field Values
-
headerBuffer
protected java.nio.ByteBuffer headerBuffer
-
message
protected Message message
-
connected
protected java.util.concurrent.CountDownLatch connected
-
subscribed
protected java.util.concurrent.CountDownLatch subscribed
-
subscriptionIds
protected java.util.List<java.lang.String> subscriptionIds
-
LOG
private static final org.slf4j.Logger LOG
-
-
Constructor Detail
-
StompCommonClient
public StompCommonClient(Reactor reactor, java.lang.String hostname, int port)
-
-
Method Detail
-
send
public void send(byte[] message)
-
logMessageInTrace
private void logMessageInTrace(byte[] message)
-
updateOps
private void updateOps()
-
sendNow
public void sendNow(byte[] message)
-
processMessage
void processMessage(Message message)
-
close
public java.util.concurrent.Future<java.lang.Void> close()
- Overrides:
closein classReactorClient
-
processIncoming
protected void processIncoming() throws java.io.IOException, ClientConnectionExceptionDescription copied from class:ReactorClientProcess incoming channel.- Specified by:
processIncomingin classReactorClient- Throws:
java.io.IOException- Thrown when reading issue occurred.ClientConnectionException- Thrown when issues with connection.
-
getMessage
private Message getMessage(java.nio.ByteBuffer buffer, int read) throws ClientConnectionException
- Throws:
ClientConnectionException
-
clean
protected void clean()
Description copied from class:ReactorClientCleans internal state.- Specified by:
cleanin classReactorClient
-
emitOnMessageReceived
protected void emitOnMessageReceived(Message message)
-
buildNetworkResponse
protected byte[] buildNetworkResponse(java.lang.String reason)
Description copied from class:ReactorClientBuilds network issue message for specific protocol.- Specified by:
buildNetworkResponsein classReactorClient- Parameters:
reason- why we want to build network response.- Returns:
- byte array containing response.
-
updatePolicyWithHeartbeat
public void updatePolicyWithHeartbeat(java.lang.String heartbeat, boolean client)
-
sendHeartbeat
protected void sendHeartbeat()
Description copied from class:ReactorClientClient sends protocol specific heartbeat message- Specified by:
sendHeartbeatin classReactorClient
-
validate
public void validate(ClientPolicy policy)
Description copied from class:ReactorClientValidates policy when it is set.- Specified by:
validatein classReactorClient- Parameters:
policy- - validated policy
-
getRequestQueue
public java.lang.String getRequestQueue()
-
getResponseQueue
public java.lang.String getResponseQueue()
-
getEventQueue
public java.lang.String getEventQueue()
-
-