summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/operation/abstracts/InvokableBlockingOperation.java
blob: 508c676699098c3f2a025e874a26d67fd4b8aa07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.keuin.kbackupfabric.operation.abstracts;

import com.keuin.kbackupfabric.operation.abstracts.i.Blocking;

public abstract class InvokableBlockingOperation extends InvokableOperation implements Blocking {

    private final AbstractBlockingOperation operation = new AbstractBlockingOperation() {
        @Override
        protected boolean blockingContext() {
            return InvokableBlockingOperation.this.blockingContext();
        }
    };

    @Override
    protected final boolean operate() {
        return operation.operate();
    }

    /**
     * Implement your blocked operation here.
     *
     * @return stat code.
     */
    protected abstract boolean blockingContext();

    protected void block(boolean blockState) {
        operation.block(blockState);
    }

    @Deprecated
    protected void noUnblocking(boolean b) {
        operation.noUnblocking(b);
    }

    @Override
    public final boolean isBlocked() {
        return operation.isBlocked();
    }

}