You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/10/30 09:58:56 UTC

[tomcat] branch master updated: Avoid API change

This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c255a1  Avoid API change
6c255a1 is described below

commit 6c255a1501c38187a1260209f3f954bcc5ca7f83
Author: remm <re...@apache.org>
AuthorDate: Wed Oct 30 10:58:13 2019 +0100

    Avoid API change
    
    Deprecate method since it is now replaced by
    AbstractEndpoint.getConnections.
---
 java/org/apache/coyote/AbstractProtocol.java          | 13 +++++++++++--
 java/org/apache/tomcat/util/net/AbstractEndpoint.java |  6 ++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java
index 9cfa6e9..d3d9d93 100644
--- a/java/org/apache/coyote/AbstractProtocol.java
+++ b/java/org/apache/coyote/AbstractProtocol.java
@@ -19,6 +19,7 @@ package org.apache.coyote;
 import java.net.InetAddress;
 import java.nio.ByteBuffer;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutionException;
@@ -1037,8 +1038,16 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler,
 
 
         @Override
-        public Set<SocketWrapperBase<S>> getOpenSockets() {
-            return proto.getEndpoint().getConnections();
+        public Set<S> getOpenSockets() {
+            Set<SocketWrapperBase<S>> set = proto.getEndpoint().getConnections();
+            Set<S> result = new HashSet<>();
+            for (SocketWrapperBase<S> socketWrapper : set) {
+                S socket = socketWrapper.getSocket();
+                if (socket != null) {
+                    result.add(socket);
+                }
+            }
+            return result;
         }
 
 
diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index d0188e6..74ba555 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -102,10 +102,12 @@ public abstract class AbstractEndpoint<S,U> {
         /**
          * Obtain the currently open sockets.
          *
-         * @return The socket wrappers for which the handler is tracking a currently
+         * @return The sockets for which the handler is tracking a currently
          *         open connection
+         * @deprecated Unused, will be removed in Tomcat 10, replaced
+         *         by AbstractEndpoint.getConnections
          */
-        public Set<SocketWrapperBase<S>> getOpenSockets();
+        public Set<S> getOpenSockets();
 
         /**
          * Release any resources associated with the given SocketWrapper.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org