f28d0d08b3e0a9e610bda2973da3a3dbc8b6682c
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / ReadWriteShardDataTreeTransaction.java
1 /*
2  * Copyright (c) 2015 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.controller.cluster.datastore;
9
10 import com.google.common.base.Preconditions;
11 import java.util.Optional;
12 import java.util.SortedSet;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
15
16 public final class ReadWriteShardDataTreeTransaction extends AbstractShardDataTreeTransaction<DataTreeModification> {
17
18     ReadWriteShardDataTreeTransaction(final ShardDataTreeTransactionParent parent, final TransactionIdentifier id,
19         final DataTreeModification modification) {
20         super(parent, id, modification);
21     }
22
23     ShardDataTreeCohort ready(Optional<SortedSet<String>> participatingShardNames) {
24         Preconditions.checkState(close(), "Transaction is already closed");
25         return getParent().finishTransaction(this, participatingShardNames);
26     }
27 }