Package org.aksw.shellgebra.exec
Class FileWriterTaskBase
java.lang.Object
org.aksw.shellgebra.exec.FileWriterTaskBase
- All Implemented Interfaces:
AutoCloseable,FileWriterTask
- Direct Known Subclasses:
FileWriterTaskNoop,FileWriterTaskViaExecutor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected PathThe file being generated.protected FileWriterTaskBase.PathLifeCycleprotected AtomicReference<FileWriterTaskBase.TaskState> -
Constructor Summary
ConstructorsConstructorDescriptionFileWriterTaskBase(Path path, FileWriterTaskBase.PathLifeCycle pathLifeCycle) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidabort()protected voidOnly call this method from within a synchronized block!protected voidThe path that will be written to by this writer.getState()booleanbooleanprotected abstract voidCalled on completion - regardless whether successful or not.protected abstract voidMethod that allows for setting up resources in an atomic way.protected abstract voidabstract voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface org.aksw.shellgebra.exec.FileWriterTask
start
-
Field Details
-
outputPath
The file being generated. -
pathLifeCycle
-
state
-
isAbortCalled
protected volatile boolean isAbortCalled
-
-
Constructor Details
-
FileWriterTaskBase
-
-
Method Details
-
getOutputPath
Description copied from interface:FileWriterTaskThe path that will be written to by this writer.- Specified by:
getOutputPathin interfaceFileWriterTask
-
checkIfNew
protected void checkIfNew() -
checkIfAbortHasBeenCalled
protected void checkIfAbortHasBeenCalled()Only call this method from within a synchronized block! -
isStarted
public boolean isStarted() -
isFinished
public boolean isFinished() -
getState
-
prepareWriteFile
Method that allows for setting up resources in an atomic way. STARTING.- Throws:
IOException
-
runWriteFile
- Throws:
IOException
-
onCompletion
Called on completion - regardless whether successful or not. Only called if prepareWriteFile has been called before. (doWriteFile may not have been called).- Throws:
IOException
-
waitForCompletion
- Specified by:
waitForCompletionin interfaceFileWriterTask- Throws:
ExecutionExceptionInterruptedException
-
abort
public abstract void abort()- Specified by:
abortin interfaceFileWriterTask
-