blob: d05f3b912f9158bb4fde19eddca10d96ef8120a8 [file] [log] [blame]
Madan Jampanie5723dc2015-08-31 14:23:58 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.store.service;
17
18import java.util.concurrent.CompletableFuture;
19import java.util.concurrent.Executor;
20
21/**
22 * Service for mutually exclusive job execution.
23 */
24public interface MutexExecutionService {
25
26 /**
27 * Runs the specified task in a mutually exclusive fashion.
28 * @param task task to run
29 * @param exclusionPath path on which different instances synchronize
30 * @param executor executor to use for running the task
31 * @return future that is completed when the task execution completes.
32 */
33 CompletableFuture<Void> execute(MutexTask task, String exclusionPath, Executor executor);
34}