Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.net.proxy
Class DefaultProxyServiceThreadPoolSizing

java.lang.Object
  extended by com.tangosol.net.proxy.DefaultProxyServiceThreadPoolSizing

All Implemented Interfaces:
ThreadPoolSizingStrategy

public class DefaultProxyServiceThreadPoolSizing
extends java.lang.Object
implements ThreadPoolSizingStrategy

Default ThreadPoolSizingStrategy implementation for ProxyService.

This implementation will attempt to ensure that the thread pool will be sized to meet client demand. When the thread pool reaches its size limit, a warning message is logged.

Since:
Coherence 12.1.2
Author:
lh 2012.01.12

Nested Class Summary
protected  class DefaultProxyServiceThreadPoolSizing.PoolContext
          PoolContext holds the working view of the usage of the thread pool throughout the analysis and is used to adjust the pool size during analysis.

 

Field Summary
protected  DefaultProxyServiceThreadPoolSizing.PoolContext m_ctxLast
          The last analysis context.
protected  boolean m_fPrintWarning
          A flag to indicate if a warning message should be printed.
protected  long m_ltdLastPrintTime
          The last time in milliseconds, that a warning message was printed.
protected  ThreadPoolManager m_mgrPool
          The ThreadPoolManager.
static int PRINT_WARNING_INTERVAL
          The time interval for printing the warning message.

 

Constructor Summary
DefaultProxyServiceThreadPoolSizing()
          Default constructor.

 

Method Summary
 int adjustPoolSize()
          Analyze the thread usage of the thread pool.
protected  int adjustPoolSize(DefaultProxyServiceThreadPoolSizing.PoolContext ctx)
          Analyze the load statistics using the specified analysis context and return the target pool size if adjustment is necessary.
 java.lang.String getDescription()
          Return a human-readable description of the state of the ThreadPoolSizingStrategy.
 DefaultProxyServiceThreadPoolSizing.PoolContext getLastPoolContext()
          Return the last PoolContext.
 ThreadPoolManager getManager()
          Return the ThreadPoolManager this ThreadPoolSizingStrategy is bound to.
 void init(ThreadPoolManager mgr)
          Initialize the ThreadPoolSizingStrategy and bind it to the specified manager.
 DefaultProxyServiceThreadPoolSizing.PoolContext instantiatePoolContext()
          Factory method.
 void setLastPoolContext(DefaultProxyServiceThreadPoolSizing.PoolContext ctx)
          Set the last PoolContext.

 

Field Detail

PRINT_WARNING_INTERVAL

public static final int PRINT_WARNING_INTERVAL
The time interval for printing the warning message.
See Also:
Constant Field Values

m_mgrPool

protected ThreadPoolManager m_mgrPool
The ThreadPoolManager.

m_ctxLast

protected DefaultProxyServiceThreadPoolSizing.PoolContext m_ctxLast
The last analysis context.

m_fPrintWarning

protected boolean m_fPrintWarning
A flag to indicate if a warning message should be printed.

m_ltdLastPrintTime

protected long m_ltdLastPrintTime
The last time in milliseconds, that a warning message was printed.

Constructor Detail

DefaultProxyServiceThreadPoolSizing

public DefaultProxyServiceThreadPoolSizing()
Default constructor.

Method Detail

getManager

public ThreadPoolManager getManager()
Return the ThreadPoolManager this ThreadPoolSizingStrategy is bound to.
Returns:
the ThreadPoolManager

getLastPoolContext

public DefaultProxyServiceThreadPoolSizing.PoolContext getLastPoolContext()
Return the last PoolContext.
Returns:
the last PoolContext

setLastPoolContext

public void setLastPoolContext(DefaultProxyServiceThreadPoolSizing.PoolContext ctx)
Set the last PoolContext.
Parameters:
ctx - the PoolContext

init

public void init(ThreadPoolManager mgr)
Initialize the ThreadPoolSizingStrategy and bind it to the specified manager.
Specified by:
init in interface ThreadPoolSizingStrategy
Parameters:
mgr - the ThreadPoolManager this strategy will be bound to

adjustPoolSize

public int adjustPoolSize()
Analyze the thread usage of the thread pool. If adjustment of the thread pool size is needed, return the target pool size; otherwise, -1 when no adjustment is necessary. The strategy can influence the frequency with which it is analyzed by specifying the desired time interval for the next adjustment. The caller of the strategy is responsible setting the target size of its thread pool.

The mutation of the statistics information exposed by the Coherence thread pool for the duration of this method call should have minimum impact on the target thread pool size.

Specified by:
adjustPoolSize in interface ThreadPoolSizingStrategy
Returns:
the target thread pool size of the thread pool or -1 if no adjustment is necessary

getDescription

public java.lang.String getDescription()
Return a human-readable description of the state of the ThreadPoolSizingStrategy.
Specified by:
getDescription in interface ThreadPoolSizingStrategy
Returns:
a human-readable description

adjustPoolSize

protected int adjustPoolSize(DefaultProxyServiceThreadPoolSizing.PoolContext ctx)
Analyze the load statistics using the specified analysis context and return the target pool size if adjustment is necessary. Clear all the statistics in the analysis context upon each adjustment. To determine the appropriate thread pool size, we collect the backlog and idle threads statistics and calculate the averages over periods of time (thread count increase/decrease intervals). Using average smooths out the edge cases. The thread count increase/decrease intervals can be changed to control the adjustment frequency.
Parameters:
ctx - the analysis context
Returns:
the target thread pool size, or -1 if no adjustment is needed.

instantiatePoolContext

public DefaultProxyServiceThreadPoolSizing.PoolContext instantiatePoolContext()
Factory method.
Returns:
a new PoolContext

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.