1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.jface.text; 12 13 /** 14 * Interface for text related objects which may be used in the multi-threaded 15 * context and thus must provide a way to prevent concurrent access and 16 * manipulation. 17 * <p> 18 * In order to reduce the probability of dead locks clients should synchronize 19 * their access to these objects by using the provided lock object rather than 20 * the object itself.</p> 21 * <p> 22 * Managing objects can use the <code>setLockObject</code> method in order to 23 * synchronize whole sets of objects.</p> 24 * 25 * @since 3.0 26 */ 27 public interface ISynchronizable { 28 29 /** 30 * Sets the lock object for this object. If the lock object is not 31 * <code>null</code> subsequent calls to specified methods of this object 32 * are synchronized on this lock object. Which methods are synchronized is 33 * specified by the implementer. 34 * <p> 35 * <em>You should not override an existing lock object unless you own 36 * that lock object yourself. Use the existing lock object instead.</em> 37 * </p> 38 * 39 * @param lockObject the lock object. May be <code>null</code>. 40 */ 41 void setLockObject(Object lockObject); 42 43 /** 44 * Returns the lock object or <code>null</code> if there is none. Clients 45 * should use the lock object in order to synchronize concurrent access to 46 * the implementer. 47 * 48 * @return the lock object or <code>null</code> 49 */ 50 Object getLockObject(); 51 } 52