Skip to content

Package: Writeable

Writeable

Coverage

1: /*
2: * Copyright (c) 2008, 2020 Oracle and/or its affiliates. All rights reserved.
3: * Copyright (c) 2018 Payara Services Ld.
4: *
5: * This program and the accompanying materials are made available under the
6: * terms of the Eclipse Public License v. 2.0, which is available at
7: * http://www.eclipse.org/legal/epl-2.0.
8: *
9: * This Source Code may also be made available under the following Secondary
10: * Licenses when the conditions for such availability set forth in the
11: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
12: * version 2 with the GNU Classpath Exception, which is available at
13: * https://www.gnu.org/software/classpath/license.html.
14: *
15: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16: */
17:
18: package org.glassfish.grizzly;
19:
20: import java.util.concurrent.Future;
21:
22: /**
23: * Implementations of this interface are able to write data from a {@link Buffer}.
24: *
25: * Grizzly {@link Connection} extends {@link Writeable}.
26: *
27: * @author Alexey Stashok
28: */
29: @SuppressWarnings("deprecation")
30: public interface Writeable<L> extends OutputSink {
31:
32: /**
33: * Method writes the <tt>buffer</tt>.
34: *
35: * @param <M> type of data to be written
36: * @param message the buffer, from which the data will be written
37: * @return {@link Future}, using which it's possible to check the result
38: */
39: <M> GrizzlyFuture<WriteResult<M, L>> write(M message);
40:
41: /**
42: * Method writes the <tt>buffer</tt>.
43: *
44: * @param <M> type of data to be written
45: * @param message the buffer, from which the data will be written
46: * @param completionHandler {@link CompletionHandler}, which will get notified, when write will be completed
47: */
48: <M> void write(M message, CompletionHandler<WriteResult<M, L>> completionHandler);
49:
50: /**
51: * Method writes the <tt>buffer</tt>.
52: *
53: * @param <M> type of data to be written
54: * @param message the buffer, from which the data will be written
55: * @param completionHandler {@link CompletionHandler}, which will get notified, when write will be completed
56: * @param pushbackHandler {@link org.glassfish.grizzly.asyncqueue.PushBackHandler}, which will be notified if message
57: * was accepted by transport write queue or refused
58: * @deprecated push back logic is deprecated
59: */
60: @Deprecated
61: <M> void write(M message, CompletionHandler<WriteResult<M, L>> completionHandler, org.glassfish.grizzly.asyncqueue.PushBackHandler pushbackHandler);
62:
63: /**
64: * Method writes the <tt>buffer</tt> to the specific address.
65: *
66: * @param <M> type of data to be written
67: * @param dstAddress the destination address the <tt>buffer</tt> will be sent to
68: * @param message the buffer, from which the data will be written
69: * @param completionHandler {@link CompletionHandler}, which will get notified, when write will be completed
70: */
71: <M> void write(L dstAddress, M message, CompletionHandler<WriteResult<M, L>> completionHandler);
72:
73: /**
74: * Method writes the <tt>buffer</tt> to the specific address.
75: *
76: * @param <M> type of data to be written
77: * @param dstAddress the destination address the <tt>buffer</tt> will be sent to
78: * @param message the buffer, from which the data will be written
79: * @param completionHandler {@link CompletionHandler}, which will get notified, when write will be completed
80: * @param pushbackHandler {@link org.glassfish.grizzly.asyncqueue.PushBackHandler}, which will be notified if message
81: * was accepted by transport write queue or refused
82: * @deprecated push back logic is deprecated
83: */
84: @Deprecated
85: <M> void write(L dstAddress, M message, CompletionHandler<WriteResult<M, L>> completionHandler,
86: org.glassfish.grizzly.asyncqueue.PushBackHandler pushbackHandler);
87: }