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%2FWorkMonitor.java;h=83ba0c7c191c0ddb91849a9d9b73bd238511e9cf;hp=ed54c88a9e42bdf2afb1071678cea75f8d8d53a6;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/ua/WorkMonitor.java b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/ua/WorkMonitor.java index ed54c88a9..83ba0c7c1 100644 --- a/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/ua/WorkMonitor.java +++ b/bundles/org.simantics.utils.thread/src/org/simantics/utils/threads/ua/WorkMonitor.java @@ -1,59 +1,59 @@ -/******************************************************************************* - * 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; - - -/** - * Asynchronous work monitor object. - * - * @author Toni Kalajainen (toni.kalajainen@vtt.fi) - */ -public interface WorkMonitor extends IStatefulObject { - - /** - * Get the command - * - * @return runnable instance of the work - */ - Runnable getRunnable(); - - /** - * Attempts to cancel execution of this task. This attempt will - * fail if the task has already completed, has already been cancelled, - * or could not be cancelled for some other reason. If successful, - * and this task has not started when cancel is called, - * this task should never run. If the task has already started, - * then the mayInterruptIfRunning parameter determines - * whether the thread executing this task should be interrupted in - * an attempt to stop the task. - * - *

After this method returns, subsequent calls to {@link #isDone} will - * always return true. Subsequent calls to {@link #isCancelled} - * will always return true if this method returned true. - * - * @param mayInterruptIfRunning true if the thread executing this - * task should be interrupted; otherwise, in-progress tasks are allowed - * to complete - * @return false if the task could not be cancelled, - * typically because it has already completed normally; - * true otherwise - */ - boolean cancel(boolean mayInterruptIfRunning); - - /** - * Get error that occured during execution of the runnable. - * @return run-time exception - */ - RuntimeException 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; + + +/** + * Asynchronous work monitor object. + * + * @author Toni Kalajainen (toni.kalajainen@vtt.fi) + */ +public interface WorkMonitor extends IStatefulObject { + + /** + * Get the command + * + * @return runnable instance of the work + */ + Runnable getRunnable(); + + /** + * Attempts to cancel execution of this task. This attempt will + * fail if the task has already completed, has already been cancelled, + * or could not be cancelled for some other reason. If successful, + * and this task has not started when cancel is called, + * this task should never run. If the task has already started, + * then the mayInterruptIfRunning parameter determines + * whether the thread executing this task should be interrupted in + * an attempt to stop the task. + * + *

After this method returns, subsequent calls to {@link #isDone} will + * always return true. Subsequent calls to {@link #isCancelled} + * will always return true if this method returned true. + * + * @param mayInterruptIfRunning true if the thread executing this + * task should be interrupted; otherwise, in-progress tasks are allowed + * to complete + * @return false if the task could not be cancelled, + * typically because it has already completed normally; + * true otherwise + */ + boolean cancel(boolean mayInterruptIfRunning); + + /** + * Get error that occured during execution of the runnable. + * @return run-time exception + */ + RuntimeException getError(); + +}