public class DurationFilter extends Object implements Filter
By default each DurationFilter
is initialized using the following
LogManager configuration properties where <filter-name>
refers to the
fully qualified class name of the handler. If properties are not defined, or
contain invalid values, then the specified default values are used.
1000
)
java.time
package is available then
an ISO-8601 duration format of PnDTnHnMn.nS
can be used as the value.
The suffixes of "D", "H", "M" and "S" are for days, hours, minutes and
seconds. The suffixes must occur in order. The seconds can be specified with
a fractional component to declare milliseconds. (defaults to PT15M
)
For example, the settings to limit MailHandler
with a default
capacity to only send a maximum of two email messages every six minutes would
be as follows:
com.sun.mail.util.logging.MailHandler.filter = com.sun.mail.util.logging.DurationFilter
com.sun.mail.util.logging.MailHandler.capacity = 1000
com.sun.mail.util.logging.DurationFilter.records = 2L * 1000L
com.sun.mail.util.logging.DurationFilter.duration = PT6M
Constructor and Description |
---|
DurationFilter()
Creates the filter using the default properties.
|
DurationFilter(long records,
long duration)
Creates the filter using the given properties.
|
Modifier and Type | Method and Description |
---|---|
protected DurationFilter |
clone()
Creates a copy of this filter that retains the filter settings but does
not include the current filter state.
|
boolean |
equals(Object obj)
Determines if this filter is equal to another filter.
|
int |
hashCode()
Returns a hash code value for this filter.
|
boolean |
isIdle()
Determines if this filter is able to accept the maximum number of log
records for this instant in time.
|
boolean |
isLoggable()
Determines if this filter will accept log records for this instant in
time.
|
boolean |
isLoggable(LogRecord record)
Check if the given log record should be published.
|
String |
toString()
Returns a string representation of this filter.
|
public DurationFilter()
public DurationFilter(long records, long duration)
records
- the number of records per duration.duration
- the number of milliseconds to suppress log records from
being published.public boolean equals(Object obj)
public boolean isIdle()
public int hashCode()
public boolean isLoggable(LogRecord record)
isLoggable
in interface Filter
record
- the log record to check.NullPointerException
- if given record is null.public boolean isLoggable()
public String toString()
protected DurationFilter clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
- if this filter is not allowed to be
cloned.Copyright © 2019 Eclipse Foundation. Use is subject to license terms.