f1696c984a816ecec73878661a5600322bfbd772
[mdsal.git] / singleton-service / mdsal-singleton-common-api / src / main / java / org / opendaylight / mdsal / singleton / common / api / ClusterSingletonServiceProvider.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
9 package org.opendaylight.mdsal.singleton.common.api;
10
11 /**
12  * {@link ClusterSingletonServiceProvider} provides a functionality to register and group services
13  * {@link ClusterSingletonService} by service group identifier. Services could be Applications or RPCs.
14  * Provider provides a functionality which allows to have only one fully instantiated service instance
15  * in a cluster at one time and service group means to have all service instances for the same group
16  * situated on same Cluster Node. This is realized via a double candidate approach where a service
17  * group instance maintains a candidate registration for ownership of the service group entity in the
18  * cluster and also a registration that acts as a guard to ensure a service group instance has fully
19  * closed prior to relinquishing service group ownership. To achieve ownership of the service group,
20  * a service group candidate must hold ownership of both these entities.
21  */
22 public interface ClusterSingletonServiceProvider extends AutoCloseable {
23
24     /**
25      * Method registers {@link ClusterSingletonService} to Provider.
26      *
27      * @param service ClusterSingletonService instance
28      * @return {@link AutoCloseable} registration
29      */
30     ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service);
31
32 }