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 2020/12/05 13:50:58 UTC
[httpcomponents-core] 02/02: Removed connection acceptor API
changes (moved to 5.2)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
commit 784b0cf229fcf482a7f30f8ea3d7de05936735f7
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Dec 5 14:43:56 2020 +0100
Removed connection acceptor API changes (moved to 5.2)
---
.../hc/core5/http/impl/bootstrap/AsyncServer.java | 5 +-
.../hc/core5/reactor/ConnectionAcceptor.java | 3 -
.../hc/core5/reactor/ConnectionListener.java | 80 ----------------------
.../core5/reactor/DefaultListeningIOReactor.java | 7 +-
.../reactor/SingleCoreListeningIOReactor.java | 3 +-
5 files changed, 5 insertions(+), 93 deletions(-)
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServer.java
index 8a5c040..f64677d 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/bootstrap/AsyncServer.java
@@ -40,7 +40,6 @@ import org.apache.hc.core5.function.Decorator;
import org.apache.hc.core5.io.CloseMode;
import org.apache.hc.core5.reactor.ConnectionAcceptor;
import org.apache.hc.core5.reactor.ConnectionInitiator;
-import org.apache.hc.core5.reactor.ConnectionListener;
import org.apache.hc.core5.reactor.DefaultListeningIOReactor;
import org.apache.hc.core5.reactor.IOEventHandlerFactory;
import org.apache.hc.core5.reactor.IOReactorConfig;
@@ -54,8 +53,7 @@ import org.apache.hc.core5.util.TimeValue;
/**
* Protocol agnostic server side I/O session handler.
*/
-public class AsyncServer extends AbstractConnectionInitiatorBase
- implements IOReactorService, ConnectionListener, ConnectionAcceptor {
+public class AsyncServer extends AbstractConnectionInitiatorBase implements IOReactorService, ConnectionAcceptor {
private final DefaultListeningIOReactor ioReactor;
@@ -88,7 +86,6 @@ public class AsyncServer extends AbstractConnectionInitiatorBase
return ioReactor;
}
- @Override
public Future<ListenerEndpoint> listen(
final SocketAddress address, final Object attachment, final FutureCallback<ListenerEndpoint> callback) {
return ioReactor.listen(address, attachment, callback);
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionAcceptor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionAcceptor.java
index 490287b..e98eb61 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionAcceptor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionAcceptor.java
@@ -38,10 +38,7 @@ import org.apache.hc.core5.concurrent.FutureCallback;
* Non-blocking connection acceptor.
*
* @since 5.0
- *
- * @deprecated Use {@link ConnectionListener}
*/
-@Deprecated
public interface ConnectionAcceptor {
/**
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionListener.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionListener.java
deleted file mode 100644
index a70ac50..0000000
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ConnectionListener.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * ====================================================================
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- *
- */
-
-package org.apache.hc.core5.reactor;
-
-import java.io.IOException;
-import java.net.SocketAddress;
-import java.util.Set;
-import java.util.concurrent.Future;
-
-import org.apache.hc.core5.concurrent.FutureCallback;
-
-/**
- * Non-blocking connection acceptor.
- *
- * @since 5.1
- */
-public interface ConnectionListener {
-
- /**
- * Opens a new listener endpoint with the given socket address. Once
- * the endpoint is fully initialized it starts accepting incoming
- * connections and propagates I/O activity notifications to the I/O event
- * dispatcher.
- *
- * @param address the socket address to listen on.
- * @param attachment the attachment object.
- * @param callback the result callback.
- * @return listener endpoint.
- */
- Future<ListenerEndpoint> listen(SocketAddress address, Object attachment, FutureCallback<ListenerEndpoint> callback);
-
- /**
- * Suspends the I/O reactor preventing it from accepting new connections on
- * all active endpoints.
- *
- * @throws IOException in case of an I/O error.
- */
- void pause() throws IOException;
-
- /**
- * Resumes the I/O reactor restoring its ability to accept incoming
- * connections on all active endpoints.
- *
- * @throws IOException in case of an I/O error.
- */
- void resume() throws IOException;
-
- /**
- * Returns a set of endpoints for this I/O reactor.
- *
- * @return set of endpoints.
- */
- Set<ListenerEndpoint> getEndpoints();
-
-}
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/DefaultListeningIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/DefaultListeningIOReactor.java
index b3b6a6a..b317dfd 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/DefaultListeningIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/DefaultListeningIOReactor.java
@@ -42,15 +42,15 @@ import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.TimeValue;
/**
- * Multi-core I/O reactor that can ask as both {@link ConnectionInitiator}
- * and {@link ConnectionListener}. Internally this I/O reactor distributes newly created
+ * Multi-core I/O reactor that can act as both {@link ConnectionInitiator}
+ * and {@link ConnectionAcceptor}. Internally this I/O reactor distributes newly created
* I/O session equally across multiple I/O worker threads for a more optimal resource
* utilization and a better I/O performance. Usually it is recommended to have
* one worker I/O reactor per physical CPU core.
*
* @since 4.0
*/
-public class DefaultListeningIOReactor extends AbstractIOReactorBase implements ConnectionListener, ConnectionAcceptor {
+public class DefaultListeningIOReactor extends AbstractIOReactorBase implements ConnectionAcceptor {
private final static ThreadFactory DISPATCH_THREAD_FACTORY = new DefaultThreadFactory("I/O server dispatch", true);
private final static ThreadFactory LISTENER_THREAD_FACTORY = new DefaultThreadFactory("I/O listener", true);
@@ -145,7 +145,6 @@ public class DefaultListeningIOReactor extends AbstractIOReactorBase implements
ioReactor.start();
}
- @Override
public Future<ListenerEndpoint> listen(
final SocketAddress address, final Object attachment, final FutureCallback<ListenerEndpoint> callback) {
return listener.listen(address, attachment, callback);
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java
index d3603b8..1ee6de0 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreListeningIOReactor.java
@@ -50,7 +50,7 @@ import org.apache.hc.core5.concurrent.FutureCallback;
import org.apache.hc.core5.function.Callback;
import org.apache.hc.core5.io.Closer;
-class SingleCoreListeningIOReactor extends AbstractSingleCoreIOReactor implements ConnectionListener, ConnectionAcceptor {
+class SingleCoreListeningIOReactor extends AbstractSingleCoreIOReactor implements ConnectionAcceptor {
private final IOReactorConfig reactorConfig;
private final Callback<ChannelEntry> callback;
@@ -136,7 +136,6 @@ class SingleCoreListeningIOReactor extends AbstractSingleCoreIOReactor implement
}
}
- @Override
public Future<ListenerEndpoint> listen(
final SocketAddress address, final Object attachment, final FutureCallback<ListenerEndpoint> callback) {
if (getStatus().compareTo(IOReactorStatus.SHUTTING_DOWN) >= 0) {