From: Colin Dixon Date: Fri, 29 Jul 2016 22:26:32 +0000 (-0700) Subject: Fixed Checkstyle violation errors in mdsal-common-api X-Git-Tag: release/carbon~244 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=fccffa7abd9d12d3269000b4844d00c35799e156;p=mdsal.git Fixed Checkstyle violation errors in mdsal-common-api removed SupressWarning for CheckStyle violation errors changed checkStyleViolationSeverity=error to warning as per code review comments Implimented some more code review comments, reverted back to checkStyleViolationSeverity=error from warning. Change-Id: I0b79f06ba6056d0813e8ddf7bad8896e7931b1e6 Signed-off-by: Brinda Jana Signed-off-by: Colin Dixon --- diff --git a/common/mdsal-common-api/pom.xml b/common/mdsal-common-api/pom.xml index fb9a0287d1..888200aa5e 100644 --- a/common/mdsal-common-api/pom.xml +++ b/common/mdsal-common-api/pom.xml @@ -40,6 +40,18 @@ + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + checkstyle.violationSeverity=error + + + + + scm:git:http://git.opendaylight.org/gerrit/mdsal.git scm:git:ssh://git.opendaylight.org:29418/mdsal.git diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataBroker.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataBroker.java index 4da63ebb6a..a441f52881 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataBroker.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataBroker.java @@ -7,11 +7,10 @@ */ package org.opendaylight.mdsal.common.api; -import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.Path; + /** - * * Base interface that provides access to a conceptual data tree store and also provides the ability * to subscribe for changes to data under a given branch of the tree. * @@ -49,16 +48,11 @@ import org.opendaylight.yangtools.concepts.Path; public interface AsyncDataBroker

, D> extends AsyncDataTransactionFactory { - /** - * {@inheritDoc} - */ + @Override AsyncReadTransaction newReadOnlyTransaction(); - /** - * {@inheritDoc} - */ @Override AsyncWriteTransaction newWriteOnlyTransaction(); } diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataTransactionFactory.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataTransactionFactory.java index ea59a07eb2..8d629b77f4 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataTransactionFactory.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncDataTransactionFactory.java @@ -9,6 +9,7 @@ package org.opendaylight.mdsal.common.api; import org.opendaylight.yangtools.concepts.Path; + /** * A factory which allocates new transactions to operate on the data tree. * @@ -42,6 +43,7 @@ import org.opendaylight.yangtools.concepts.Path; * example, implementations may optimize the transaction for reading if they know ahead of time that * you only need to read data - such as not keeping additional meta-data, which may be required for * write transactions. + * *

* Implementation Note: This interface is not intended to be implemented by users of MD-SAL, * but only to be consumed by them. @@ -57,6 +59,7 @@ public interface AsyncDataTransactionFactory

, D> { /** * Allocates a new read-only transaction which provides an immutable snapshot of * the data tree. + * *

* The view of data tree is an immutable snapshot of current data tree state when * transaction was allocated. @@ -78,6 +81,7 @@ public interface AsyncDataTransactionFactory

, D> { * Since this transaction does not provide a view of the data it SHOULD BE used only by callers * which are exclusive writers (exporters of data) to the subtree they modify. This prevents * optimistic lock failures as described in {@link AsyncWriteTransaction#submit()}. + * *

* Exclusivity of writers to particular subtree SHOULD BE enforced by external locking * mechanism. diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncReadTransaction.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncReadTransaction.java index 258e34eed0..7fe45b8b0a 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncReadTransaction.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncReadTransaction.java @@ -9,8 +9,8 @@ package org.opendaylight.mdsal.common.api; import org.opendaylight.yangtools.concepts.Path; + /** - * * Marker interface for stateful read view of the data tree. * *

@@ -28,15 +28,11 @@ import org.opendaylight.yangtools.concepts.Path; *

  * txRead = broker.newReadOnlyTransaction(); // read Transaction is snapshot of data
  * txWrite = broker.newReadWriteTransactoin(); // concurrent write transaction
- * 
  * txRead.read(OPERATIONAL, PATH).get(); // will return Optional containing A
  * txWrite = broker.put(OPERATIONAL, PATH, B); // writes B to PATH
- * 
  * txRead.read(OPERATIONAL, PATH).get(); // still returns Optional containing A
- * 
  * txWrite.submit().get(); // data tree is updated, PATH contains B
  * txRead.read(OPERATIONAL, PATH).get(); // still returns Optional containing A
- * 
  * txAfterCommit = broker.newReadOnlyTransaction(); // read Transaction is snapshot of new state
  * txAfterCommit.read(OPERATIONAL, PATH).get(); // returns Optional containing B;
  * 
@@ -46,7 +42,8 @@ import org.opendaylight.yangtools.concepts.Path; * after other asynchronous action. Use of blocking call * {@link com.google.common.util.concurrent.ListenableFuture#get()} is discouraged for most uses and * you should use - * {@link com.google.common.util.concurrent.Futures#addCallback(com.google.common.util.concurrent.ListenableFuture, com.google.common.util.concurrent.FutureCallback)} + * {@link com.google.common.util.concurrent.Futures#addCallback(com.google.common.util.concurrent. + * ListenableFuture, com.google.common.util.concurrent.FutureCallback)} * or other functions from {@link com.google.common.util.concurrent.Futures} to register more * specific listeners. * @@ -61,5 +58,5 @@ public interface AsyncReadTransaction

, D> extends AsyncTransac * */ @Override - public void close(); + void close(); } diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncTransaction.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncTransaction.java index 9d11778c7b..546317ea71 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncTransaction.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncTransaction.java @@ -12,9 +12,7 @@ import org.opendaylight.yangtools.concepts.Path; /** - * * A common parent for all transactions which operate on a conceptual data tree. - * * See derived transaction types for more concrete behavior: *

    *
  • {@link AsyncReadTransaction} - Read capabilities, user is able to read data from data tree
  • diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncWriteTransaction.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncWriteTransaction.java index 06d71ed2e2..c8ef5e4e5c 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncWriteTransaction.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/AsyncWriteTransaction.java @@ -18,11 +18,13 @@ import org.opendaylight.yangtools.concepts.Path; * Initial state of write transaction is a stable snapshot of the current data tree. * The state is captured when the transaction is created and its state and underlying * data tree are not affected by other concurrently running transactions. + * *

    * Write transactions are isolated from other concurrent write transactions. All * writes are local to the transaction and represent only a proposal of state * change for the data tree and it is not visible to any other concurrently running * transaction. + * *

    * Applications make changes to the local data tree in the transaction by via the * put, merge, and delete operations. @@ -31,6 +33,7 @@ import org.opendaylight.yangtools.concepts.Path; * Stores a piece of data at a specified path. This acts as an add / replace * operation, which is to say that whole subtree will be replaced by the * specified data. + * *

    * Performing the following put operations: * @@ -38,7 +41,6 @@ import org.opendaylight.yangtools.concepts.Path; * 1) container { list [ a ] } * 2) container { list [ b ] } * - * * will result in the following data being present: * *

    @@ -48,6 +50,7 @@ import org.opendaylight.yangtools.concepts.Path;
      * Merges a piece of data with the existing data at a specified path. Any pre-existing data
      * which is not explicitly overwritten will be preserved. This means that if you store a container,
      * its child lists will be merged.
    + *
      * 

    * Performing the following merge operations: * @@ -55,26 +58,27 @@ import org.opendaylight.yangtools.concepts.Path; * 1) container { list [ a ] } * 2) container { list [ b ] } *

    - * * will result in the following data being present: * *
      * container { list [ a, b ] }
      * 
    - * * This also means that storing the container will preserve any * augmentations which have been attached to it. * *

    Delete operation

    * Removes a piece of data from a specified path. + * *

    * After applying changes to the local data tree, applications publish the changes proposed in the * transaction by calling {@link #submit} on the transaction. This seals the transaction * (preventing any further writes using this transaction) and submits it to be * processed and applied to global conceptual data tree. + * *

    * The transaction commit may fail due to a concurrent transaction modifying and committing data in * an incompatible way. See {@link #submit} for more concrete commit failure examples. + * *

    * Implementation Note: This interface is not intended to be implemented * by users of MD-SAL, but only to be consumed by them. @@ -88,12 +92,9 @@ import org.opendaylight.yangtools.concepts.Path; public interface AsyncWriteTransaction

    , D> extends AsyncTransaction { /** * Cancels the transaction. - * * Transactions can only be cancelled if it was not yet submited. - * * Invoking cancel() on failed or already canceled will have no effect, and transaction is * considered cancelled. - * * Invoking cancel() on finished transaction (future returned by {@link #submit()} already * successfully completed) will always fail (return false). * @@ -116,24 +117,26 @@ public interface AsyncWriteTransaction

    , D> extends AsyncTransa /** * Submits this transaction to be asynchronously applied to update the logical data tree. The * returned CheckedFuture conveys the result of applying the data changes. + * *

    * Note: It is strongly recommended to process the CheckedFuture result in an * asynchronous manner rather than using the blocking get() method. See example usage below. + * *

    * This call logically seals the transaction, which prevents the client from further changing * data tree using this transaction. Any subsequent calls to * put(LogicalDatastoreType, Path, Object), * merge(LogicalDatastoreType, Path, Object), * delete(LogicalDatastoreType, Path) will fail with {@link IllegalStateException}. - * * The transaction is marked as submitted and enqueued into the data store back-end for * processing. * *

    * Whether or not the commit is successful is determined by versioning of the data tree and * validation of registered commit participants if the transaction changes the data tree. + * *

    - * The effects of a successful commit of data depends on listeners + * The effects of a successful commit of data depends on listeners * and commit participants that are registered with the data * broker. *

    Example usage:

    @@ -141,16 +144,13 @@ public interface AsyncWriteTransaction

    , D> extends AsyncTransa *

          *  private void doWrite( final int tries ) {
          *      WriteTransaction writeTx = dataBroker.newWriteOnlyTransaction();
    -     * 
          *      MyDataObject data = ...;
          *      InstanceIdentifier<MyDataObject> path = ...;
          *      writeTx.put( LogicalDatastoreType.OPERATIONAL, path, data );
    -     * 
          *      Futures.addCallback( writeTx.submit(), new FutureCallback<Void>() {
          *          public void onSuccess( Void result ) {
          *              // succeeded
          *          }
    -     * 
          *          public void onFailure( Throwable t ) {
          *              if( t instanceof OptimisticLockFailedException ) {
          *                  if( ( tries - 1 ) > 0 ) {
    @@ -169,6 +169,7 @@ public interface AsyncWriteTransaction

    , D> extends AsyncTransa *

    * *

    Failure scenarios

    + * *

    * Transaction may fail because of multiple reasons, such as *

      @@ -187,13 +188,11 @@ public interface AsyncWriteTransaction

      , D> extends AsyncTransa *

    * *

    Change compatibility

    - * * There are several sets of changes which could be considered incompatible between two * transactions which are derived from same initial state. Rules for conflict detection applies * recursively for each subtree level. * *

    Change compatibility of leafs, leaf-list items

    - * * Following table shows state changes and failures between two concurrent transactions, which * are based on same initial state, Tx 1 completes successfully before Tx 2 is submitted. * @@ -271,7 +270,6 @@ public interface AsyncWriteTransaction

    , D> extends AsyncTransa * * *

    Change compatibility of subtrees

    - * * Following table shows state changes and failures between two concurrent transactions, which * are based on same initial state, Tx 1 completes successfully before Tx 2 is submitted. * @@ -438,25 +436,20 @@ public interface AsyncWriteTransaction

    , D> extends AsyncTransa *

    Examples of failure scenarios

    * *

    Conflict of two transactions

    - * * This example illustrates two concurrent transactions, which derived from same initial state * of data tree and proposes conflicting modifications. * *
          * txA = broker.newWriteTransaction(); // allocates new transaction, data tree is empty
          * txB = broker.newWriteTransaction(); // allocates new transaction, data tree is empty
    -     * 
          * txA.put(CONFIGURATION, PATH, A);    // writes to PATH value A
          * txB.put(CONFIGURATION, PATH, B)     // writes to PATH value B
    -     * 
          * ListenableFuture futureA = txA.submit(); // transaction A is sealed and submitted
          * ListenebleFuture futureB = txB.submit(); // transaction B is sealed and submitted
          * 
    - * * Commit of transaction A will be processed asynchronously and data tree will be updated to * contain value A for PATH. Returned {@link ListenableFuture} will * successfully complete once state is applied to data tree. - * * Commit of Transaction B will fail, because previous transaction also modified path in a * concurrent way. The state introduced by transaction B will not be applied. Returned * {@link ListenableFuture} object will fail with {@link OptimisticLockFailedException} diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/DataValidationFailedException.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/DataValidationFailedException.java index cab7290bc4..f5059f7637 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/DataValidationFailedException.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/DataValidationFailedException.java @@ -7,19 +7,16 @@ */ package org.opendaylight.mdsal.common.api; +import com.google.common.base.Preconditions; import org.opendaylight.yangtools.concepts.Path; import org.opendaylight.yangtools.yang.common.RpcError.ErrorType; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; -import com.google.common.base.Preconditions; /** - * * Failure of asynchronous transaction commit caused by invalid data. - * * This exception is raised and returned when transaction commit * failed, because other data submitted via transactions - * * Clients usually are not able recover from this error condition by * retrieving same transaction, since data introduced by this transaction * are invalid. @@ -29,9 +26,9 @@ public class DataValidationFailedException extends TransactionCommitFailedExcept private static final long serialVersionUID = 1L; - private Path path; + private final Path path; - private Class> pathType; + private final Class> pathType; public

    > DataValidationFailedException(final Class

    pathType,final P path, final String message, final Throwable cause) { diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/LogicalDatastoreType.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/LogicalDatastoreType.java index af9512d036..a44eafe127 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/LogicalDatastoreType.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/LogicalDatastoreType.java @@ -12,7 +12,6 @@ public enum LogicalDatastoreType { /** * Logical atastore representing operational state of the system * and it's components - * * This datastore is used to describe operational state of * the system and it's operation related data. * @@ -21,7 +20,6 @@ public enum LogicalDatastoreType { /** * Logical Datastore representing configuration state of the system * and it's components. - * * This datastore is used to describe intended state of * the system and intended operation mode. * diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/OptimisticLockFailedException.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/OptimisticLockFailedException.java index 1e5b70c7fe..a5d2c11dfe 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/OptimisticLockFailedException.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/OptimisticLockFailedException.java @@ -8,18 +8,16 @@ package org.opendaylight.mdsal.common.api; -import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.opendaylight.yangtools.yang.common.RpcError.ErrorType; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; + /** -* * Failure of asynchronous transaction commit caused by failure * of optimistic locking. -* * This exception is raised and returned when transaction commit * failed, because other transaction finished successfully * and modified same data as failed transaction. -* * Clients may recover from this error condition by * retrieving current state and submitting new updated * transaction. diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/PostCanCommitStep.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/PostCanCommitStep.java index 05e09a8275..eac087d2cf 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/PostCanCommitStep.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/PostCanCommitStep.java @@ -14,9 +14,7 @@ import com.google.common.util.concurrent.ListenableFuture; import javax.annotation.Nonnull; /** - * * User implementation of steps following can-commit in three phase protocol. - * * If no additional visibility into transaction and data being aborted or committed is needed, use * {@link #NOOP} implementation. * @@ -26,7 +24,6 @@ public interface PostCanCommitStep extends ThreePhaseCommitStep { /** * No-op implementation of abort, pre-commit and commit steps. - * * This implementation should be used if user logic does only validation of data and does not * need to perform any actions associated with pre-commit, commit or abort. */ @@ -52,7 +49,6 @@ public interface PostCanCommitStep extends ThreePhaseCommitStep { /** * Initiates a pre-commit of associated request - * * Implementation MUST NOT do any blocking calls during this callback, all pre-commit * preparation SHOULD happen asynchronously and MUST result in completing returned future * object. diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/PostPreCommitStep.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/PostPreCommitStep.java index 2941786b41..d3a7760d9d 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/PostPreCommitStep.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/PostPreCommitStep.java @@ -12,7 +12,6 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; /** - * * User implementation of steps following pre-commit from Three-Phase Protocol. * */ @@ -22,7 +21,6 @@ public interface PostPreCommitStep extends ThreePhaseCommitStep { /** * No-op implementation of {@link #abort()} and {@link #commit()} method, which always success * calls. - * * This implementation is intended for users which may not need to implement commit and abort * method. * @@ -45,12 +43,9 @@ public interface PostPreCommitStep extends ThreePhaseCommitStep { ListenableFuture NOOP_FUTURE = Futures.immediateFuture(NOOP); /** - * * Commits cohort transaction. - * * This callback is invoked by three-phase commit coordinator if associated data transaction * finished pre-commit phase and will be commited. - * * Implementation should make state, which were derived by implementation from associated data * visible. * diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/ReadFailedException.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/ReadFailedException.java index d8df889085..bab6ef308f 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/ReadFailedException.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/ReadFailedException.java @@ -21,10 +21,10 @@ public class ReadFailedException extends OperationFailedException { public static final ExceptionMapper MAPPER = new ExceptionMapper("read", ReadFailedException.class) { - @Override - protected ReadFailedException newWithCause(String message, Throwable cause) { - return new ReadFailedException(message, cause); - } + @Override + protected ReadFailedException newWithCause(String message, Throwable cause) { + return new ReadFailedException(message, cause); + } }; public ReadFailedException(String message, RpcError... errors) { diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/ThreePhaseCommitStep.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/ThreePhaseCommitStep.java index 6495c3cba0..3fd8aa8f57 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/ThreePhaseCommitStep.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/ThreePhaseCommitStep.java @@ -15,7 +15,6 @@ import javax.annotation.Nonnull; /** * Common interface for implementing three-phase commit steps. - * * Actual steps to be implemented are: {@link PostCanCommitStep} and {@link PostPreCommitStep} which * allows to customize pre-commit, commit and abort actions. * @@ -27,10 +26,8 @@ public interface ThreePhaseCommitStep { /** * Invoked on transaction aborted. - * * This callback is invoked by three-phase commit coordinator if associated data transaction * will not be commited and is being aborted. - * * Implementation MUST rollback any changes, which were introduced by implementation based on * supplied data. * diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionChain.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionChain.java index c2287442f2..d6ef81c7a7 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionChain.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionChain.java @@ -14,7 +14,6 @@ import org.opendaylight.yangtools.concepts.Path; * sequence and each transaction should see the effects of previous committed transactions * as they occurred. A chain makes no guarantees of atomicity across the chained transactions - * the transactions are committed as soon as possible in the order that they were submitted. - * * This behaviour is different from the default AsyncDataBroker, where a * transaction is always created from the current global state, not taking into * account any transactions previously committed by the calling thread. Due to @@ -29,13 +28,11 @@ import org.opendaylight.yangtools.concepts.Path; * AsyncReadTransaction t2 = broker.newReadOnlyTransaction(); * Optional<?> maybeData = t2.read(id).get(); * - * * it may happen, that it sees maybeData.isPresent() == false, simply because * t1 has not completed the processes of being applied and t2 is actually * allocated from the previous state. This is obviously bad for users who create * incremental state in the datastore and actually read what they write in * subsequent transactions. - * * Using a TransactionChain instead of a broker solves this particular problem, * and leads to expected behavior: t2 will always see the data written in t1 * present. @@ -50,6 +47,7 @@ public interface TransactionChain

    , D> extends AutoCloseable, * The previous write transaction has to be either SUBMITTED * ({@link AsyncWriteTransaction#submit submit} was invoked) or CANCELLED * ({@link #close close} was invoked). + * *

    * The returned read-only transaction presents an isolated view of the data if the previous * write transaction was successful - in other words, this read-only transaction will see the @@ -64,7 +62,7 @@ public interface TransactionChain

    , D> extends AutoCloseable, * if the chain has been closed. */ @Override - public AsyncReadTransaction newReadOnlyTransaction(); + AsyncReadTransaction newReadOnlyTransaction(); /** * Create a new write-only transaction which will continue the chain. @@ -72,13 +70,15 @@ public interface TransactionChain

    , D> extends AutoCloseable, *

    * The previous write transaction has to be either SUBMITTED * ({@link AsyncWriteTransaction#submit submit} was invoked) or CANCELLED - * ({@link #close close} was invoked). + * ({@link #close close} was invoked) + * *

    * The returned write-only transaction presents an isolated view of the data if the previous * write transaction was successful - in other words, this write-only transaction will see the * state changes made by the previous write transaction in the chain. However, state which * was introduced by other transactions outside this transaction chain after creation of - * the previous transaction is not visible. + * the previous transaction is not visible + * *

    * Committing this write-only transaction using {@link AsyncWriteTransaction#submit submit} * will submit the state changes in this transaction to be visible to any subsequent @@ -91,7 +91,7 @@ public interface TransactionChain

    , D> extends AutoCloseable, * if the chain has been closed. */ @Override - public AsyncWriteTransaction newWriteOnlyTransaction(); + AsyncWriteTransaction newWriteOnlyTransaction(); @Override void close(); diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionCommitDeadlockException.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionCommitDeadlockException.java index fd4ea57ff5..b251de1021 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionCommitDeadlockException.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionCommitDeadlockException.java @@ -9,10 +9,14 @@ package org.opendaylight.mdsal.common.api; import com.google.common.base.Supplier; + import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcError.ErrorType; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; + + + /** * A type of TransactionCommitFailedException that indicates a situation that would result in a * threading deadlock. This can occur if a caller that submits a write transaction tries to perform @@ -25,10 +29,13 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder; public class TransactionCommitDeadlockException extends TransactionCommitFailedException { private static final long serialVersionUID = 1L; private static final String DEADLOCK_MESSAGE = - "An attempt to block on a ListenableFuture via a get method from a write " + - "transaction submit was detected that would result in deadlock. The commit " + - "result must be obtained asynchronously, e.g. via Futures#addCallback, to avoid deadlock."; - private static final RpcError DEADLOCK_RPCERROR = RpcResultBuilder.newError(ErrorType.APPLICATION, "lock-denied", DEADLOCK_MESSAGE); + "An attempt to block on a ListenableFuture via a get method from a write " + + + "transaction submit was detected that would result in deadlock. The commit " + + + "result must be obtained asynchronously, e.g. via Futures#addCallback, to avoid deadlock."; + private static final RpcError DEADLOCK_RPCERROR = + RpcResultBuilder.newError(ErrorType.APPLICATION, "lock-denied", DEADLOCK_MESSAGE); public static final Supplier DEADLOCK_EXCEPTION_SUPPLIER = new Supplier() { @Override diff --git a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionCommitFailedException.java b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionCommitFailedException.java index 00c0a746a2..8367911b45 100644 --- a/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionCommitFailedException.java +++ b/common/mdsal-common-api/src/main/java/org/opendaylight/mdsal/common/api/TransactionCommitFailedException.java @@ -11,9 +11,7 @@ import org.opendaylight.yangtools.yang.common.OperationFailedException; import org.opendaylight.yangtools.yang.common.RpcError; /** - * - * Failed commit of asynchronous transaction - * + * Failed commit of asynchronous transaction. * This exception is raised and returned when transaction commit * failed. * diff --git a/common/pom.xml b/common/pom.xml index 600ce40151..0baa38c5d0 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -36,7 +36,6 @@ mdsal-common-api -