org.duraspace.fcrepo.cloudsync.service.backend
Class TaskRunner

java.lang.Object
  extended by java.lang.Thread
      extended by org.duraspace.fcrepo.cloudsync.service.backend.TaskRunner
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
CopyTaskRunner, ListTaskRunner

public abstract class TaskRunner
extends Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  boolean cancelRequested
           
protected  TaskCompletionListener completionListener
           
protected  PrintWriter logWriter
           
protected  ObjectSetDao objectSetDao
           
protected  ObjectStoreDao objectStoreDao
           
protected  boolean pauseRequested
           
protected  boolean resumeRequested
           
protected  Task task
           
protected  TaskDao taskDao
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected TaskRunner(Task task, TaskDao taskDao, ObjectSetDao objectSetDao, ObjectStoreDao objectStoreDao, PrintWriter logWriter, TaskCompletionListener completionListener)
           
 
Method Summary
static TaskRunner getInstance(Task task, TaskDao taskDao, ObjectSetDao objectSetDao, ObjectStoreDao objectStoreDao, PrintWriter logWriter, TaskCompletionListener completionListener, HttpClientConfig httpClientConfig)
           
abstract  Set<String> getRelatedSetIds()
           
abstract  Set<String> getRelatedStoreIds()
           
 Task getTask()
           
protected  void pauseOrCancelIfRequested()
           
 void requestCancel()
           
 void requestPause()
           
 void requestResume()
           
 void run()
           
protected abstract  void runTask()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

task

protected final Task task

taskDao

protected final TaskDao taskDao

objectSetDao

protected final ObjectSetDao objectSetDao

objectStoreDao

protected final ObjectStoreDao objectStoreDao

logWriter

protected final PrintWriter logWriter

completionListener

protected final TaskCompletionListener completionListener

pauseRequested

protected boolean pauseRequested

resumeRequested

protected boolean resumeRequested

cancelRequested

protected boolean cancelRequested
Constructor Detail

TaskRunner

protected TaskRunner(Task task,
                     TaskDao taskDao,
                     ObjectSetDao objectSetDao,
                     ObjectStoreDao objectStoreDao,
                     PrintWriter logWriter,
                     TaskCompletionListener completionListener)
Method Detail

getInstance

public static final TaskRunner getInstance(Task task,
                                           TaskDao taskDao,
                                           ObjectSetDao objectSetDao,
                                           ObjectStoreDao objectStoreDao,
                                           PrintWriter logWriter,
                                           TaskCompletionListener completionListener,
                                           HttpClientConfig httpClientConfig)

run

public final void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

runTask

protected abstract void runTask()
                         throws Exception
Throws:
Exception

pauseOrCancelIfRequested

protected void pauseOrCancelIfRequested()
                                 throws TaskCanceledException
Throws:
TaskCanceledException

getTask

public Task getTask()

requestPause

public void requestPause()

requestResume

public void requestResume()

requestCancel

public void requestCancel()

getRelatedSetIds

public abstract Set<String> getRelatedSetIds()

getRelatedStoreIds

public abstract Set<String> getRelatedStoreIds()


Copyright © 2012 DuraSpace. All Rights Reserved.