com.googlecode.fascinator.portal
Class HouseKeeper

java.lang.Object
  extended by com.googlecode.fascinator.portal.HouseKeeper
All Implemented Interfaces:
GenericListener, Runnable, javax.jms.MessageListener

public class HouseKeeper
extends Object
implements GenericListener

The House Keeper is a messaging object that periodically wakes itself up to look for routine maintenance tasks requiring attention.

Author:
Greg Pendlebury

Field Summary
static Integer DEFAULT_TIMEOUT
          Default timeout = 5 mins
static String QUEUE_ID
          House Keeping queue
 
Constructor Summary
HouseKeeper()
          Constructor required by ServiceLoader.
 
Method Summary
 void confirmMessage(String actionId)
          Confirm and remove a message/action
 String getId()
          Return the ID string for this listener
 Map<String,Map<String,String>> getQueueStats()
          Get the latest statistics on message queues.
 List<UserAction> getUserMessages()
          Get the messages to display for the user
 void init(JsonSimpleConfig config)
          Initialization method
 void onMessage(javax.jms.Message message)
          Callback function for incoming messages sent directly to housekeeping.
 void run()
          Start thread running
 void setPriority(int newPriority)
          Sets the priority level for the thread.
 void start()
          Start the queue
 void stop()
          Stop the House Keeper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUEUE_ID

public static final String QUEUE_ID
House Keeping queue

See Also:
Constant Field Values

DEFAULT_TIMEOUT

public static final Integer DEFAULT_TIMEOUT
Default timeout = 5 mins

Constructor Detail

HouseKeeper

public HouseKeeper()
Constructor required by ServiceLoader. Be sure to use init()

Method Detail

run

public void run()
Start thread running

Specified by:
run in interface Runnable

init

public void init(JsonSimpleConfig config)
          throws Exception
Initialization method

Specified by:
init in interface GenericListener
Parameters:
config - Configuration to use
Throws:
Exception - for any failure

getId

public String getId()
Return the ID string for this listener

Specified by:
getId in interface GenericListener

start

public void start()
           throws Exception
Start the queue

Specified by:
start in interface GenericListener
Throws:
Exception - if an error occurred starting the JMS connections

stop

public void stop()
          throws Exception
Stop the House Keeper. Including stopping the storage and indexer

Specified by:
stop in interface GenericListener
Throws:
Exception

onMessage

public void onMessage(javax.jms.Message message)
Callback function for incoming messages sent directly to housekeeping.

Specified by:
onMessage in interface javax.jms.MessageListener
Parameters:
message - The incoming message

getUserMessages

public List<UserAction> getUserMessages()
Get the messages to display for the user


confirmMessage

public void confirmMessage(String actionId)
                    throws Exception
Confirm and remove a message/action

Parameters:
actionId - The ID of the action to remove
Throws:
Exception

setPriority

public void setPriority(int newPriority)
Sets the priority level for the thread. Used by the OS.

Specified by:
setPriority in interface GenericListener
Parameters:
newPriority - The priority level to set the thread at

getQueueStats

public Map<String,Map<String,String>> getQueueStats()
Get the latest statistics on message queues.

Returns:
Map> of all queues and their statistics


Copyright © 2009-2013. All Rights Reserved.