All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.mdsal.singleton.common.api;

import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.yangtools.concepts.Identifiable;

/**
 * {@link ClusterSingletonService} interface represents a single cluster service instance. It has to implement
 * every service (RPCs or Applications) which would like to be instantiated on same Cluster Node. Grouping is
 * realized by ServiceGroupIdentifier. Servicies with same ServiceGroupIdentifier have to run on same Cluster
 * Node. ServiceGroupIdentifier must not change during whole {@link ClusterSingletonService} lifecycle.
 */
public interface ClusterSingletonService extends Identifiable {

    /**
     * This method is invoked to instantiate an underlying service instance when
     * ownership has been granted for the service entity.
     */
    void instantiateServiceInstance();

    /**
     * This method is invoked to close the underlying service instance when ownership has been lost
     * for the service entity. If the act of closing the instance may perform blocking operations or
     * take some time, it should be done asynchronously to avoid blocking the current thread.
     *
     * @return a ListenableFuture that is completed when the underlying instance close operation is complete.
     */
    ListenableFuture closeServiceInstance();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy