uk.ac.soton.itinnovation.grid.service.sla
Class UsageMonitorImpl

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.service.sla.UsageMonitorImpl
All Implemented Interfaces:
UsageMonitor

public class UsageMonitorImpl
extends Object
implements UsageMonitor

This is the default UsageMonitor implementation. It mantains a single PollingConsumer to retrieve usage reports from active services.

It keeps count of active pull-points by monitoring events for activities starting and stopping.

More sophisticated implementations may chose to have more fine griained monitoring of activities, using a PollingConsumer per activity, or perhaps adjusting polling parameters for activities that are expected to finish soon or use more resource than agreed.


Constructor Summary
UsageMonitorImpl()
           
 
Method Summary
 void activitiesStopped(List<Activity> activities)
          Notification that a list of activities have stopped.
 void activitiesStopped(org.hibernate.Session sess, List<Activity> activities)
          Notification that a list of activities have stopped.
 void activityStarted(Activity act)
          Notification that an acitivity has started.
 void activityStarted(org.hibernate.Session sess, Activity act)
          Version of UsageMonitor.activityStarted(Activity) which uses an existing Session.
 void activityStopped(Activity act)
           
 void activityStopped(org.hibernate.Session sess, Activity act)
          Notification that an acitivity has stopped.
 Map<String,Exception> getServiceExceptions()
           
 void restart()
          Convenience method that just calls stopAndWait() followed by start()
 void setConstraintManager(ConstraintManager manager)
           
 void setFetchSize(int fetchSize)
          Set the fetch size.
 void setPollingInterval(int pollingInterval)
          Set the polling interval (in seconds).
 void start()
          Starts monitoring of service resource usage.
 void stop()
          Stops monitoring of service resource usage.
 void stopAndWait()
          Stops monitoring of service resource usage and waits for any ongoing message retrieval to complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsageMonitorImpl

public UsageMonitorImpl()
Method Detail

setConstraintManager

public void setConstraintManager(ConstraintManager manager)
Specified by:
setConstraintManager in interface UsageMonitor

setPollingInterval

public void setPollingInterval(int pollingInterval)
Description copied from interface: UsageMonitor
Set the polling interval (in seconds).

Specified by:
setPollingInterval in interface UsageMonitor

setFetchSize

public void setFetchSize(int fetchSize)
Description copied from interface: UsageMonitor
Set the fetch size. This is batch size for the number of usage reports to retrieve in one go. A value of -1 can be used to indicate no maximum fetch size.

Specified by:
setFetchSize in interface UsageMonitor

start

public void start()
Description copied from interface: UsageMonitor
Starts monitoring of service resource usage.

The services to monitor are reloaded from persistent storage and polling consumers created for each service. These retrieve Usage reports from a service.

Specified by:
start in interface UsageMonitor

stop

public void stop()
Description copied from interface: UsageMonitor
Stops monitoring of service resource usage. Any ongoing message retrieval will complete. This method may return before the final round of message retrieval has completed.

Specified by:
stop in interface UsageMonitor

stopAndWait

public void stopAndWait()
Description copied from interface: UsageMonitor
Stops monitoring of service resource usage and waits for any ongoing message retrieval to complete.

Specified by:
stopAndWait in interface UsageMonitor

restart

public void restart()
Description copied from interface: UsageMonitor
Convenience method that just calls stopAndWait() followed by start()

Specified by:
restart in interface UsageMonitor

activityStarted

public void activityStarted(Activity act)
Description copied from interface: UsageMonitor
Notification that an acitivity has started. This is used to determine which services need to be monitored.

Specified by:
activityStarted in interface UsageMonitor

activityStarted

public void activityStarted(org.hibernate.Session sess,
                            Activity act)
Description copied from interface: UsageMonitor
Version of UsageMonitor.activityStarted(Activity) which uses an existing Session. Caller is responsible for creating and committing the transaction.

Specified by:
activityStarted in interface UsageMonitor

activityStopped

public void activityStopped(org.hibernate.Session sess,
                            Activity act)
Description copied from interface: UsageMonitor
Notification that an acitivity has stopped. This is used to determine which services need to be monitored.

Specified by:
activityStopped in interface UsageMonitor

activityStopped

public void activityStopped(Activity act)
Specified by:
activityStopped in interface UsageMonitor

activitiesStopped

public void activitiesStopped(org.hibernate.Session sess,
                              List<Activity> activities)
Description copied from interface: UsageMonitor
Notification that a list of activities have stopped. This is used to determine which services need to be monitored.

Specified by:
activitiesStopped in interface UsageMonitor

activitiesStopped

public void activitiesStopped(List<Activity> activities)
Description copied from interface: UsageMonitor
Notification that a list of activities have stopped. This is used to determine which services need to be monitored.

Specified by:
activitiesStopped in interface UsageMonitor

getServiceExceptions

public Map<String,Exception> getServiceExceptions()
Specified by:
getServiceExceptions in interface UsageMonitor
Returns:
a map between services and exceptions thrown when polling them.


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.