You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2014/05/30 13:40:32 UTC
svn commit: r1598560 -
/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/bootstrap/HttpServer.java
Author: olegk
Date: Fri May 30 11:40:32 2014
New Revision: 1598560
URL: http://svn.apache.org/r1598560
Log:
Expose listener endpoint
Modified:
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/bootstrap/HttpServer.java
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/bootstrap/HttpServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/bootstrap/HttpServer.java?rev=1598560&r1=1598559&r2=1598560&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/bootstrap/HttpServer.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/bootstrap/HttpServer.java Fri May 30 11:40:32 2014
@@ -105,27 +105,13 @@ public class HttpServer {
this.status = new AtomicReference<Status>(Status.READY);
}
- public InetAddress getInetAddress() {
- final ListenerEndpoint local = this.endpoint;
- if (local != null) {
- return ((InetSocketAddress) local.getAddress()).getAddress();
- } else {
- return null;
- }
- }
-
- public int getLocalPort() {
- final ListenerEndpoint local = this.endpoint;
- if (local != null) {
- return ((InetSocketAddress) local.getAddress()).getPort();
- } else {
- return -1;
- }
+ public ListenerEndpoint getEndpoint() {
+ return this.endpoint;
}
public void start() throws IOException {
if (this.status.compareAndSet(Status.READY, Status.ACTIVE)) {
- this.ioReactor.listen(new InetSocketAddress(this.ifAddress, this.port > 0 ? this.port : 0));
+ this.endpoint = this.ioReactor.listen(new InetSocketAddress(this.ifAddress, this.port > 0 ? this.port : 0));
final IOEventDispatch ioEventDispatch = new DefaultHttpServerIODispatch(
this.httpService, this.connectionFactory);
this.listenerExecutorService.execute(new Runnable() {