com.solab.alarms
Class DefaultAlarmCache

java.lang.Object
  extended by com.solab.alarms.DefaultAlarmCache
All Implemented Interfaces:
AlarmCache

public class DefaultAlarmCache
extends Object
implements AlarmCache

This is the default cache, which uses a map to store the last date a message was sent for a given channel/msg/source cobination.

Author:
Enrique Zamudio

Constructor Summary
DefaultAlarmCache()
           
 
Method Summary
 int getDefaultInterval()
           
 void setDefaultInterval(int value)
          Sets the default resend interval, for storing alarms unrelated to a specific channel, in milliseconds.
 boolean shouldResend(AlarmChannel channel, String source, String message)
          This method returns true if the specified message with optional source has not been sent through the specified channel very recently (meaning the resend interval for the channel has elapsed).
 void shutdown()
          Subclasses must override this, closing and freeing up any resources they use (connections, etc).
 void store(AlarmChannel channel, String source, String message)
          Stores the current date for the specified message and optional source, for the given channel.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultAlarmCache

public DefaultAlarmCache()
Method Detail

setDefaultInterval

public void setDefaultInterval(int value)
Sets the default resend interval, for storing alarms unrelated to a specific channel, in milliseconds. Default is 2 minutes.


getDefaultInterval

public int getDefaultInterval()

store

public void store(AlarmChannel channel,
                  String source,
                  String message)
Description copied from interface: AlarmCache
Stores the current date for the specified message and optional source, for the given channel.

Specified by:
store in interface AlarmCache

shouldResend

public boolean shouldResend(AlarmChannel channel,
                            String source,
                            String message)
Description copied from interface: AlarmCache
This method returns true if the specified message with optional source has not been sent through the specified channel very recently (meaning the resend interval for the channel has elapsed).

Specified by:
shouldResend in interface AlarmCache

toString

public String toString()
Overrides:
toString in class Object

shutdown

public void shutdown()
Description copied from interface: AlarmCache
Subclasses must override this, closing and freeing up any resources they use (connections, etc).

Specified by:
shutdown in interface AlarmCache


Copyright © 2011 Java Mexico. All Rights Reserved.