Class ClientConnectivityLogger

java.lang.Object
com.hazelcast.client.util.ClientConnectivityLogger

@NotThreadSafe public class ClientConnectivityLogger extends Object
Logs the connectivity of the client to the cluster.

A task will log the connectivity of the client with a delay of ClientProperty.CLIENT_CONNECTIVITY_LOGGING_DELAY_SECONDS seconds. If a logging task is already submitted, then the current caller will cancel the task and resubmit.

The logger will log the connectivity of the client to the cluster in the following format:

 Client Connectivity [4] {
     Member [127.0.0.1]:5701 - 676956a0-0b86-4097-a1e1-42b01b0a664c - disconnected
     Member [127.0.0.1]:5702 - c1a6449f-432f-45ba-9570-52b8ec90ce89 - disconnected
     Member [127.0.0.1]:5703 - 76463a61-0c4b-4180-8970-56b14b156f4c - connected
     Member [127.0.0.1]:5704 - 7a172832-8734-4eef-80a9-656bf1e28c2a - connected
 }
 
  • Constructor Details

    • ClientConnectivityLogger

      public ClientConnectivityLogger(LoggingService loggingService, com.hazelcast.spi.impl.executionservice.TaskScheduler executor, HazelcastProperties properties)
      Constructs a new ClientConnectivityLogger.
      Parameters:
      loggingService - the logging service.
      executor - the scheduled executor this class will use to run logging tasks.
      properties - the hazelcast properties, providing the logPeriodSeconds.
  • Method Details

    • submitLoggingTask

      public void submitLoggingTask(Collection<Member> connectedMembers, Collection<Member> allMembers)
      Submits a logging task to the executor that logs the connectivity of the client to the cluster. The task will log the connectivity of the client with a delay of logPeriodSeconds seconds. If a logging task is already submitted, then the current caller will cancel the task and resubmit.

      Called from TcpClientConnectionManager under mutex.

      Parameters:
      connectedMembers - the list of members the client is connected to.
      allMembers - the list of all members the client has knowledge of, including those with no active connection.
    • terminate

      public void terminate()
      Terminates a submitted logging task.