org.glassfish.enterprise.concurrent.ManagedExecutorServiceAdapter Maven / Gradle / Ivy
/*
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.enterprise.concurrent;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.*;
import javax.enterprise.concurrent.ManagedExecutorService;
/**
* The ManagedExecutorService instance to be handed to the
* application components, with all life cycle operations disabled.
*/
public class ManagedExecutorServiceAdapter extends AbstractManagedExecutorServiceAdapter
implements ManagedExecutorService {
protected ManagedExecutorServiceImpl executor;
public ManagedExecutorServiceAdapter(ManagedExecutorServiceImpl executor) {
this.executor = executor;
}
@Override
public Future submit(Callable task) {
return executor.submit(task);
}
@Override
public Future submit(Runnable task, T result) {
return executor.submit(task, result);
}
@Override
public Future> submit(Runnable task) {
return executor.submit(task);
}
@Override
public List> invokeAll(Collection extends Callable> tasks) throws InterruptedException {
return executor.invokeAll(tasks);
}
@Override
public List> invokeAll(Collection extends Callable> tasks, long timeout, TimeUnit unit) throws InterruptedException {
return executor.invokeAll(tasks, timeout, unit);
}
@Override
public T invokeAny(Collection extends Callable> tasks) throws InterruptedException, ExecutionException {
return executor.invokeAny(tasks);
}
@Override
public T invokeAny(Collection extends Callable> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return executor.invokeAny(tasks, timeout, unit);
}
@Override
public void execute(Runnable command) {
executor.execute(command);
}
}