Fix lead transaction cancellation
[mdsal.git] / dom / mdsal-dom-spi / src / main / java / org / opendaylight / mdsal / dom / spi / PingPongMergingDOMDataBroker.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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.mdsal.dom.spi;
9
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
12 import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
13 import org.opendaylight.mdsal.dom.api.DOMTransactionChainListener;
14
15 /**
16  * Utility mixin interface for {@link DOMDataBroker}s which realize merging transaction chains via
17  * {@link PingPongTransactionChain}. It provides {@link #createMergingTransactionChain(DOMTransactionChainListener)}
18  * as a default method combining {@link PingPongTransactionChain} with
19  * {@link #createTransactionChain(DOMTransactionChainListener)}.
20  */
21 @Beta
22 public interface PingPongMergingDOMDataBroker extends DOMDataBroker {
23     @Override
24     default DOMTransactionChain createMergingTransactionChain(final DOMTransactionChainListener listener) {
25         return new PingPongTransactionChain(this::createTransactionChain, listener);
26     }
27 }