1 /* 2 * ==================================================================== 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * ==================================================================== 20 * 21 * This software consists of voluntary contributions made by many 22 * individuals on behalf of the Apache Software Foundation. For more 23 * information on the Apache Software Foundation, please see 24 * <http://www.apache.org/>. 25 * 26 */ 27 28 package org.apache.http.nio.reactor; 29 30 import java.io.IOException; 31 import java.net.SocketAddress; 32 33 /** 34 * ListenerEndpoint interface represents an endpoint used by an I/O reactor 35 * to listen for incoming connection from remote clients. 36 * 37 * @since 4.0 38 */ 39 public interface ListenerEndpoint { 40 41 /** 42 * Returns the socket address of this endpoint. 43 * 44 * @return socket address. 45 */ 46 SocketAddress getAddress(); 47 48 /** 49 * Returns an instance of {@link IOException} thrown during initialization 50 * of this endpoint or {@code null}, if initialization was successful. 51 * 52 * @return I/O exception object or {@code null}. 53 */ 54 IOException getException(); 55 56 /** 57 * Waits for completion of initialization process of this endpoint. 58 * 59 * @throws InterruptedException in case the initialization process was 60 * interrupted. 61 */ 62 void waitFor() throws InterruptedException; 63 64 /** 65 * Determines if this endpoint has been closed and is no longer listens 66 * for incoming connections. 67 * 68 * @return {@code true} if the endpoint has been closed, 69 * {@code false} otherwise. 70 */ 71 boolean isClosed(); 72 73 /** 74 * Closes this endpoint. The endpoint will stop accepting incoming 75 * connection. 76 */ 77 void close(); 78 79 }