Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1a77cc4a86cc86e506efde6838a8e74842d59ec8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*****************************************************************************
 * Copyright (c) 2015 Christian W. Damus 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
 *
 * Contributors:
 *   Christian W. Damus - Initial API and implementation
 *   
 *****************************************************************************/

package org.eclipse.papyrus.infra.sync.service;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.papyrus.infra.core.services.IService;
import org.eclipse.papyrus.infra.sync.EMFDispatch;
import org.eclipse.papyrus.infra.sync.EMFDispatchManager;
import org.eclipse.papyrus.infra.sync.ISyncObject;
import org.eclipse.papyrus.infra.sync.policy.ISyncPolicy;

/**
 * A Papyrus Service providing EMF dispatch managers, synchronization registries, and other synchronization facilities.
 */
public interface ISyncService extends ISyncObject, IService {
	<D extends EMFDispatch> EMFDispatchManager<D> createSingleDispatchManager();

	<D extends EMFDispatch> EMFDispatchManager<D> createMultipleDispatchManager();

	IStatus evaluateTriggers(Object object);

	/**
	 * Obtains the sync service's current synchronization policy.
	 * 
	 * @return the synchronization policy. Never {@code null}
	 */
	ISyncPolicy getSyncPolicy();

	/**
	 * Sets the effective synchronization policy for the sync service.
	 * 
	 * @param syncPolicy
	 *            the new sync policy, or {@code null} to install a non-policy (meaning that everything is always synchronized)
	 */
	void setSyncPolicy(ISyncPolicy syncPolicy);

	/**
	 * Obtains the executor service on which to schedule asynchronous {@link SyncServiceRunnable}s.
	 * 
	 * @return the asynchronous execution service; never {@code null}
	 * 
	 * @see #setAsyncExecutor(Executor)
	 */
	Executor getAsyncExecutor();

	/**
	 * Sets the executor service on which to schedule asynchronous {@link SyncServiceRunnable}s.
	 * If different from the {@linkplain #getAsyncExecutor() current executor}, the current executor will be
	 * {@linkplain ExecutorService#shutdown() shut down} if it is an {@link ExecutorService}.
	 * 
	 * @param executor
	 *            the asynchronous execution service; must not be {@code null}
	 * 
	 * @see #getAsyncExecutor()
	 */
	void setAsyncExecutor(Executor executor);
}

Back to the top