com.tomgibara.pronto.logging
Interface LoggingPolicy

All Known Implementing Classes:
DefaultLoggingPolicy

public interface LoggingPolicy

Logging policies parameterize the operation of LoggingConfig instances. Note that the values returned from a policy object may be live. This means that they may change their values between successive calls to the same method.

Calls to the methods of this interface are externally synchronized by the LoggingConfig instance that it configures.

Author:
Tom Gibara

Method Summary
 com.tomgibara.pronto.util.Duration getPollingPeriod()
          This method should return the length of time that should elapse between the polling of configuration properties.
 boolean isTimestampNewer(long newTimestamp, long oldTimestamp)
          This method is called to identify whether the change in the timestamp associated with a set of configuration properties represents a change in the properties.
 

Method Detail

getPollingPeriod

com.tomgibara.pronto.util.Duration getPollingPeriod()
This method should return the length of time that should elapse between the polling of configuration properties. Returning null from this method disables the polling.

Returns:
the default duration between checks for changed configuration

isTimestampNewer

boolean isTimestampNewer(long newTimestamp,
                         long oldTimestamp)
This method is called to identify whether the change in the timestamp associated with a set of configuration properties represents a change in the properties. For example, some systems may exhibit unstable timestamps for resources which might result in excessive re-evaluation of configuration properties. For such a system a sensible policy might be to consider only sufficiently large differences as indicators of possible change.

Parameters:
newTimestamp - the latest timestamp reported by a ConfigSource
oldTimestamp - the previous timestamp reported by a ConfigSource
Returns:
true if the timestamps indicate that the properties may have changed.


Copyright © 2006-2007 Tom Gibara. All Rights Reserved.