org.glassfish.grizzly.Writeable Maven / Gradle / Ivy
/*
* Copyright (c) 2008, 2017 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.grizzly;
import java.util.concurrent.Future;
/**
* Implementations of this interface are able to write data from a {@link Buffer}.
*
* Grizzly {@link Connection} extends {@link Writeable}.
*
* @author Alexey Stashok
*/
@SuppressWarnings("deprecation")
public interface Writeable extends OutputSink {
/**
* Method writes the buffer.
*
* @param message the buffer, from which the data will be written
* @return {@link Future}, using which it's possible to check the
* result
*/
GrizzlyFuture> write(M message);
/**
* Method writes the buffer.
*
* @param message the buffer, from which the data will be written
* @param completionHandler {@link CompletionHandler},
* which will get notified, when write will be completed
*/
void write(M message,
CompletionHandler> completionHandler);
/**
* Method writes the buffer.
*
* @param message the buffer, from which the data will be written
* @param completionHandler {@link CompletionHandler},
* which will get notified, when write will be completed
* @param pushbackHandler {@link org.glassfish.grizzly.asyncqueue.PushBackHandler}, which will be notified
* if message was accepted by transport write queue or refused
* @deprecated push back logic is deprecated
*/
void write(M message,
CompletionHandler> completionHandler,
org.glassfish.grizzly.asyncqueue.PushBackHandler pushbackHandler);
/**
* Method writes the buffer to the specific address.
*
* @param dstAddress the destination address the buffer will be
* sent to
* @param message the buffer, from which the data will be written
* @param completionHandler {@link CompletionHandler},
* which will get notified, when write will be completed
*/
void write(L dstAddress,
M message,
CompletionHandler> completionHandler);
/**
* Method writes the buffer to the specific address.
*
* @param dstAddress the destination address the buffer will be
* sent to
* @param message the buffer, from which the data will be written
* @param completionHandler {@link CompletionHandler},
* which will get notified, when write will be completed
* @param pushbackHandler {@link org.glassfish.grizzly.asyncqueue.PushBackHandler}, which will be notified
* if message was accepted by transport write queue or refused
* @deprecated push back logic is deprecated
*/
void write(L dstAddress,
M message,
CompletionHandler> completionHandler,
org.glassfish.grizzly.asyncqueue.PushBackHandler pushbackHandler);
}