Interface ThreadPoolMBean


  • public interface ThreadPoolMBean
    Multiple ThreadPoolMBean instances exist in the system, where each one is related to one internal thread pool in use. Every thread pool used internally by Lightstreamer Server is bound to one ThreadPoolMBean instance. The thread pools and the corresponding ThreadPoolMBean instances are created only when needed and, in some cases, may be closed and replaced, but most of them are created at startup and last until the shutdown of the Server. Note that the Server supports optional pools, which, when configured, handle tasks on behalf of more general "parent" pools. Optional pools not configured don't exist, hence there are no ThreadPoolMBean instances for them. Remote JMX clients should not deregister ThreadPoolMBean instances.

    ThreadPoolMBean name pattern:
    "com.lightstreamer:type=ThreadPool,name=<ThreadPoolName>"

    The list of the names of the thread pools currently in use is provided by the "ThreadPools" property of the global LoadMBean.
    • Method Detail

      • getMaxThreads

        java.lang.Integer getMaxThreads()
        Returns:
        The maximum number of threads allowed for this pool. For most pools, this value can be configured. A zero value means a potentially unlimited pool.
      • getMaxFreeThreads

        java.lang.Integer getMaxFreeThreads()
        Returns:
        The maximum number of inactive threads allowed at any moment for this pool. For most non-cpu-bound pools, this value can be configured.
      • getMaxQueue

        java.lang.Long getMaxQueue()
        Returns:
        The maximum length of the task queue allowed for this pool, such that, if the maximum is reached, new client connections are refused by the Server. If -1, no limit is imposed. In case of an optional pool, it can also be null, to mean that the tasks for this pool are counted among the tasks of the parent pool.
      • getIsCpuBound

        java.lang.Boolean getIsCpuBound()
        Returns:
        true if the pool is devoted to cpu-bound tasks, which means tasks in which no blocking operations are expected in normal working conditions.
      • getCurrentThreads

        java.lang.Integer getCurrentThreads()
        Returns:
        The number of threads belonging to this thread pool; the number may vary in time, depending on the pool configuration.
      • getActiveThreads

        java.lang.Integer getActiveThreads()
        Returns:
        The total number of threads belonging to this thread pool which are currently executing a task.
      • getWaitingThreads

        java.lang.Integer getWaitingThreads()
        Returns:
        The total number of threads belonging to this thread pool which are currently unused and waiting for a new task to be enqueued.
      • getQueue

        java.lang.Integer getQueue()
        Returns:
        The length of the queue of the tasks currently waiting to be processed by this thread pool.
      • getAggregatedQueue

        java.lang.Long getAggregatedQueue()
        Returns:
        The length of the task queue currently considered for the check on the maximum queue length. It may consider optional pools whose count must fall into the count of this pool. The count is kept only if the "MaxQueue" property is set and it is not -1; otherwise null is returned.
      • getAvgQueueWaitMillis

        java.lang.Integer getAvgQueueWaitMillis()
        Returns:
        The average waiting time in milliseconds experienced by the tasks whose processing by this pool started in the last sampling period. A large or constantly increasing value may signal that the pool has all the available threads blocked.
      • getCurrQueueWaitMillis

        java.lang.Integer getCurrQueueWaitMillis()
        Returns:
        The waiting time cumulated by the first (hence oldest) task in the task queue of this thread pool. A large or constantly increasing value may signal that the pool has all the available threads blocked.
      • getThroughput

        java.lang.Double getThroughput()
        Returns:
        The rate of task execution by this thread pool in the last sampling period. Actually, this value may be approximated by using the number of tasks per second submitted to the pool in the same time frame. It is expressed as tasks per second; the value has a three decimal precision.
      • getAvgExecTimeMillis

        java.lang.Integer getAvgExecTimeMillis()
        Returns:
        The average execution time taken by the tasks executed on this thread pool, whose execution has terminated in the last sampling period. This statistics is significant for pools that are used to execute potentially blocking operations or heavy cpu-bound tasks; for any other pools the statistics is not measured and null is returned.
      • endThreadInspection

        void endThreadInspection()
        Disables the collections of usage statistics on the threads of this pool. See startThreadInspection() for details.
        Note that, by default, these statistics are initially disabled.
      • getAvgBlocksCount

        java.lang.Long getAvgBlocksCount()
        Returns:
        The number of times that the threads of this pool have been blocked on monitor entry in the last sampling period. The value is averaged among the various threads in the pool and normalized on a second. Note that such blocks can only occur during task execution, as idle threads are not in a blocked state.
        However, the returned value is null if this kind of inspection is not enabled or not supported; see startThreadInspection().
      • getAvgBlockedTime

        java.lang.Long getAvgBlockedTime()
        Returns:
        The time, in milliseconds, that the threads of this pool have spent blocked on monitor entry in the last sampling period. The value is averaged among the various threads in the pool and normalized on a second, so it should be between 0 and 1000. Note that such blocks can only occur during task execution, as task scheduling on the pools does not involve monitors.
        However, the returned value is null if this kind of inspection is not enabled or not supported; see startThreadInspection().
      • getAvgCPUTime

        java.lang.Long getAvgCPUTime()
        Returns:
        The time, in milliseconds, that the threads of this pool have spent consuming CPU in the last sampling period. The value is averaged among the various threads in the pool and normalized on a second, so it should be between 0 and 1000.
        However, the returned value is null if this kind of inspection is not enabled or not supported; see startThreadInspection().