Package org.bedework.synch
Class SynchlingPool
- java.lang.Object
-
- org.bedework.synch.SynchlingPool
-
- All Implemented Interfaces:
org.bedework.util.logging.Logged
public class SynchlingPool extends Object implements org.bedework.util.logging.Logged
manage a pool of synchlings.- Author:
- Mike Douglass
-
-
Constructor Summary
Constructors Constructor Description SynchlingPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Synchling s)Put a synchling back in the pool if there's room else discard itSynchlingget()Get a synchling from the pool if possiblelonggetActiveCt()intgetCurrentAvailable()Return approximate number of available synchlingsintgetCurrentMaxSize()longgetGets()longgetGetSynchlingFailures()org.bedework.util.logging.BwLoggergetLogger()SynchlinggetNoException()Get a synchling from the pool if possible.List<Stat>getStats()Get the current statslonggetTimeout()longgetWaitTimes()voidresize(int size)Resize the poolvoidsetTimeout(long val)voidstart(SynchEngine syncher, int size, long timeout)Create a pool with the given sizevoidstop()Shut down active synchlingsStringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, warn
-
-
-
-
Method Detail
-
start
public void start(SynchEngine syncher, int size, long timeout)
Create a pool with the given size- Parameters:
syncher-size-timeout- - millisecs
-
stop
public void stop()
Shut down active synchlings
-
resize
public void resize(int size)
Resize the pool- Parameters:
size-
-
setTimeout
public void setTimeout(long val)
- Parameters:
val- timeout in millisecs
-
getTimeout
public long getTimeout()
- Returns:
- timeout in millisecs
-
getActiveCt
public long getActiveCt()
- Returns:
- number active
-
getWaitTimes
public long getWaitTimes()
- Returns:
- total waitTimes in millisecs
-
getGets
public long getGets()
- Returns:
- number of gets
-
getGetSynchlingFailures
public long getGetSynchlingFailures()
- Returns:
- number of get failures
-
getCurrentMaxSize
public int getCurrentMaxSize()
- Returns:
- current size of pool
-
getCurrentAvailable
public int getCurrentAvailable()
Return approximate number of available synchlings- Returns:
- current avail
-
add
public void add(Synchling s) throws SynchException
Put a synchling back in the pool if there's room else discard it- Parameters:
s-- Throws:
SynchException
-
get
public Synchling get() throws SynchException
Get a synchling from the pool if possible- Returns:
- a sychling
- Throws:
SynchException- if none available
-
getNoException
public Synchling getNoException() throws SynchException
Get a synchling from the pool if possible. Return null if timed out- Returns:
- a sychling or null
- Throws:
SynchException- on error
-
getLogger
public org.bedework.util.logging.BwLogger getLogger()
- Specified by:
getLoggerin interfaceorg.bedework.util.logging.Logged
-
-