X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.utils.thread%2Fsrc%2Forg%2Fsimantics%2Futils%2Fthreads%2Fua%2FIStatefulObject.java;h=af2e08bdf8b86861574760d9b8ff2bc039d3646f;hp=c05c064c64855db2f41eace444f7c42462c06ec1;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/ua/IStatefulObject.java b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/ua/IStatefulObject.java index c05c064c6..af2e08bdf 100644 --- a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/ua/IStatefulObject.java +++ b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/ua/IStatefulObject.java @@ -1,70 +1,70 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * 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: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ - -package org.simantics.utils.threads.ua; - -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -/** - * - * - * @author Toni Kalajainen (toni.kalajainen@vtt.fi) - */ -public interface IStatefulObject { - - void addStateListener(StateListener listener); - void removeStateListener(StateListener listener); - StateType getState(); - - /** - * Wait until state changes to one of the given states. - * - * @param set states that ends waiting - * @throws InterruptedException - * @return the state in the given set that broke the wait - */ - StateType waitForState(Set set) - throws InterruptedException, ErrorType; - - /** - * Wait until state changes to one of the given states. - * - * @param set states that ends waiting - * @return the state in the given set that broke the wait - */ - StateType waitForStateUninterruptibly(Set set) - throws ErrorType; - - - /** - * Wait until state changes to one of the given states or until - * time out occurs. - * - * @param set - * @param timeout - * @param unit - * @return state one in set - * @throws InterruptedException thread was interrupted - * @throws TimeoutException timeout occured - */ - StateType waitForState(Set set, long timeout, TimeUnit unit) - throws InterruptedException, TimeoutException, ErrorType; - - /** - * Get error state or null - * @return error - */ - ErrorType getError(); - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * 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: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ + +package org.simantics.utils.threads.ua; + +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +/** + * + * + * @author Toni Kalajainen (toni.kalajainen@vtt.fi) + */ +public interface IStatefulObject { + + void addStateListener(StateListener listener); + void removeStateListener(StateListener listener); + StateType getState(); + + /** + * Wait until state changes to one of the given states. + * + * @param set states that ends waiting + * @throws InterruptedException + * @return the state in the given set that broke the wait + */ + StateType waitForState(Set set) + throws InterruptedException, ErrorType; + + /** + * Wait until state changes to one of the given states. + * + * @param set states that ends waiting + * @return the state in the given set that broke the wait + */ + StateType waitForStateUninterruptibly(Set set) + throws ErrorType; + + + /** + * Wait until state changes to one of the given states or until + * time out occurs. + * + * @param set + * @param timeout + * @param unit + * @return state one in set + * @throws InterruptedException thread was interrupted + * @throws TimeoutException timeout occured + */ + StateType waitForState(Set set, long timeout, TimeUnit unit) + throws InterruptedException, TimeoutException, ErrorType; + + /** + * Get error state or null + * @return error + */ + ErrorType getError(); + +}