Class AsynchronousTlsChannelGroup

java.lang.Object
tlschannel.async.AsynchronousTlsChannelGroup

public class AsynchronousTlsChannelGroup
extends java.lang.Object
This class encapsulates the infrastructure for running AsynchronousTlsChannels. Each instance of this class is a singleton-like object that manages a thread pool that makes it possible to run a group of asynchronous channels.
  • Constructor Summary

    Constructors 
    Constructor Description
    AsynchronousTlsChannelGroup()
    Creates an instance of this class, using as many thread as available processors.
    AsynchronousTlsChannelGroup​(int nThreads)
    Creates an instance of this class.
  • Method Summary

    Modifier and Type Method Description
    boolean awaitTermination​(long timeout, java.util.concurrent.TimeUnit unit)
    Blocks until all registers sockets are closed and pending tasks finished execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
    long getCancelledReadCount()
    Return the total number of read operations that were cancelled.
    long getCancelledWriteCount()
    Return the total number of write operations that were cancelled.
    long getCurrentReadCount()
    Returns the current number of active read operations.
    long getCurrentRegistrationCount()
    Returns the current number of registered sockets.
    long getCurrentWriteCount()
    Returns the current number of active write operations.
    long getFailedReadCount()
    Return the total number of read operations that failed.
    long getFailedWriteCount()
    Return the total number of write operations that failed.
    long getStartedReadCount()
    Return the total number of read operations that were started.
    long getStartedWriteCount()
    Return the total number of write operations that were started.
    long getSuccessfulReadCount()
    Return the total number of read operations that succeeded.
    long getSuccessfulWriteCount()
    Return the total number of write operations that succeeded.
    boolean isShutdown()
    Whether either shutdown() or shutdownNow() have been called.
    boolean isTerminated()
    Whether this channel group was shut down, and all pending tasks have drained.
    void shutdown()
    Starts the shutdown process.
    void shutdownNow()
    Shuts down this channel group immediately.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AsynchronousTlsChannelGroup

      public AsynchronousTlsChannelGroup​(int nThreads)
      Creates an instance of this class.
      Parameters:
      nThreads - number of threads in the executor used to assist the selector loop and run completion handlers.
    • AsynchronousTlsChannelGroup

      public AsynchronousTlsChannelGroup()
      Creates an instance of this class, using as many thread as available processors.
  • Method Details

    • isShutdown

      public boolean isShutdown()
      Whether either shutdown() or shutdownNow() have been called.
      Returns:
      true if this group has initiated shutdown and false if the group is active
    • shutdown

      public void shutdown()
      Starts the shutdown process. New sockets cannot be registered, already registered one continue operating normally until they are closed.
    • shutdownNow

      public void shutdownNow()
      Shuts down this channel group immediately. All registered sockets are closed, pending operations may or may not finish.
    • isTerminated

      public boolean isTerminated()
      Whether this channel group was shut down, and all pending tasks have drained.
      Returns:
      whether the channel is terminated
    • awaitTermination

      public boolean awaitTermination​(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
      Blocks until all registers sockets are closed and pending tasks finished execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
      Parameters:
      timeout - the maximum time to wait
      unit - the time unit of the timeout argument
      Returns:
      true if this group terminated and false if the group elapsed before termination
      Throws:
      java.lang.InterruptedException - if interrupted while waiting
    • getStartedReadCount

      public long getStartedReadCount()
      Return the total number of read operations that were started.
      Returns:
      number of operations
    • getStartedWriteCount

      public long getStartedWriteCount()
      Return the total number of write operations that were started.
      Returns:
      number of operations
    • getSuccessfulReadCount

      public long getSuccessfulReadCount()
      Return the total number of read operations that succeeded.
      Returns:
      number of operations
    • getSuccessfulWriteCount

      public long getSuccessfulWriteCount()
      Return the total number of write operations that succeeded.
      Returns:
      number of operations
    • getFailedReadCount

      public long getFailedReadCount()
      Return the total number of read operations that failed.
      Returns:
      number of operations
    • getFailedWriteCount

      public long getFailedWriteCount()
      Return the total number of write operations that failed.
      Returns:
      number of operations
    • getCancelledReadCount

      public long getCancelledReadCount()
      Return the total number of read operations that were cancelled.
      Returns:
      number of operations
    • getCancelledWriteCount

      public long getCancelledWriteCount()
      Return the total number of write operations that were cancelled.
      Returns:
      number of operations
    • getCurrentReadCount

      public long getCurrentReadCount()
      Returns the current number of active read operations.
      Returns:
      number of operations
    • getCurrentWriteCount

      public long getCurrentWriteCount()
      Returns the current number of active write operations.
      Returns:
      number of operations
    • getCurrentRegistrationCount

      public long getCurrentRegistrationCount()
      Returns the current number of registered sockets.
      Returns:
      number of sockets