2 // ========================================================================
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
19 package org.eclipse.jetty.server;
21 import java.io.Closeable;
22 import java.io.IOException;
25 * <p>A {@link Connector} for TCP/IP network connectors</p>
27 public interface NetworkConnector extends Connector, Closeable
30 * <p>Performs the activities needed to open the network communication
31 * (for example, to start accepting incoming network connections).</p>
33 * @throws IOException if this connector cannot be opened
36 void open() throws IOException;
39 * <p>Performs the activities needed to close the network communication
40 * (for example, to stop accepting network connections).</p>
41 * Once a connector has been closed, it cannot be opened again without first
42 * calling {@link #stop()} and it will not be active again until a subsequent call to {@link #start()}
47 /* ------------------------------------------------------------ */
49 * A Connector may be opened and not started (to reserve a port)
50 * or closed and running (to allow graceful shutdown of existing connections)
51 * @return True if the connector is Open.
56 * @return The hostname representing the interface to which
57 * this connector will bind, or null for all interfaces.
62 * @return The configured port for the connector or 0 if any available
68 * @return The actual port the connector is listening on, or
69 * -1 if it has not been opened, or -2 if it has been closed.