diff options
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/abstracts/InvokableAsyncOperation.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/operation/abstracts/InvokableAsyncOperation.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/abstracts/InvokableAsyncOperation.java b/src/main/java/com/keuin/kbackupfabric/operation/abstracts/InvokableAsyncOperation.java new file mode 100644 index 0000000..518f670 --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/operation/abstracts/InvokableAsyncOperation.java @@ -0,0 +1,32 @@ +package com.keuin.kbackupfabric.operation.abstracts; + +public abstract class InvokableAsyncOperation extends InvokableOperation { + + private final AbstractAsyncOperation asyncOperation; + + + public InvokableAsyncOperation(String name) { + asyncOperation = new AbstractAsyncOperation(name) { + @Override + protected void async() { + InvokableAsyncOperation.this.async(); + } + + @Override + protected boolean sync() { + return InvokableAsyncOperation.this.sync(); + } + }; + } + + protected abstract void async(); + + protected boolean sync() { + return true; + } + + @Override + protected boolean operate() { + return asyncOperation.operate(); + } +} |