org.gcube.common.core.contexts.ghn
Class Scheduler

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEHandler<HANDLED>
      extended by org.gcube.common.core.utils.handlers.GCUBEScheduledHandler<GHNContext>
          extended by org.gcube.common.core.contexts.ghn.Scheduler
All Implemented Interfaces:
GCUBEIHandler<GHNContext>, Lifetime<GHNContext>

public class Scheduler
extends GCUBEScheduledHandler<GHNContext>

Schedules updates to the gHN profile.

Author:
Fabio Simeoni (University of Strathclyde)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.common.core.utils.handlers.GCUBEScheduledHandler
GCUBEScheduledHandler.Mode
 
Field Summary
 
Fields inherited from class org.gcube.common.core.utils.handlers.GCUBEScheduledHandler
exception, exceptionCount, interval, repeat
 
Fields inherited from class org.gcube.common.core.utils.handlers.GCUBEHandler
handled, logger, producer
 
Constructor Summary
Scheduler(GHNContext ctxt, long interval, GCUBEScheduledHandler.Mode mode)
          Creates an instance.
 
Method Summary
protected  boolean repeat(Exception exception, int exceptionCount)
          Indicates whether the scheduling should continue.
 
Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEScheduledHandler
getInterval, getMode, getScheduled, onIteration, run, setInterval, setMode, setScheduled, stop
 
Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEHandler
clearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, getState, notify, setBlackboard, setHandled, setLogger, setName, setScopeManager, setSecurityManager, setState, subscribe, undo, unsubscribe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gcube.common.core.utils.handlers.lifetime.Lifetime
getState
 
Methods inherited from interface org.gcube.common.core.utils.handlers.GCUBEIHandler
clearBlackboard, getBlackboard, getHandled, getId, getLogger, getName, getScopeManager, getSecurityManager, setBlackboard, setHandled, setLogger, setName, setScopeManager, setSecurityManager, subscribe, undo, unsubscribe
 

Constructor Detail

Scheduler

public Scheduler(GHNContext ctxt,
                 long interval,
                 GCUBEScheduledHandler.Mode mode)
Creates an instance.

Parameters:
ctxt - the GHNContext.
interval - the schedule interval.
mode - the scheduling mode.
Method Detail

repeat

protected boolean repeat(Exception exception,
                         int exceptionCount)
Indicates whether the scheduling should continue. It is invoked after each iteration of the schedule as a pre-condition to continue it. By default, it returns true if no exception occurred during the iteration, and false otherwise. Override to implement specific conditions.

Overrides:
repeat in class GCUBEScheduledHandler<GHNContext>
Parameters:
exception - any exception which may have occurred during the iteration, or null if the iteration completed successfully.
exceptionCount - the number of exceptions which have occurred so far during the schedule.
Returns:
true if the scheduling should continue, false otherwise.


Copyright © 2013. All Rights Reserved.