public class AbandonedConfig
extends java.lang.Object
构造器和说明 |
---|
AbandonedConfig() |
限定符和类型 | 方法和说明 |
---|---|
boolean |
getLogAbandoned()
Flag to log stack traces for application code which abandoned
an object.
|
java.io.PrintWriter |
getLogWriter()
Gets the log writer being used by this configuration to log
information on abandoned objects.
|
boolean |
getRemoveAbandonedOnBorrow()
Flag to remove abandoned objects if they exceed the
removeAbandonedTimeout when borrowObject is invoked.
|
boolean |
getRemoveAbandonedOnMaintenance()
Flag to remove abandoned objects if they exceed the
removeAbandonedTimeout when pool maintenance (the "evictor")
runs.
|
int |
getRemoveAbandonedTimeout()
已过时。
|
java.time.Duration |
getRemoveAbandonedTimeoutDuration()
Timeout before an abandoned object can be removed.
|
boolean |
getRequireFullStackTrace()
Indicates if full stack traces are required when
logAbandoned
is true. |
boolean |
getUseUsageTracking()
If the pool implements
UsageTracking , should the pool record a
stack trace every time a method is called on a pooled object and retain
the most recent stack trace to aid debugging of abandoned objects? |
void |
setLogAbandoned(boolean logAbandoned)
Sets the flag to log stack traces for application code which abandoned
an object.
|
void |
setLogWriter(java.io.PrintWriter logWriter)
Sets the log writer to be used by this configuration to log
information on abandoned objects.
|
void |
setRemoveAbandonedOnBorrow(boolean removeAbandonedOnBorrow)
Flag to remove abandoned objects if they exceed the
removeAbandonedTimeout when borrowObject is invoked.
|
void |
setRemoveAbandonedOnMaintenance(boolean removeAbandonedOnMaintenance)
Flag to remove abandoned objects if they exceed the
removeAbandonedTimeout when pool maintenance runs.
|
void |
setRemoveAbandonedTimeout(java.time.Duration removeAbandonedTimeout)
Sets the timeout before an abandoned object can be
removed
Setting this property has no effect if
removeAbandonedOnBorrow and
removeAbandonedOnMaintenance
are both false. |
void |
setRemoveAbandonedTimeout(int removeAbandonedTimeout)
已过时。
|
void |
setRequireFullStackTrace(boolean requireFullStackTrace)
Sets the flag to require full stack traces for logging abandoned connections when enabled.
|
void |
setUseUsageTracking(boolean useUsageTracking)
If the pool implements
UsageTracking , configure whether the pool
should record a stack trace every time a method is called on a pooled
object and retain the most recent stack trace to aid debugging of
abandoned objects. |
java.lang.String |
toString() |
public boolean getLogAbandoned()
public java.io.PrintWriter getLogWriter()
public boolean getRemoveAbandonedOnBorrow()
Flag to remove abandoned objects if they exceed the removeAbandonedTimeout when borrowObject is invoked.
The default value is false.
If set to true, abandoned objects are removed by borrowObject if
there are fewer than 2 idle objects available in the pool and
getNumActive() > getMaxTotal() - 3
public boolean getRemoveAbandonedOnMaintenance()
Flag to remove abandoned objects if they exceed the removeAbandonedTimeout when pool maintenance (the "evictor") runs.
The default value is false.
If set to true, abandoned objects are removed by the pool
maintenance thread when it runs. This setting has no effect
unless maintenance is enabled by setting
timeBetweenEvictionRuns
to a positive number.
@Deprecated public int getRemoveAbandonedTimeout()
getRemoveAbandonedTimeoutDuration()
.Timeout in seconds before an abandoned object can be removed.
The time of most recent use of an object is the maximum (latest) of
TrackedUse.getLastUsed()
(if this class of the object implements
TrackedUse) and the time when the object was borrowed from the pool.
The default value is 300 seconds.
public java.time.Duration getRemoveAbandonedTimeoutDuration()
Timeout before an abandoned object can be removed.
The time of most recent use of an object is the maximum (latest) of
TrackedUse.getLastUsed()
(if this class of the object implements
TrackedUse) and the time when the object was borrowed from the pool.
The default value is 300 seconds.
public boolean getRequireFullStackTrace()
logAbandoned
is true. Defaults to true. Logging of abandoned objects requiring a full stack trace will
generate an entire stack trace to generate for every object created. If this is disabled,
a faster but less informative stack walking mechanism may be used if available.CallStack
public boolean getUseUsageTracking()
UsageTracking
, should the pool record a
stack trace every time a method is called on a pooled object and retain
the most recent stack trace to aid debugging of abandoned objects?true
if usage tracking is enabledpublic void setLogAbandoned(boolean logAbandoned)
logAbandoned
- true turns on abandoned stack trace logginggetLogAbandoned()
public void setLogWriter(java.io.PrintWriter logWriter)
logWriter
- The new log writerpublic void setRemoveAbandonedOnBorrow(boolean removeAbandonedOnBorrow)
Flag to remove abandoned objects if they exceed the removeAbandonedTimeout when borrowObject is invoked.
removeAbandonedOnBorrow
- true means abandoned objects will be
removed by borrowObjectgetRemoveAbandonedOnBorrow()
public void setRemoveAbandonedOnMaintenance(boolean removeAbandonedOnMaintenance)
Flag to remove abandoned objects if they exceed the removeAbandonedTimeout when pool maintenance runs.
removeAbandonedOnMaintenance
- true means abandoned objects will be
removed by pool maintenancegetRemoveAbandonedOnMaintenance()
public void setRemoveAbandonedTimeout(java.time.Duration removeAbandonedTimeout)
Sets the timeout before an abandoned object can be removed
Setting this property has no effect if
removeAbandonedOnBorrow
and
removeAbandonedOnMaintenance
are both false.
removeAbandonedTimeout
- new abandoned timeoutgetRemoveAbandonedTimeout()
@Deprecated public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)
setRemoveAbandonedTimeout(Duration)
.Sets the timeout in seconds before an abandoned object can be removed
Setting this property has no effect if
removeAbandonedOnBorrow
and
removeAbandonedOnMaintenance
are both false.
removeAbandonedTimeout
- new abandoned timeout in secondsgetRemoveAbandonedTimeout()
public void setRequireFullStackTrace(boolean requireFullStackTrace)
requireFullStackTrace
- indicates whether or not full stack traces are required in
abandoned connection logsCallStack
,
getRequireFullStackTrace()
public void setUseUsageTracking(boolean useUsageTracking)
UsageTracking
, configure whether the pool
should record a stack trace every time a method is called on a pooled
object and retain the most recent stack trace to aid debugging of
abandoned objects.useUsageTracking
- A value of true
will enable
the recording of a stack trace on every use
of a pooled objectpublic java.lang.String toString()
toString
在类中 java.lang.Object