All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.equinox.concurrent.future.ImmediateExecutor Maven / Gradle / Ivy

The newest version!
/******************************************************************************
 * Copyright (c) 2010, 2013 EclipseSource 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
 *
 * Contributors:
 *   EclipseSource - initial API and implementation
 *   Gunnar Wagenknecht - added support for generics
 ******************************************************************************/
package org.eclipse.equinox.concurrent.future;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;

/**
 * 

* Executes {@link IProgressRunnable} instances immediately. *

*

* NOTE: {@link #execute(IProgressRunnable, IProgressMonitor)} should be * used with some degree of caution with this implementation, as unlike other * implementations the {@link IProgressRunnable#run(IProgressMonitor)} method * will be called by the thread that calls * {@link #execute(IProgressRunnable, IProgressMonitor)}, meaning that calling * #execute(IProgressRunnable, IProgressMonitor) may block the calling thread * indefinitely. *

* * @see ThreadsExecutor * @since 1.1 */ public class ImmediateExecutor extends AbstractExecutor implements IExecutor, IRunnableExecutor { @SuppressWarnings("rawtypes") protected AbstractFuture createFuture(IProgressMonitor monitor) { return new SingleOperationListenableFuture(monitor); } @SuppressWarnings("unchecked") public IFuture execute( IProgressRunnable runnable, IProgressMonitor monitor) { Assert.isNotNull(runnable); @SuppressWarnings("rawtypes") AbstractFuture sof = createFuture(monitor); // Actually run the runnable immediately. See NOTE above sof.runWithProgress(runnable); return sof; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy