Removed checkstyle warnings.
[bgpcep.git] / programming / spi / src / main / java / org / opendaylight / bgpcep / programming / spi / Instruction.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.bgpcep.programming.spi;
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.InstructionStatus;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev130930.instruction.status.changed.Details;
12
13 /**
14  *
15  */
16 public interface Instruction {
17     /**
18      * Instruction executors are required to call this method prior to starting executing on the instruction.
19      * Implementations of this method are required to transition into Executing state and return true, or into Cancelled
20      * state and return false.
21      *
22      * @return Indication whether the instruction execution should proceed.
23      */
24     boolean checkedExecutionStart();
25
26     /**
27      * Instruction executors can inform about execution hold ups which prevent an otherwise-ready instruction from
28      * executing by calling this method. It is recommended they check the return of this method to detect if a
29      * cancellation occurred asynchronously.
30      *
31      * @param details Details which execution is held up
32      * @return Indication whether the instruction execution should proceed. If this method returns false, all subsequent
33      *         calls to this method as well as {@link checkedExecutionStart()} will return false.
34      */
35     boolean executionHeldUp(Details details);
36
37     /**
38      * Instruction executors are required to call this method when execution has finished to provide the execution
39      * result to the end.
40      *
41      * @param status Execution result
42      * @param details Execution result details
43      */
44     void executionCompleted(InstructionStatus status, Details details);
45 }