c04c9c5071a8262e6978c42acc2fa0be5a837236
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / actors / dds / SingleClientHistory.java
1 /*
2  * Copyright (c) 2016 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.databroker.actors.dds;
9
10 import org.opendaylight.controller.cluster.access.client.AbstractClientConnection;
11 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
12 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15
16 /**
17  * An {@link AbstractClientHistory} which handles free-standing transactions.
18  *
19  * @author Robert Varga
20  */
21 final class SingleClientHistory extends AbstractClientHistory {
22     private static final Logger LOG = LoggerFactory.getLogger(AbstractClientHistory.class);
23
24     SingleClientHistory(final AbstractDataStoreClientBehavior client, final LocalHistoryIdentifier identifier) {
25         super(client, identifier);
26     }
27
28     @Override
29     ClientTransaction doCreateTransaction() {
30         final TransactionIdentifier txId = new TransactionIdentifier(getIdentifier(), nextTx());
31         LOG.debug("{}: creating a new transaction {}", this, txId);
32
33         return new ClientTransaction(this, txId);
34     }
35
36     @Override
37     ProxyHistory createHistoryProxy(final LocalHistoryIdentifier historyId,
38             final AbstractClientConnection<ShardBackendInfo> connection) {
39         return ProxyHistory.createSingle(connection, historyId);
40     }
41 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.