@Override protected Procedure<ProcEnv>[] execute(ProcEnv env) throws ProcedureYieldException, ProcedureSuspendedException, InterruptedException { if (STEP == 0) { STEP = 1; setTimeout(60 * 60 * 1000); setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT); skipPersistence(); throw new ProcedureSuspendedException(); } else if (STEP == 1) { STEP = 2; if (hasTimeout()) { setFailure("Should not persist the timeout value", new IOException("Should not persist the timeout value")); return null; } setTimeout(2 * 1000); setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT); // used to confirm that we reset the persist flag before execution throw new ProcedureSuspendedException(); } else { if (!hasTimeout()) { setFailure("Should have persisted the timeout value", new IOException("Should have persisted the timeout value")); } return null; } }
@Override protected Procedure<ProcEnv>[] execute(ProcEnv env) throws ProcedureYieldException, ProcedureSuspendedException, InterruptedException { if (STEP == 0) { STEP = 1; setTimeout(60 * 60 * 1000); setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT); skipPersistence(); throw new ProcedureSuspendedException(); } else if (STEP == 1) { STEP = 2; if (hasTimeout()) { setFailure("Should not persist the timeout value", new IOException("Should not persist the timeout value")); return null; } setTimeout(2 * 1000); setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT); // used to confirm that we reset the persist flag before execution throw new ProcedureSuspendedException(); } else { if (!hasTimeout()) { setFailure("Should have persisted the timeout value", new IOException("Should have persisted the timeout value")); } return null; } }