Adding classes to orphan task take over
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@126684 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e9a5c0751a
commit
afbb0be7ac
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.vremanagement.executor.configuration;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
|
||||
*/
|
||||
public class OrphanTaskMonitor implements Runnable {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(OrphanTaskMonitor.class);
|
||||
|
||||
protected final ScheduledExecutorService scheduler;
|
||||
|
||||
public final static int INITIAL_DELAY = 1;
|
||||
public final static int DELAY = 5;
|
||||
public final static TimeUnit TIME_UNIT = TimeUnit.MINUTES;
|
||||
|
||||
public OrphanTaskMonitor(){
|
||||
this.scheduler = Executors.newScheduledThreadPool(1);
|
||||
this.scheduler.scheduleAtFixedRate(this, INITIAL_DELAY, DELAY, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
protected void check(){
|
||||
// TODO Insert Code Here
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
logger.debug("Looking for orphan task to take in charge");
|
||||
check();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue