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

org.xnio.Result Maven / Gradle / Ivy

There is a newer version: 62
Show newest version

package org.xnio;

import java.io.IOException;

/**
 * A handler for the result of an operation.  May be used to populate an {@link IoFuture}.
 */
public interface Result {

    /**
     * Set the result for this operation.  Any threads blocking on this instance will be unblocked.
     *
     * @param result the result to set
     *
     * @return {@code false} if the operation was already completed, {@code true} otherwise
     */
    boolean setResult(T result);

    /**
     * Set the exception for this operation.  Any threads blocking on this instance will be unblocked.
     *
     * @param exception the exception to set
     *
     * @return {@code false} if the operation was already completed, {@code true} otherwise
     */
    boolean setException(IOException exception);

    /**
     * Acknowledge the cancellation of this operation.
     *
     * @return {@code false} if the operation was already completed, {@code true} otherwise
     */
    boolean setCancelled();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy