
hudson.util.Futures Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hudson-core Show documentation
Show all versions of hudson-core Show documentation
Contains the core Hudson code and view files to render HTML.
The newest version!
/*******************************************************************************
*
* Copyright (c) 2004-2009 Oracle Corporation.
*
* 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:
*
* Kohsuke Kawaguchi
*
*
*******************************************************************************/
package hudson.util;
import hudson.remoting.Future;
import java.util.concurrent.TimeUnit;
/**
* Various {@link Future} implementations.
*
* @author Kohsuke Kawaguchi
*/
public class Futures {
/**
* Creates a {@link Future} instance that already has its value
* pre-computed.
*/
public static Future precomputed(final T value) {
return new Future() {
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
public boolean isCancelled() {
return false;
}
public boolean isDone() {
return true;
}
public T get() {
return value;
}
public T get(long timeout, TimeUnit unit) {
return value;
}
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy