|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsnaq.util.PoolTracer
public class PoolTracer
Class to create a simple trace of pool usage statistics to a log file. The default date format is local time in ISO 8601 compatible format.
Constructor Summary | |
---|---|
PoolTracer(ObjectPool pool,
File file)
Creates a new PoolTracer which logs to the specified file. |
|
PoolTracer(ObjectPool pool,
PrintWriter logWriter,
boolean closeOnExit)
Creates a new PoolTracer which logs to the specified
PrintWriter . |
|
PoolTracer(ObjectPool pool,
String filename)
Creates a new ObjectPoolAudit which logs to the specified File. |
|
PoolTracer(Properties props)
Creates a new PoolTracer which logs to the specified file. |
Method Summary | |
---|---|
MessageFormat |
getMessageFormatInstance()
Returns the current MessageFormat instance used for formatting log messages. |
void |
maxPoolLimitExceeded(ObjectPoolEvent evt)
Called when a check-out request causes the poolSize limit to be exceeded. |
void |
maxPoolLimitReached(ObjectPoolEvent evt)
Called when a check-out request causes the poolSize limit to be reached. |
void |
maxSizeLimitError(ObjectPoolEvent evt)
Called when a check-out request attempts to exceed the maxSize limit. |
void |
maxSizeLimitReached(ObjectPoolEvent evt)
Called when a check-out request causes the maxSize limit to be reached. |
void |
poolCheckIn(ObjectPoolEvent evt)
Called when an item is checked back in to the pool. |
void |
poolCheckOut(ObjectPoolEvent evt)
Called when an item is checked out of the pool. |
void |
poolFlushed(ObjectPoolEvent evt)
Called when the pool is flushed of all free/unused items. |
void |
poolInitCompleted(ObjectPoolEvent evt)
Called when the pool's ObjectPool.init(int) method has completed. |
void |
poolParametersChanged(ObjectPoolEvent evt)
Called when the pool's parameters are changed. |
void |
poolReleased(ObjectPoolEvent evt)
Called when the pool is released (no more events are fired by the pool after this event). |
void |
setDateFormat(DateFormat df)
Sets the date formatter for the logging. |
void |
setMessageFormat(MessageFormat mf)
Sets the MessageFormat instance used for formatting log messages. |
void |
validationError(ObjectPoolEvent evt)
Called when an item is found to be invalid. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PoolTracer(ObjectPool pool, PrintWriter logWriter, boolean closeOnExit)
PoolTracer
which logs to the specified
PrintWriter
.
pool
- ObjectPool
for which to trace activitylogWriter
- PrintWriter
to use for writing trace activitycloseOnExit
- whether to close the PrintWriter
on releasepublic PoolTracer(ObjectPool pool, File file) throws FileNotFoundException
PoolTracer
which logs to the specified file.
Note: if the file already exists it is truncated to zero-length, then used
for writing the log.
pool
- ObjectPool
for which to trace activityfile
- File
to which to log trace activity
FileNotFoundException
public PoolTracer(ObjectPool pool, String filename) throws FileNotFoundException
pool
- ObjectPool
for which to trace activityfilename
- name of file to which to log trace activity
FileNotFoundException
public PoolTracer(Properties props) throws FileNotFoundException
PoolTracer
which logs to the specified file.
Note: if the file already exists it is truncated to zero-length, then used
for writing the log.
props
- Properties
defining trace activity
FileNotFoundException
Method Detail |
---|
public void setDateFormat(DateFormat df)
LogUtil
class.
df
- DateFormat
instance to use for formatting log messagespublic void setMessageFormat(MessageFormat mf)
MessageFormat
instance used for formatting log messages.
To use the default instance, just call this method with a null argument.
Format strings are specified using the following variables:
The default format is as follows:
{0}: minpool={1,number,#}, maxpool={2,number,#}, maxsize={3,number,#}, expiry={4,number,#}, out={5,number,#}, free={6,number,#}, hitRate={8,number,0.0##%}
mf
- MessageFormat
instance to use for formatting log messagespublic MessageFormat getMessageFormatInstance()
MessageFormat
instance used for formatting log messages.
public void poolInitCompleted(ObjectPoolEvent evt)
ObjectPoolListener
ObjectPool.init(int)
method has completed.
poolInitCompleted
in interface ObjectPoolListener
public void validationError(ObjectPoolEvent evt)
ObjectPoolListener
validationError
in interface ObjectPoolListener
public void maxPoolLimitReached(ObjectPoolEvent evt)
ObjectPoolListener
maxPoolLimitReached
in interface ObjectPoolListener
public void maxPoolLimitExceeded(ObjectPoolEvent evt)
ObjectPoolListener
maxPoolLimitExceeded
in interface ObjectPoolListener
public void maxSizeLimitReached(ObjectPoolEvent evt)
ObjectPoolListener
maxSizeLimitReached
in interface ObjectPoolListener
public void maxSizeLimitError(ObjectPoolEvent evt)
ObjectPoolListener
maxSizeLimitError
in interface ObjectPoolListener
public void poolCheckIn(ObjectPoolEvent evt)
ObjectPoolListener
poolCheckIn
in interface ObjectPoolListener
public void poolCheckOut(ObjectPoolEvent evt)
ObjectPoolListener
poolCheckOut
in interface ObjectPoolListener
public void poolParametersChanged(ObjectPoolEvent evt)
ObjectPoolListener
poolParametersChanged
in interface ObjectPoolListener
public void poolFlushed(ObjectPoolEvent evt)
ObjectPoolListener
poolFlushed
in interface ObjectPoolListener
public void poolReleased(ObjectPoolEvent evt)
ObjectPoolListener
poolReleased
in interface ObjectPoolListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |