Class IdleConnectionMonitor
- java.lang.Object
-
- java.lang.Thread
-
- com.oracle.bmc.http.client.jersey3.internal.IdleConnectionMonitor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_IDLE_CONNECTION_MONITOR_THREAD_WAIT_TIME_IN_SECONDS-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcleanStaleReferences()Remove stale references that have been garbage-collected already.voidcloseIdleConnections()Close idle connections.static IdleConnectionMonitorgetInstance()intgetWaitTimeInSeconds()static intidleConnectionMonitorThreadSize()booleanisIdleMonitorThreadShutdown()static booleanregisterConnectionManager(org.apache.http.conn.HttpClientConnectionManager connectionManager, int waitTimeInSeconds, int idleTimeoutInSeconds)Registers the connection manager with the IdleConnectionMonitor thread;static booleanremoveConnectionManager(org.apache.http.conn.HttpClientConnectionManager connectionManager)Removes the connection manager from the IdleConnectionMonitor thread, and shuts down the thread if there is no connection manager left.voidrun()static booleanshutdown()Stops the execution of IdleConnectionMonitor thread by shutting down the thread and clears the connection managers in it.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Method Detail
-
registerConnectionManager
public static boolean registerConnectionManager(org.apache.http.conn.HttpClientConnectionManager connectionManager, int waitTimeInSeconds, int idleTimeoutInSeconds)Registers the connection manager with the IdleConnectionMonitor thread;- Parameters:
connectionManager- Connection manager to registerwaitTimeInSeconds- The maximum time interval after which the check and closing of expired/idle connections is performed; this may happen more oftenidleTimeoutInSeconds- The idle timeout - close connections that have been idle longer than idleTimeoutInSeconds seconds- Returns:
- true if the connection manager has been successfully registered; otherwise false.
-
removeConnectionManager
public static boolean removeConnectionManager(org.apache.http.conn.HttpClientConnectionManager connectionManager)
Removes the connection manager from the IdleConnectionMonitor thread, and shuts down the thread if there is no connection manager left.- Returns:
- true if the connection manager has been successfully removed; otherwise false.
-
closeIdleConnections
public void closeIdleConnections()
Close idle connections.As a side effect, updates the minimum wait time between checks.
-
cleanStaleReferences
public static void cleanStaleReferences()
Remove stale references that have been garbage-collected already.
-
shutdown
public static boolean shutdown()
Stops the execution of IdleConnectionMonitor thread by shutting down the thread and clears the connection managers in it.- Returns:
- true if the shutdown process was initiated successfully, otherwise false.
-
idleConnectionMonitorThreadSize
public static int idleConnectionMonitorThreadSize()
-
getWaitTimeInSeconds
public int getWaitTimeInSeconds()
-
isIdleMonitorThreadShutdown
public boolean isIdleMonitorThreadShutdown()
-
getInstance
public static IdleConnectionMonitor getInstance()
-
-