2 * Copyright (c) 2015 Cisco 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;
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
13 public final class ReadWriteShardDataTreeTransaction extends AbstractShardDataTreeTransaction<DataTreeModification> {
14 private final ShardDataTreeTransactionParent parent;
16 protected ReadWriteShardDataTreeTransaction(final ShardDataTreeTransactionParent parent, final String id, final DataTreeModification modification) {
17 super(id, modification);
18 this.parent = Preconditions.checkNotNull(parent);
23 Preconditions.checkState(close(), "Transaction is already closed");
25 parent.abortTransaction(this);
28 ShardDataTreeCohort ready() {
29 Preconditions.checkState(close(), "Transaction is already closed");
31 return parent.finishTransaction(this);