Class SystemResourceUsageRequester

java.lang.Object
org.hobbit.core.components.utils.SystemResourceUsageRequester
All Implemented Interfaces:
Closeable, AutoCloseable

public class SystemResourceUsageRequester extends Object implements Closeable
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • responseConsumer

      private QueueingConsumer 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

      private String 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 cmdChannel
      Channel 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

      public static SystemResourceUsageRequester create(PlatformConnector connector, String sessionId)
    • getSystemResourceUsage

      public ResourceUsageInformation 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 sent
      data - data that should be appended to the command
      props - properties that should be used for the message
      Throws:
      IOException - if a communication problem occurs
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException