Skip to content

Package: ConnectorHandler

ConnectorHandler

Coverage

1: /*
2: * Copyright (c) 2008, 2020 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.glassfish.grizzly;
18:
19: import java.util.concurrent.Future;
20:
21: /**
22: * Client side connector handler API. <tt>ConnectorHandler</tt> is responsible for creating and initializing
23: * {@link Connection}, and optionally connect it to a specific local/remote address.
24: *
25: * @author Alexey Stashok
26: */
27: public interface ConnectorHandler<E> {
28:
29: /**
30: * Creates, initializes and establishes {@link Connection} to the specific <code>remoteAddress</code>.
31: *
32: * @param remoteAddress remote address to connect to
33: * @return {@link Future} of connect operation, which could be used to get resulting {@link Connection}
34: */
35: Future<Connection> connect(E remoteAddress);
36:
37: /**
38: * Creates, initializes and establishes {@link Connection} to the specific <code>remoteAddress</code>.
39: *
40: * @param remoteAddress remote address to connect to
41: * @param completionHandler {@link CompletionHandler}
42: */
43: void connect(E remoteAddress, CompletionHandler<Connection> completionHandler);
44:
45: /**
46: * Creates, initializes {@link Connection}, binds it to the specific local and remote <code>remoteAddress</code>.
47: *
48: * @param remoteAddress remote address to connect to
49: * @param localAddress local address to bind a {@link Connection} to
50: * @return {@link Future} of connect operation, which could be used to get resulting {@link Connection}
51: */
52: Future<Connection> connect(E remoteAddress, E localAddress);
53:
54: /**
55: * Creates, initializes {@link Connection}, binds it to the specific local and remote <code>remoteAddress</code>.
56: *
57: * @param remoteAddress remote address to connect to
58: * @param localAddress local address to bind a {@link Connection} to
59: * @param completionHandler {@link CompletionHandler}
60: */
61: void connect(E remoteAddress, E localAddress, CompletionHandler<Connection> completionHandler);
62: }