Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 46bad0fb8b694698cc41e6d3b99151c0cee5f320 (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
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.text;

/**
 * Interface for text related objects which may be used in the multi-threaded
 * context and thus must provide a way to prevent concurrent access and
 * manipulation.
 * <p>
 * In order to reduce the probability of dead locks clients should synchronize
 * their access to these objects by using the provided lock object rather than
 * the object itself.</p>
 * <p>
 * Managing objects can use the <code>setLockObject</code> method in order to
 * synchronize whole sets of objects.</p>
 *
 * @since 3.0
 */
public interface ISynchronizable {

    /**
	 * Sets the lock object for this object. If the lock object is not
	 * <code>null</code> subsequent calls to specified methods of this object
	 * are synchronized on this lock object. Which methods are synchronized is
	 * specified by the implementer.
	 * <p>
	 * <em>You should not override an existing lock object unless you own
	 * that lock object yourself. Use the existing lock object instead.</em>
	 * </p>
	 *
	 * @param lockObject the lock object. May be <code>null</code>.
	 */
    void setLockObject(Object lockObject);

    /**
	 * Returns the lock object or <code>null</code> if there is none. Clients
	 * should use the lock object in order to synchronize concurrent access to
	 * the implementer.
	 *
	 * @return the lock object or <code>null</code>
	 */
    Object getLockObject();
}

Back to the top