From 1abded4fce11629c9b48ab1594c2444927cd7757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= Date: Sun, 1 Oct 2023 23:04:41 +0200 Subject: [PATCH] Format java files in o.e.equinox.concurrent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was achieved by running: eclipse -consolelog -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter \ -config .settings/org.eclipse.jdt.core.prefs . -data `mktemp -d` Signed-off-by: Torbjörn SVENSSON --- .../concurrent/future/AbstractExecutor.java | 16 ++- .../concurrent/future/AbstractFuture.java | 4 +- .../future/AbstractListenableFuture.java | 6 +- .../future/FutureProgressMonitor.java | 19 ++-- .../equinox/concurrent/future/IExecutor.java | 30 +++-- .../equinox/concurrent/future/IFuture.java | 104 ++++++++---------- .../concurrent/future/IListenableFuture.java | 28 ++--- .../concurrent/future/IProgressRunnable.java | 7 +- .../future/ISafeProgressRunner.java | 1 + .../concurrent/future/ImmediateExecutor.java | 6 +- .../future/SingleOperationFuture.java | 37 +++---- .../SingleOperationListenableFuture.java | 12 +- .../concurrent/future/ThreadsExecutor.java | 32 +++--- .../concurrent/future/TimeoutException.java | 1 + 14 files changed, 135 insertions(+), 168 deletions(-) diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractExecutor.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractExecutor.java index bb0e9b2c2ea..8e92a7d94da 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractExecutor.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractExecutor.java @@ -18,6 +18,7 @@ /** * Abstract implementation of {@link IExecutor} and {@link IRunnableExecutor}. + * * @since 1.1 * */ @@ -32,21 +33,18 @@ public Object run(IProgressMonitor monitor) throws Exception { }, null); } - public abstract IFuture execute( - IProgressRunnable runnable, + public abstract IFuture execute(IProgressRunnable runnable, IProgressMonitor monitor); /** - * Create an {@link AbstractFuture} instance. Subclasses must override to - * define the concrete type of future to return from + * Create an {@link AbstractFuture} instance. Subclasses must override to define + * the concrete type of future to return from * {@link #execute(IProgressRunnable, IProgressMonitor)}. * - * @param progressMonitor - * any progress monitor to provide to the future upon - * construction. May be null. + * @param progressMonitor any progress monitor to provide to the future upon + * construction. May be null. * @return the created future */ - protected abstract AbstractFuture createFuture( - IProgressMonitor progressMonitor); + protected abstract AbstractFuture createFuture(IProgressMonitor progressMonitor); } diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractFuture.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractFuture.java index f40fc9698fa..0130d17cd05 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractFuture.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractFuture.java @@ -18,10 +18,10 @@ /** * Abstract implementation of {@link IFuture} and {@link ISafeProgressRunner}. + * * @since 1.1 */ -public abstract class AbstractFuture implements - IFuture, ISafeProgressRunner { +public abstract class AbstractFuture implements IFuture, ISafeProgressRunner { /** * Returns true if this future has been previously canceled, diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractListenableFuture.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractListenableFuture.java index eaadad3f6f8..43772882d37 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractListenableFuture.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/AbstractListenableFuture.java @@ -17,10 +17,8 @@ * @since 1.1 */ @SuppressWarnings("rawtypes") -public abstract class AbstractListenableFuture extends AbstractFuture implements - IListenableFuture { +public abstract class AbstractListenableFuture extends AbstractFuture implements IListenableFuture { - public abstract void addListener(IProgressRunnable progressRunnable, - IExecutor executor); + public abstract void addListener(IProgressRunnable progressRunnable, IExecutor executor); } diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/FutureProgressMonitor.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/FutureProgressMonitor.java index 6cda31690b6..c16bfaaf5f3 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/FutureProgressMonitor.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/FutureProgressMonitor.java @@ -21,6 +21,7 @@ * wrapper for potentially two progress monitors: one provided by the * {@link IFuture} client in a method call, the other (a child progress monitor) * provided by the IExecutor that creates the future instance. + * * @since 1.1 * */ @@ -30,12 +31,11 @@ public class FutureProgressMonitor extends ProgressMonitorWrapper { private Object lock = new Object(); /** - * Create a new progress monitor wrapping the given monitor. The nested - * monitor is the one exposed to clients of futures. + * Create a new progress monitor wrapping the given monitor. The nested monitor + * is the one exposed to clients of futures. * - * @param progressMonitor - * the client-facing monitor used with a future. May be - * null. + * @param progressMonitor the client-facing monitor used with a future. May be + * null. * * @see #setChildProgressMonitor(IProgressMonitor) */ @@ -102,11 +102,10 @@ public void worked(int work) { /** * Set the client-facing progress monitor to the given value. * - * @param value - * a second (child) monitor to report progress/take cancelation - * from. If the parent progress monitor has been previously - * canceled, the child progress monitor's setCanceled method will - * be called. + * @param value a second (child) monitor to report progress/take cancelation + * from. If the parent progress monitor has been previously + * canceled, the child progress monitor's setCanceled method will + * be called. */ public void setChildProgressMonitor(IProgressMonitor value) { synchronized (lock) { diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IExecutor.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IExecutor.java index b1a4573373d..d1d596da130 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IExecutor.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IExecutor.java @@ -43,9 +43,9 @@ public interface IExecutor { *

* Execute the given {@link IProgressRunnable} (i.e. call * {@link IProgressRunnable#run(IProgressMonitor)}. Will return a non- - * null instance of {@link IFuture} that allows clients to - * inspect the state of the execution and retrieve any results via - * {@link IFuture#get()} or {@link IFuture#get(long)}. + * null instance of {@link IFuture} that allows clients to inspect + * the state of the execution and retrieve any results via {@link IFuture#get()} + * or {@link IFuture#get(long)}. *

*

* Note that implementers may decide whether to invoke @@ -53,27 +53,23 @@ public interface IExecutor { * synchronously, but since IProgressRunnables are frequently going to be * longer-running operations, implementers should proceed carefully before * implementing with synchronous (blocking) invocation. Implementers should - * typically implement via some non-blocking asynchronous invocation - * mechanism, e.g. Threads, Jobs, ThreadPools etc. + * typically implement via some non-blocking asynchronous invocation mechanism, + * e.g. Threads, Jobs, ThreadPools etc. *

* - * @param runnable - * the {@link IProgressRunnable} to invoke. Must not be - * null. - * @param monitor - * any {@link IProgressMonitor} to be passed to the runnable. May - * be null. + * @param runnable the {@link IProgressRunnable} to invoke. Must not be + * null. + * @param monitor any {@link IProgressMonitor} to be passed to the runnable. + * May be null. * @return {@link IFuture} to allow for inspection of the state of the * computation by clients, as well as access to any return values of * {@link IProgressRunnable#run(IProgressMonitor)}. Will not be * null. - * @param - * the type that will be returned by the - * {@link IProgressRunnable} as well as the returned - * {@link IFuture} + * @param the type that will be returned by the + * {@link IProgressRunnable} as well as the returned + * {@link IFuture} */ - IFuture execute( - IProgressRunnable runnable, + IFuture execute(IProgressRunnable runnable, IProgressMonitor monitor); } diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IFuture.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IFuture.java index a810cba08f5..6bb68735618 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IFuture.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IFuture.java @@ -49,9 +49,8 @@ *

* * @see IStatus - * @param - * the type that will be returned by {@link #get()} and/or - * {@link #get(long)} + * @param the type that will be returned by {@link #get()} and/or + * {@link #get(long)} * @since 1.1 * */ @@ -61,63 +60,59 @@ public interface IFuture { * Cancel the operation * * @return false if the operation could not be canceled, typically - * because it has already completed normally; true - * otherwise + * because it has already completed normally; true otherwise */ public boolean cancel(); /** - * Waits if necessary for one or more operations to complete, and then - * returns result(s). This method will block until either a) at least one - * result is available; or b) at least one operation throws an exception. + * Waits if necessary for one or more operations to complete, and then returns + * result(s). This method will block until either a) at least one result is + * available; or b) at least one operation throws an exception. * * @return Object result of the asynchronous operation(s) - * @throws InterruptedException - * if thread calling this method is interrupted. - * @throws OperationCanceledException - * if the operation has been canceled via progress monitor - * {@link #getProgressMonitor()}. + * @throws InterruptedException if thread calling this method is + * interrupted. + * @throws OperationCanceledException if the operation has been canceled via + * progress monitor + * {@link #getProgressMonitor()}. */ ResultType get() throws InterruptedException, OperationCanceledException; /** - * Waits if necessary for one or more operations to complete, and then - * returns result(s). This method will block until either a) at least one - * result is available; or b) at least one operation throws an exception. + * Waits if necessary for one or more operations to complete, and then returns + * result(s). This method will block until either a) at least one result is + * available; or b) at least one operation throws an exception. * - * @param waitTimeInMillis - * the maximum time to wait in milliseconds for the operation(s) - * to complete. + * @param waitTimeInMillis the maximum time to wait in milliseconds for the + * operation(s) to complete. * @return Object result of the asynchronous operation(s) - * @throws InterruptedException - * if thread calling this method is interrupted. - * @throws TimeoutException - * if the given wait time is exceeded without getting result. - * @throws OperationCanceledException - * if the operation has been canceled via progress monitor - * {@link #getProgressMonitor()}. + * @throws InterruptedException if thread calling this method is + * interrupted. + * @throws TimeoutException if the given wait time is exceeded without + * getting result. + * @throws OperationCanceledException if the operation has been canceled via + * progress monitor + * {@link #getProgressMonitor()}. */ - ResultType get(long waitTimeInMillis) throws InterruptedException, - TimeoutException, OperationCanceledException; + ResultType get(long waitTimeInMillis) throws InterruptedException, TimeoutException, OperationCanceledException; /** *

- * Get status for operation. Will return null until at least - * one operation(s) are complete. + * Get status for operation. Will return null until at least one + * operation(s) are complete. *

*

- * If {@link #hasValue()} returns true, this method will return - * a non-null IStatus. If {@link #hasValue()} returns + * If {@link #hasValue()} returns true, this method will return a + * non-null IStatus. If {@link #hasValue()} returns * false, this method will return null. *

*

- * Note that the returned IStatus instance may be an IMultiStatus, meaning - * that multiple operations have completed or are pending completion. + * Note that the returned IStatus instance may be an IMultiStatus, meaning that + * multiple operations have completed or are pending completion. *

* * @return IStatus the status of completed operation(s). Will return - * null if {@link #hasValue()} returns - * false. + * null if {@link #hasValue()} returns false. * * @see #hasValue() */ @@ -125,20 +120,18 @@ ResultType get(long waitTimeInMillis) throws InterruptedException, /** *

- * Returns true if any underlying operation(s) have - * completed. + * Returns true if any underlying operation(s) have completed. *

*

- * If this future represents access to just one operation, then this method - * and {@link #isDone()} will always return the same value. That is, when a - * single operation has a value, it is then considered done/completed and - * both {@link #isDone()} and this method will return true. + * If this future represents access to just one operation, then this method and + * {@link #isDone()} will always return the same value. That is, when a single + * operation has a value, it is then considered done/completed and both + * {@link #isDone()} and this method will return true. *

*

- * If this future represents multiple operations, then this method will - * return true when any of the operations have - * completed. Until the first operation is completed, it will return - * false. + * If this future represents multiple operations, then this method will return + * true when any of the operations have completed. Until the + * first operation is completed, it will return false. *

* * @return true if any operations represented by this future have @@ -152,21 +145,20 @@ ResultType get(long waitTimeInMillis) throws InterruptedException, * completed. *

*

- * If this future represents access to just one operation, then this method - * and {@link #hasValue()} will always return the same value. That is, when - * a single operation has a value, it is then considered done/completed and - * both {@link #hasValue()} and #isDone will return true. + * If this future represents access to just one operation, then this method and + * {@link #hasValue()} will always return the same value. That is, when a single + * operation has a value, it is then considered done/completed and both + * {@link #hasValue()} and #isDone will return true. *

*

* If this future represents multiple operations, then this method will only - * return true when all of the operations have - * completed. Until all operations have completed, it will return - * false. + * return true when all of the operations have completed. + * Until all operations have completed, it will return false. *

*

- * Completion can be due to normal operation completion, an exception, or - * user cancellation -- in all of these cases, this method will return - * true if all underlying operation(s) have been completed. + * Completion can be due to normal operation completion, an exception, or user + * cancellation -- in all of these cases, this method will return true + * if all underlying operation(s) have been completed. *

* * @return true if all operation(s) have completed in some manner. diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IListenableFuture.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IListenableFuture.java index 9d4bcc138b8..8953dfe17b5 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IListenableFuture.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IListenableFuture.java @@ -19,6 +19,7 @@ * * A future that allows for an {@link IProgressRunnable} (with optional * {@link IProgressMonitor}) to be executed via an {@link IExecutor}. + * * @since 1.1 * */ @@ -30,22 +31,21 @@ public interface IListenableFuture extends IFuture { * non-null and the {@link IExecutor} must also be non- * null. The given progressMonitor may be null. *

- * If the future has already completed by the time this method is called - * (i.e. {@link #isDone()} returns true, the progressRunnable - * will be executed immediately by the given executor. + * If the future has already completed by the time this method is called (i.e. + * {@link #isDone()} returns true, the progressRunnable will be + * executed immediately by the given executor. * - * @param executor - * the {@link IExecutor} to use to execute the given - * {@link IProgressRunnable}. Must not be null. - * @param progressRunnable - * the {@link IProgressRunnable} that will be executed when this - * future is complete. Must not be null. - * @param monitor - * an optional progress monitor to be passed to the - * progressRunnable when executed. May be null. + * @param executor the {@link IExecutor} to use to execute the given + * {@link IProgressRunnable}. Must not be + * null. + * @param progressRunnable the {@link IProgressRunnable} that will be executed + * when this future is complete. Must not be + * null. + * @param monitor an optional progress monitor to be passed to the + * progressRunnable when executed. May be + * null. */ - public void addListener(IExecutor executor, - IProgressRunnable progressRunnable, + public void addListener(IExecutor executor, IProgressRunnable progressRunnable, IProgressMonitor monitor); } diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IProgressRunnable.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IProgressRunnable.java index 90b916f091b..deb3bc89c0b 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IProgressRunnable.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/IProgressRunnable.java @@ -20,8 +20,8 @@ * Interface defining a block of code that can be run, return an Object result, * and throw an arbitrary Exception. * - * @param - * the type that will be returned by {@link #run(IProgressMonitor)} + * @param the type that will be returned by + * {@link #run(IProgressMonitor)} * @since 1.1 */ public interface IProgressRunnable { @@ -29,8 +29,7 @@ public interface IProgressRunnable { /** * Perform some action that returns a result or throws an exception * - * @param monitor - * the IProgressMonitor associated with this callable + * @param monitor the IProgressMonitor associated with this callable * @return result from the call * @throws Exception */ diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ISafeProgressRunner.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ISafeProgressRunner.java index 89a2e9c799d..4b0d2cf8eda 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ISafeProgressRunner.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ISafeProgressRunner.java @@ -18,6 +18,7 @@ * A runner that can execute {@link IProgressRunnable}s safely. Running an * {@link IProgressRunnable} safely means not throwing any {@link Exception} * possibly thrown by the given {@link IProgressRunnable}. + * * @since 1.1 * */ diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ImmediateExecutor.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ImmediateExecutor.java index 9e8f59a0e7f..b9e0b9493c7 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ImmediateExecutor.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ImmediateExecutor.java @@ -34,8 +34,7 @@ * @see ThreadsExecutor * @since 1.1 */ -public class ImmediateExecutor extends AbstractExecutor implements IExecutor, - IRunnableExecutor { +public class ImmediateExecutor extends AbstractExecutor implements IExecutor, IRunnableExecutor { @SuppressWarnings("rawtypes") protected AbstractFuture createFuture(IProgressMonitor monitor) { @@ -43,8 +42,7 @@ protected AbstractFuture createFuture(IProgressMonitor monitor) { } @SuppressWarnings("unchecked") - public IFuture execute( - IProgressRunnable runnable, + public IFuture execute(IProgressRunnable runnable, IProgressMonitor monitor) { Assert.isNotNull(runnable); @SuppressWarnings("rawtypes") diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/SingleOperationFuture.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/SingleOperationFuture.java index 8f738b66ef5..c423a56874f 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/SingleOperationFuture.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/SingleOperationFuture.java @@ -24,10 +24,10 @@ * that they should/must be very careful with respect to overriding the * synchronized methods in this class. *

+ * * @since 1.1 */ -public class SingleOperationFuture extends - AbstractFuture { +public class SingleOperationFuture extends AbstractFuture { private static final String PLUGIN_ID = "org.eclipse.equinox.concurrent"; private ResultType resultValue = null; @@ -42,12 +42,10 @@ public SingleOperationFuture() { public SingleOperationFuture(IProgressMonitor progressMonitor) { super(); this.progressMonitor = new FutureProgressMonitor( - (progressMonitor == null) ? new NullProgressMonitor() - : progressMonitor); + (progressMonitor == null) ? new NullProgressMonitor() : progressMonitor); } - public synchronized ResultType get() throws InterruptedException, - OperationCanceledException { + public synchronized ResultType get() throws InterruptedException, OperationCanceledException { throwIfCanceled(); while (!isDone()) wait(); @@ -56,8 +54,7 @@ public synchronized ResultType get() throws InterruptedException, } public synchronized ResultType get(long waitTimeInMillis) - throws InterruptedException, TimeoutException, - OperationCanceledException { + throws InterruptedException, TimeoutException, OperationCanceledException { // If waitTime out of bounds then throw illegal argument exception if (waitTimeInMillis < 0) throw new IllegalArgumentException("waitTimeInMillis must be => 0"); //$NON-NLS-1$ @@ -81,8 +78,7 @@ public synchronized ResultType get(long waitTimeInMillis) throwIfCanceled(); if (isDone()) return resultValue; - waitTime = waitTimeInMillis - - (System.currentTimeMillis() - startTime); + waitTime = waitTimeInMillis - (System.currentTimeMillis() - startTime); if (waitTime <= 0) throw createTimeoutException(waitTimeInMillis); } @@ -93,8 +89,8 @@ public synchronized boolean isDone() { } /** - * This method is not intended to be called by clients. Rather it should - * only be used by {@link IExecutor}s. + * This method is not intended to be called by clients. Rather it should only be + * used by {@link IExecutor}s. * * @noreference */ @@ -111,8 +107,7 @@ public void handleException(Throwable exception) { public void run() throws Exception { @SuppressWarnings("unchecked") - ResultType result = (ResultType) runnable - .run(getProgressMonitor()); + ResultType result = (ResultType) runnable.run(getProgressMonitor()); synchronized (SingleOperationFuture.this) { if (!isCanceled()) set(result); @@ -137,16 +132,14 @@ public synchronized boolean cancel() { return false; if (isCanceled()) return false; - setStatus(new Status(IStatus.CANCEL, PLUGIN_ID, IStatus.CANCEL, - "Operation canceled", null)); //$NON-NLS-1$ //$NON-NLS-2$ + setStatus(new Status(IStatus.CANCEL, PLUGIN_ID, IStatus.CANCEL, "Operation canceled", null)); //$NON-NLS-1$ //$NON-NLS-2$ getProgressMonitor().setCanceled(true); notifyAll(); return true; } protected synchronized void setException(Throwable ex) { - setStatus(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, - "Exception during operation", ex)); //$NON-NLS-1$ //$NON-NLS-2$ + setStatus(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Exception during operation", ex)); //$NON-NLS-1$ //$NON-NLS-2$ notifyAll(); } @@ -161,10 +154,10 @@ private synchronized void setStatus(IStatus status) { } private TimeoutException createTimeoutException(long timeout) { - setStatus(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, - "Operation timeout after " + timeout + "ms", null)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - timeoutException = new TimeoutException( - "Single operation timeout", timeout); //$NON-NLS-1$ + setStatus( + new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Operation timeout after " + timeout + "ms", null)); //$NON-NLS-1$ //$NON-NLS-2$ + // //$NON-NLS-3$ + timeoutException = new TimeoutException("Single operation timeout", timeout); //$NON-NLS-1$ return timeoutException; } diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/SingleOperationListenableFuture.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/SingleOperationListenableFuture.java index 6040b739cab..8b18c3c5d75 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/SingleOperationListenableFuture.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/SingleOperationListenableFuture.java @@ -28,11 +28,11 @@ * that they should/must be very careful with respect to overriding the * synchronized methods in this class. *

+ * * @since 1.1 */ -public class SingleOperationListenableFuture extends - SingleOperationFuture implements - IListenableFuture { +public class SingleOperationListenableFuture extends SingleOperationFuture + implements IListenableFuture { private IProgressRunnable progressRunnable; private IProgressMonitor progressMonitor; @@ -46,8 +46,7 @@ public SingleOperationListenableFuture(IProgressMonitor progressMonitor) { super(progressMonitor); } - public void addListener(IExecutor executor, - IProgressRunnable progressRunnable, + public void addListener(IExecutor executor, IProgressRunnable progressRunnable, IProgressMonitor monitor) { Assert.isNotNull(executor); Assert.isNotNull(progressRunnable); @@ -78,8 +77,7 @@ public void handleException(Throwable exception) { public void run() throws Exception { @SuppressWarnings("unchecked") - ResultType result = (ResultType) runnable - .run(getProgressMonitor()); + ResultType result = (ResultType) runnable.run(getProgressMonitor()); synchronized (SingleOperationListenableFuture.this) { if (!isCanceled()) set(result); diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java index faf7f10f272..f40ca61e485 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/ThreadsExecutor.java @@ -31,6 +31,7 @@ *

* Subclasses may extend the behavior of this ThreadsExecutor. *

+ * * @since 1.1 */ public class ThreadsExecutor extends AbstractExecutor { @@ -47,15 +48,12 @@ protected String createThreadName(IProgressRunnable runnable) { * Create a runnable given an {@link IProgressRunnable} and an * {@link ISafeProgressRunner} to run the runnable. * - * @param runner - * the safe progress runner to run the runnable - * @param progressRunnable - * the runnable to run. - * @return Runnable that when run will use the safe progress runner to run - * the progressRunnable + * @param runner the safe progress runner to run the runnable + * @param progressRunnable the runnable to run. + * @return Runnable that when run will use the safe progress runner to run the + * progressRunnable */ - protected Runnable createRunnable(final ISafeProgressRunner runner, - final IProgressRunnable progressRunnable) { + protected Runnable createRunnable(final ISafeProgressRunner runner, final IProgressRunnable progressRunnable) { return new Runnable() { public void run() { runner.runWithProgress(progressRunnable); @@ -64,12 +62,11 @@ public void run() { } /** - * Configure the given thread prior to starting it. Subclasses may override - * as appropriate to configure the given thread appropriately. The default + * Configure the given thread prior to starting it. Subclasses may override as + * appropriate to configure the given thread appropriately. The default * implementation calls {@link Thread#setDaemon(boolean)}. * - * @param thread - * the thread to configure + * @param thread the thread to configure */ protected void configureThreadForExecution(Thread thread) { // By default, we'll make the thread a daemon thread @@ -79,9 +76,8 @@ protected void configureThreadForExecution(Thread thread) { /** * Create an {@link AbstractFuture} with the given IProgressMonitor. * - * @param monitor - * a progress monitor to associate with the future. May be - * null. + * @param monitor a progress monitor to associate with the future. May be + * null. */ @SuppressWarnings("rawtypes") protected AbstractFuture createFuture(IProgressMonitor monitor) { @@ -89,15 +85,13 @@ protected AbstractFuture createFuture(IProgressMonitor monitor) { } @SuppressWarnings({ "rawtypes", "unchecked" }) - public synchronized IFuture execute( - IProgressRunnable runnable, + public synchronized IFuture execute(IProgressRunnable runnable, IProgressMonitor monitor) throws IllegalThreadStateException { Assert.isNotNull(runnable); // Now create future AbstractFuture sof = createFuture(monitor); // Create the thread for this operation - Thread thread = new Thread(createRunnable(sof, runnable), - createThreadName(runnable)); + Thread thread = new Thread(createRunnable(sof, runnable), createThreadName(runnable)); configureThreadForExecution(thread); // start thread thread.start(); diff --git a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/TimeoutException.java b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/TimeoutException.java index 0a653fd6677..a21521fb06d 100644 --- a/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/TimeoutException.java +++ b/bundles/org.eclipse.equinox.concurrent/src/org/eclipse/equinox/concurrent/future/TimeoutException.java @@ -15,6 +15,7 @@ /** * Timeout exception thrown when timeout occurs + * * @since 1.1 */ public class TimeoutException extends Exception {