| 18 | import org.jetbrains.annotations.Nullable; |
| 19 | |
| 20 | public class OnzProcedure implements FuncLong { |
| 21 | private static final @NotNull Logger logger = LogManager.getLogger(OnzProcedure.class); |
| 22 | private final BFuncProcedure.Data funcArgument; |
| 23 | private final OnzProcedureStub<?, ?> stub; |
| 24 | private final Bean argument; |
| 25 | private final Bean result; |
| 26 | private final Rpc<?, ?> rpc; |
| 27 | private volatile TaskCompletionSource<Boolean> commitFuture; |
| 28 | |
| 29 | public Rpc<?, ?> getRpc() { |
| 30 | return rpc; |
| 31 | } |
| 32 | |
| 33 | public OnzProcedure(Rpc<?, ?> rpc, |
| 34 | BFuncProcedure.Data funcArgument, |
| 35 | OnzProcedureStub<?, ?> stub, Bean argument, Bean result) { |
| 36 | this.rpc = rpc; |
| 37 | this.funcArgument = funcArgument; |
| 38 | this.stub = stub; |
| 39 | this.argument = argument; |
| 40 | this.result = result; |
| 41 | } |
| 42 | |
| 43 | public int getFlushMode() { |
| 44 | return funcArgument.getFlushMode(); |
| 45 | } |
| 46 | |
| 47 | public long getOnzTid() { |
| 48 | return funcArgument.getOnzTid(); |
| 49 | } |
| 50 | |
| 51 | public OnzProcedureStub<?, ?> getStub() { |
| 52 | return stub; |
| 53 | } |
| 54 | |
| 55 | public Bean getArgument() { |
| 56 | return argument; |
| 57 | } |
| 58 | |
| 59 | public Bean getResult() { |
| 60 | return result; |
| 61 | } |
| 62 | |
| 63 | public boolean isEnd() { |
| 64 | return true; |
| 65 | } |
| 66 | |
| 67 | @Override |
| 68 | public long call() throws Exception { |
| 69 | // 这里实际上需要侵入Zeze.Transaction,在锁定,时戳检查完成后, |
| 70 | // 发送result给调用者,完成ready状态, |
| 71 | // Zeze.Transaction 需要同步进行等待。 |
| 72 | |
| 73 | var txn = Transaction.getCurrent(); |
| 74 | if (null == txn) |
| 75 | throw new RuntimeException("no transaction."); |
| 76 | txn.setOnzProcedure(this); |
| 77 | return stub.call(this, argument, result); |
nothing calls this directly
no outgoing calls
no test coverage detected