2 * Copyright (c) 2014 Brocade Communications Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.datastore.messages;
10 import static java.util.Objects.requireNonNull;
12 import java.util.Optional;
13 import java.util.SortedSet;
14 import javax.annotation.Nullable;
15 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
16 import org.opendaylight.controller.cluster.datastore.ReadWriteShardDataTreeTransaction;
19 * Transaction ReadyTransaction message that is forwarded to the local Shard from the ShardTransaction.
21 * @author Thomas Pantelis
23 public class ForwardedReadyTransaction {
24 private final TransactionIdentifier transactionId;
25 private final ReadWriteShardDataTreeTransaction transaction;
26 private final boolean doImmediateCommit;
27 private final short txnClientVersion;
29 private final SortedSet<String> participatingShardNames;
31 public ForwardedReadyTransaction(TransactionIdentifier transactionId, short txnClientVersion,
32 ReadWriteShardDataTreeTransaction transaction, boolean doImmediateCommit,
33 Optional<SortedSet<String>> participatingShardNames) {
34 this.transactionId = requireNonNull(transactionId);
35 this.transaction = requireNonNull(transaction);
36 this.txnClientVersion = txnClientVersion;
37 this.doImmediateCommit = doImmediateCommit;
38 this.participatingShardNames = requireNonNull(participatingShardNames).orElse(null);
41 public TransactionIdentifier getTransactionId() {
45 public ReadWriteShardDataTreeTransaction getTransaction() {
49 public short getTxnClientVersion() {
50 return txnClientVersion;
53 public boolean isDoImmediateCommit() {
54 return doImmediateCommit;
57 public Optional<SortedSet<String>> getParticipatingShardNames() {
58 return Optional.ofNullable(participatingShardNames);
62 public String toString() {
63 return "ForwardedReadyTransaction [transactionId=" + transactionId + ", transaction=" + transaction
64 + ", doImmediateCommit=" + doImmediateCommit + ", participatingShardNames=" + participatingShardNames
65 + ", txnClientVersion=" + txnClientVersion + "]";