org.gcube.data.tm.publishers
Class ResilientScheduler

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEHandler<HANDLED>
      extended by org.gcube.common.core.utils.handlers.GCUBEScheduledHandler<Void>
          extended by org.gcube.data.tm.publishers.ResilientScheduler
All Implemented Interfaces:
org.gcube.common.core.utils.handlers.GCUBEIHandler<Void>, org.gcube.common.core.utils.handlers.lifetime.Lifetime<Void>

public class ResilientScheduler
extends org.gcube.common.core.utils.handlers.GCUBEScheduledHandler<Void>

A GCUBEScheduledHandler which tolerates failure for a maximum number of times.

Author:
Fabio Simeoni

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.common.core.utils.handlers.GCUBEScheduledHandler
org.gcube.common.core.utils.handlers.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
ResilientScheduler(long interval, org.gcube.common.core.utils.handlers.GCUBEScheduledHandler.Mode mode)
          Creates an instance with a given execution mode, time interval, and scheduled handler.
 
Method Summary
 int getAttempts()
          Returns the number of publication attempts.
 long getDelay()
          Returns the interval between publication attempts.
protected  boolean repeat(Exception exception, int exceptionCount)
          
 void setAttempts(int attempts)
          Sets the number of publication attempts;
 void setDelay(long delay)
          Sets the interval between publication attempts.
 
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

ResilientScheduler

public ResilientScheduler(long interval,
                          org.gcube.common.core.utils.handlers.GCUBEScheduledHandler.Mode mode)
Creates an instance with a given execution mode, time interval, and scheduled handler.

Parameters:
interval - the time interval in seconds.
mode - the execution mode.
Method Detail

repeat

protected boolean repeat(Exception exception,
                         int exceptionCount)

Overrides:
repeat in class org.gcube.common.core.utils.handlers.GCUBEScheduledHandler<Void>

getAttempts

public int getAttempts()
Returns the number of publication attempts.

Returns:
the attempts.

setAttempts

public void setAttempts(int attempts)
Sets the number of publication attempts;

Parameters:
attempts - the attempts.

getDelay

public long getDelay()
Returns the interval between publication attempts.

Returns:
the delay.

setDelay

public void setDelay(long delay)
Sets the interval between publication attempts.

Parameters:
delay - the delay


Copyright © 2013. All Rights Reserved.