类 InternalProcedure<Env>

  • 类型参数:
    Env -
    所有已实现的接口:
    java.lang.Comparable<Procedure<Env>>
    直接已知子类:
    CompletedProcedureRecycler

    public abstract class InternalProcedure<Env>
    extends Procedure<Env>
    Internal Procedure, do some preiodic job for framework
    • 构造器详细资料

      • InternalProcedure

        protected InternalProcedure​(long toMillis)
    • 方法详细资料

      • periodicExecute

        protected abstract void periodicExecute​(Env env)
      • execute

        protected Procedure<Env>[] execute​(Env env)
                                    throws ProcedureYieldException,
                                           ProcedureSuspendedException,
                                           java.lang.InterruptedException
        从类复制的说明: Procedure
        The main code of the procedure. It must be idempotent since execute() may be called multiple times in case of machine failure in the middle of the execution.
        指定者:
        execute 在类中 Procedure<Env>
        参数:
        env - the environment passed to the ProcedureExecutor
        返回:
        a set of sub-procedures to run or ourselves if there is more work to do or null if the procedure is done.
        抛出:
        ProcedureYieldException - the procedure will be added back to the queue and retried later.
        ProcedureSuspendedException - Signal to the executor that Procedure has suspended itself and has set itself up waiting for an external event to wake it back up again.
        java.lang.InterruptedException - the procedure will be added back to the queue and retried later.
      • rollback

        protected void rollback​(Env env)
                         throws java.io.IOException,
                                java.lang.InterruptedException
        从类复制的说明: Procedure
        The code to undo what was done by the execute() code. It is called when the procedure or one of the sub-procedures failed or an abort was requested. It should cleanup all the resources created by the execute() call. The implementation must be idempotent since rollback() may be called multiple time in case of machine failure in the middle of the execution.
        指定者:
        rollback 在类中 Procedure<Env>
        参数:
        env - the environment passed to the ProcedureExecutor
        抛出:
        java.io.IOException - temporary failure, the rollback will retry later
        java.lang.InterruptedException - the procedure will be added back to the queue and retried later
      • abort

        protected boolean abort​(Env env)
        从类复制的说明: Procedure
        The abort() call is asynchronous and each procedure must decide how to deal with it, if they want to be abortable. The simplest implementation is to have an AtomicBoolean set in the abort() method and then the execute() will check if the abort flag is set or not. abort() may be called multiple times from the client, so the implementation must be idempotent.

        NOTE: abort() is not like Thread.interrupt(). It is just a notification that allows the procedure implementor abort.

        指定者:
        abort 在类中 Procedure<Env>
      • deserialize

        public void deserialize​(java.nio.ByteBuffer byteBuffer)
        覆盖:
        deserialize 在类中 Procedure<Env>