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

io.muserver.WriteCallback Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
package io.muserver;

/**
 * A callback for asynchronous write operations.
 * @deprecated This is being replaced with {@link DoneCallback}
 */
@Deprecated
public interface WriteCallback {

    /**
     * Called if the write succeeds
     * @throws Exception thrown when the callback throws an exception, in which case the response will be closed.
     */
    void onSuccess() throws Exception;

    /**
     * Called if the write failed, for example if the user closed their browser while writing to it
     * @param reason The reason for the failure
     * @throws Exception thrown when the callback throws an exception, in which case the response will be closed.
     */
    void onFailure(Throwable reason) throws Exception;

    /**
     * A write callback that does nothing when it receives the callbacks
     */
    WriteCallback NoOp = new WriteCallback() {
        public void onSuccess() {}
        public void onFailure(Throwable reason) {}
    };
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy