diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEInitJob.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEInitJob.java index afc9799319b..78afe547f5d 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEInitJob.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEInitJob.java @@ -32,33 +32,33 @@ import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.logging.Logger; /** - * This is a job named "Initialize RSE". It is instantiated and run during - * RSE startup. It must not be run at any other time. The job restores the - * persistent form of the RSE model. Use the extension point - * org.eclipse.rse.core.modelInitializers to supplement the model once it is + * This is a job named "Initialize RSE". It is instantiated and run during + * RSE startup. It must not be run at any other time. The job restores the + * persistent form of the RSE model. Use the extension point + * org.eclipse.rse.core.modelInitializers to supplement the model once it is * restored. */ public final class RSEInitJob extends Job { - + /** * The name of this job. This is API. Clients may use this name to find this job by name. */ public final static String NAME = "Initialize RSE"; //$NON-NLS-1$ - + private static RSEInitJob instance = new RSEInitJob(); private class Phase { - private volatile boolean isCanceled = false; + private volatile boolean isCancelled = false; private volatile boolean isComplete = false; private int phaseNumber = 0; public Phase(int phaseNumber) { this.phaseNumber = phaseNumber; } public synchronized void waitForCompletion() throws InterruptedException { - while (!isComplete && !isCanceled) { + while (!isComplete && !isCancelled) { wait(); } - if (isCanceled) { + if (isCancelled) { throw new InterruptedException(); } } @@ -70,14 +70,14 @@ public final class RSEInitJob extends Job { notifyListeners(phaseNumber); } public synchronized void cancel() { - isCanceled = true; + isCancelled = true; notifyAll(); } public boolean isComplete() { return isComplete; } } - + private class MyJobChangeListener implements IJobChangeListener { public void aboutToRun(IJobChangeEvent event) { } @@ -100,15 +100,15 @@ public final class RSEInitJob extends Job { public void sleeping(IJobChangeEvent event) { } } - + private Phase finalPhase = new Phase(RSECorePlugin.INIT_ALL); private Phase modelPhase = new Phase(RSECorePlugin.INIT_MODEL); private Phase initializerPhase = new Phase(RSECorePlugin.INIT_INITIALIZER); private List listeners = new ArrayList(10); private Logger logger = RSECorePlugin.getDefault().getLogger(); private MyJobChangeListener myJobChangeListener = new MyJobChangeListener(); - - + + /** * Returns the singleton instance of this job. * @return the InitRSEJob instance for this workbench. @@ -116,12 +116,12 @@ public final class RSEInitJob extends Job { public static RSEInitJob getInstance() { return instance; } - + private RSEInitJob() { super(NAME); addJobChangeListener(myJobChangeListener); } - + /** * Adds a new listener to the set of listeners to be notified when initialization phases complete. * If the listener is added after the phase has completed it will not be invoked. @@ -134,7 +134,7 @@ public final class RSEInitJob extends Job { listeners.add(listener); } } - + /** * Removes a listener to the set of listeners to be notified when phases complete. * If the listener is not in the set this does nothing. @@ -145,7 +145,7 @@ public final class RSEInitJob extends Job { listeners.remove(listener); } } - + /** * Notify all registered listeners of a phase completion * @param phase the phase just completed. @@ -164,7 +164,7 @@ public final class RSEInitJob extends Job { } } } - + /* (non-Javadoc) * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) */ @@ -175,7 +175,7 @@ public final class RSEInitJob extends Job { modelPhase.done(); // instantiate and run initializers IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.rse.core.modelInitializers"); //$NON-NLS-1$ - monitor.beginTask(RSECoreMessages.InitRSEJob_initializing_rse, elements.length); + monitor.beginTask(RSECoreMessages.InitRSEJob_initializing_rse, elements.length); for (int i = 0; i < elements.length && !monitor.isCanceled(); i++) { IConfigurationElement element = elements[i]; IProgressMonitor submonitor = new SubProgressMonitor(monitor, 1); @@ -203,7 +203,7 @@ public final class RSEInitJob extends Job { } return result; } - + /** * Returns a handle to a mark file based on the initializer class name. * @param element the element that defines the initializer @@ -218,7 +218,7 @@ public final class RSEInitJob extends Job { File markFile = new File(markPath.toOSString()); return markFile; } - + /** * @param element the element to test for marking * @return true if the element is marked @@ -227,7 +227,7 @@ public final class RSEInitJob extends Job { File markFile = getMarkFile(element); return markFile.exists(); } - + /** * @param element the element to mark * @return a status indicating if the marking was successful @@ -261,18 +261,18 @@ public final class RSEInitJob extends Job { try { status = initializer.run(submonitor); } catch (RuntimeException e) { - String message = NLS.bind(RSECoreMessages.InitRSEJob_initializer_ended_in_error, initializerName); + String message = NLS.bind(RSECoreMessages.InitRSEJob_initializer_ended_in_error, initializerName); logger.logError(message, e); status = new Status(IStatus.ERROR, RSECorePlugin.PLUGIN_ID, message, e); } } catch (CoreException e) { - String message = NLS.bind(RSECoreMessages.InitRSEJob_initializer_failed_to_load, initializerName); + String message = NLS.bind(RSECoreMessages.InitRSEJob_initializer_failed_to_load, initializerName); logger.logError(message, e); status = new Status(IStatus.ERROR, RSECorePlugin.PLUGIN_ID, message, e); } return status; } - + /** * Waits until a job is completed. * @return the status of the job upon its completion. @@ -307,7 +307,7 @@ public final class RSEInitJob extends Job { } /** - * @param phase the phase for which completion is requested. + * @param phase the phase for which completion is requested. * Phases are defined in {@link RSECorePlugin}. * @return true if this phase has completed. * @throws IllegalArgumentException if the phase is undefined. @@ -332,5 +332,5 @@ public final class RSEInitJob extends Job { } return result; } - + } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Mutex.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Mutex.java index 9db4d235207..0e3c1d29cb3 100644 --- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Mutex.java +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/Mutex.java @@ -1,12 +1,12 @@ /******************************************************************************* * Copyright (c) 2006 Wind River Systems, Inc. - * 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: - * Martin Oberhuber (Wind River) - initial API and implementation + * 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: + * Martin Oberhuber (Wind River) - initial API and implementation *******************************************************************************/ package org.eclipse.rse.services; @@ -23,7 +23,7 @@ import org.eclipse.rse.internal.services.Activator; * A Mutual Exclusion Lock for Threads that need to access a resource * in a serialized manner. An Eclipse ProgressMonitor is accepted * in order to support cancellation when waiting for the Mutex. - * + * * Usage Example: * * private Mutex fooMutex = new Mutex(); @@ -38,12 +38,12 @@ import org.eclipse.rse.internal.services.Activator; * return false; * } * - * - * The Mutex is not reentrant, so when a Thread has locked the + * + * The Mutex is not reentrant, so when a Thread has locked the * Mutex it must not try locking it again. */ public class Mutex { - + private boolean fLocked = false; private List fWaitQueue = new LinkedList(); @@ -52,15 +52,15 @@ public class Mutex { */ public Mutex() { } - + /** * Try to acquire the lock maintained by this mutex. * * If the thread needs to wait before it can acquire the mutex, it - * will wait in a first-come-first-serve fashion. In case a progress - * monitor was given, it will be updated and checked for cancel every + * will wait in a first-come-first-serve fashion. In case a progress + * monitor was given, it will be updated and checked for cancel every * second. - * + * * @param monitor Eclipse Progress Monitor. May be null. * @param timeout Maximum wait time given in milliseconds. * @return true if the lock was obtained successfully. @@ -90,8 +90,8 @@ public class Mutex { long timeLeft = timeout; long pollTime = (monitor!=null) ? 1000 : timeLeft; long nextProgressUpdate = start+500; - boolean canceled = false; - while (timeLeft>0 && !canceled && !lockAcquired) { + boolean cancelled = false; + while (timeLeft > 0 && !cancelled && !lockAcquired) { //is it my turn yet? Check wait queue and wait synchronized(fWaitQueue) { if (!fLocked && fWaitQueue.get(0) == myself) { @@ -115,8 +115,8 @@ public class Mutex { long curTime = System.currentTimeMillis(); timeLeft = start + timeout - curTime; if (monitor!=null) { - canceled = monitor.isCanceled(); - if (!canceled && (curTime>nextProgressUpdate)) { + cancelled = monitor.isCanceled(); + if (!cancelled && (curTime > nextProgressUpdate)) { monitor.worked(1); nextProgressUpdate+=1000; } @@ -138,8 +138,8 @@ public class Mutex { /** * Release this mutex's lock. - * - * May only be called by the same thread that originally acquired + * + * May only be called by the same thread that originally acquired * the Mutex. */ public void release() { @@ -162,12 +162,12 @@ public class Mutex { return fLocked; } } - + /** * Interrupt all threads waiting for the Lock, causing their * {@link #waitForLock(IProgressMonitor, long)} method to return * false. - * This should be called if the resource that the Threads are + * This should be called if the resource that the Threads are * contending for, becomes unavailable for some other reason. */ public void interruptAll() {