From 1cacf4bb5e8db7aca59bd8d8d665a42d372819f6 Mon Sep 17 00:00:00 2001 From: Sebastian Zarnekow Date: Mon, 11 Feb 2013 13:46:14 +0100 Subject: [PATCH] [xtext][resource] Missing artifact: ISynchronizable --- .../xtext/resource/ISynchronizable.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 plugins/org.eclipse.xtext/src/org/eclipse/xtext/resource/ISynchronizable.java diff --git a/plugins/org.eclipse.xtext/src/org/eclipse/xtext/resource/ISynchronizable.java b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/resource/ISynchronizable.java new file mode 100644 index 000000000..a27f15d9f --- /dev/null +++ b/plugins/org.eclipse.xtext/src/org/eclipse/xtext/resource/ISynchronizable.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2013 itemis AG (http://www.itemis.eu) 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.eclipse.xtext.resource; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.xtext.util.concurrent.IUnitOfWork; + +import com.google.common.annotations.Beta; + +/** + * Implementations of {@link ISynchronizable} expose a lock object + * that allows to guard against concurrent modifications. + * + * @author Sebastian Zarnekow - Initial contribution and API + * @since 2.4 + */ +@Beta +@NonNullByDefault +public interface ISynchronizable> { + + /** + * Exposes the coarse grained lock for this {@link ISynchronizable}. + * @return the lock instance. + */ + Object getLock(); + + /** + * Execute the unit of work in a context that allows for modification. + * @param unit the action to perform. May not be null + * @exception Exception the exception that was thrown by the unit. + */ + Result execute(IUnitOfWork unit) throws Exception; + +}