Package org.hobbit.core.components.utils
Class SystemResourceUsageRequester
java.lang.Object
org.hobbit.core.components.utils.SystemResourceUsageRequester
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.rabbitmq.client.ChannelChannel that is used for the command queue but not owned by this class (i.e., it won't be closed).protected com.google.gson.Gsonprotected com.rabbitmq.client.Channelprivate static final org.slf4j.Loggerprivate QueueingConsumerConsumer of the queue that is used to receive responses for messages that are sent via the command queue and for which an answer is expected.private StringName of the queue that is used to receive responses for messages that are sent via the command queue and for which an answer is expected.protected byte[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSystemResourceUsageRequester(com.rabbitmq.client.Channel cmdChannel, com.rabbitmq.client.Channel incomingChannel, String responseQueueName, QueueingConsumer responseConsumer, String sessionId) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static SystemResourceUsageRequestercreate(PlatformConnector connector, String sessionId) protected voidsendToCmdQueue(byte command, byte[] data, com.rabbitmq.client.AMQP.BasicProperties props) Sends the given command to the command queue with the given data appended and using the given properties.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
responseConsumer
Consumer of the queue that is used to receive responses for messages that are sent via the command queue and for which an answer is expected. -
responseQueueName
Name of the queue that is used to receive responses for messages that are sent via the command queue and for which an answer is expected. -
cmdChannel
protected com.rabbitmq.client.Channel cmdChannelChannel that is used for the command queue but not owned by this class (i.e., it won't be closed). -
incomingChannel
protected com.rabbitmq.client.Channel incomingChannel -
sessionIdBytes
protected byte[] sessionIdBytes -
gson
protected com.google.gson.Gson gson
-
-
Constructor Details
-
SystemResourceUsageRequester
protected SystemResourceUsageRequester(com.rabbitmq.client.Channel cmdChannel, com.rabbitmq.client.Channel incomingChannel, String responseQueueName, QueueingConsumer responseConsumer, String sessionId)
-
-
Method Details
-
create
-
getSystemResourceUsage
-
sendToCmdQueue
protected void sendToCmdQueue(byte command, byte[] data, com.rabbitmq.client.AMQP.BasicProperties props) throws IOException Sends the given command to the command queue with the given data appended and using the given properties.- Parameters:
command- the command that should be sentdata- data that should be appended to the commandprops- properties that should be used for the message- Throws:
IOException- if a communication problem occurs
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-