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.CountDownLatch
connected
static java.lang.String
DEFAULT_REQUEST_QUEUE
static java.lang.String
DEFAULT_RESPONSE_QUEUE
protected java.nio.ByteBuffer
headerBuffer
private static org.slf4j.Logger
LOG
protected Message
message
protected java.util.concurrent.CountDownLatch
subscribed
protected 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, PEER_CERTIFICATE_EMPTY_LIST, 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 void
clean()
Cleans internal state.java.util.concurrent.Future<java.lang.Void>
close()
protected void
emitOnMessageReceived(Message message)
java.lang.String
getEventQueue()
private Message
getMessage(java.nio.ByteBuffer buffer, int read)
java.lang.String
getRequestQueue()
java.lang.String
getResponseQueue()
private void
logMessageInTrace(byte[] message)
protected void
processIncoming()
Process incoming channel.(package private) void
processMessage(Message message)
void
send(byte[] message)
protected void
sendHeartbeat()
Client sends protocol specific heartbeat messagevoid
sendNow(byte[] message)
private void
updateOps()
void
updatePolicyWithHeartbeat(java.lang.String heartbeat, boolean client)
void
validate(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:
close
in classReactorClient
-
processIncoming
protected void processIncoming() throws java.io.IOException, ClientConnectionException
Description copied from class:ReactorClient
Process incoming channel.- Specified by:
processIncoming
in 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:ReactorClient
Cleans internal state.- Specified by:
clean
in classReactorClient
-
emitOnMessageReceived
protected void emitOnMessageReceived(Message message)
-
buildNetworkResponse
protected byte[] buildNetworkResponse(java.lang.String reason)
Description copied from class:ReactorClient
Builds network issue message for specific protocol.- Specified by:
buildNetworkResponse
in 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:ReactorClient
Client sends protocol specific heartbeat message- Specified by:
sendHeartbeat
in classReactorClient
-
validate
public void validate(ClientPolicy policy)
Description copied from class:ReactorClient
Validates policy when it is set.- Specified by:
validate
in classReactorClient
- Parameters:
policy
- - validated policy
-
getRequestQueue
public java.lang.String getRequestQueue()
-
getResponseQueue
public java.lang.String getResponseQueue()
-
getEventQueue
public java.lang.String getEventQueue()
-
-