Bill commented on a change in pull request #5987:
URL: https://github.com/apache/geode/pull/5987#discussion_r572391356
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/net/SocketCloser.java
##########
@@ -163,60 +164,72 @@ private Future asyncExecute(String address, Runnable
runnableToExecute) {
}
/**
- * Closes the specified socket in a background thread. In some cases we see
close hang (see bug
- * 33665). Depending on how the SocketCloser is configured (see
ASYNC_CLOSE_WAIT_MILLISECONDS)
+ * Closes the specified socket in a background thread. In some cases we see
close hang.
+ * Depending on how the SocketCloser is configured (see
ASYNC_CLOSE_WAIT_MILLISECONDS)
* this method may block for a certain amount of time. If it is called after
the SocketCloser is
* closed then a normal synchronous close is done.
*
* @param socket the socket to close
* @param address identifies who the socket is connected to
- * @param extra an optional Runnable with stuff to execute before the socket
is closed
+ * @param runBeforeClose a Runnable with stuff to execute before the socket
is closed
*/
- public void asyncClose(final Socket socket, final String address, final
Runnable extra) {
- if (socket == null || socket.isClosed()) {
+ @NotNull
Review comment:
I don't think it makes sense to add the `@NotNull` annotation to a
`void` method, since the method isn't returning anything at all.
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ServerConnection.java
##########
@@ -1412,11 +1412,19 @@ public boolean cleanup() {
getAcceptor().decClientServerConnectionCount();
}
- try {
- theSocket.close();
- } catch (Exception ignored) {
- }
+ if (!theSocket.isClosed()) {
+ final String closerName =
+ communicationMode.isWAN() ? "WANSocketCloser" :
"CacheServerSocketCloser";
Review comment:
`closerName` is being passed as the `address` parameter of
`asyncClose()`. The doc on that method says:
```
* @param address identifies who the socket is connected to
```
Other calls to `asyncClose()` send an address. If there is a reason we don't
want to send an address here, would you mind adding a comment to explain it?
##########
File path:
geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
##########
@@ -1054,14 +1055,14 @@ public boolean awaitTermination(long timeout, TimeUnit
unit) throws InterruptedE
@Override
public <T> Future<T> submit(final Callable<T> task) {
- Exception ex = null;
- T result = null;
+ CompletableFuture future = new CompletableFuture<>();
Review comment:
This new code looks like an improvement. But the method is on
`DummyExecutor`: question: is this class used? Because I don't see any static
usages of the class.
Can we remove `DummyExecutor` entirely?
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/net/SocketCloser.java
##########
@@ -163,60 +164,72 @@ private Future asyncExecute(String address, Runnable
runnableToExecute) {
}
/**
- * Closes the specified socket in a background thread. In some cases we see
close hang (see bug
- * 33665). Depending on how the SocketCloser is configured (see
ASYNC_CLOSE_WAIT_MILLISECONDS)
+ * Closes the specified socket in a background thread. In some cases we see
close hang.
+ * Depending on how the SocketCloser is configured (see
ASYNC_CLOSE_WAIT_MILLISECONDS)
* this method may block for a certain amount of time. If it is called after
the SocketCloser is
* closed then a normal synchronous close is done.
*
* @param socket the socket to close
* @param address identifies who the socket is connected to
- * @param extra an optional Runnable with stuff to execute before the socket
is closed
+ * @param runBeforeClose a Runnable with stuff to execute before the socket
is closed
*/
- public void asyncClose(final Socket socket, final String address, final
Runnable extra) {
- if (socket == null || socket.isClosed()) {
+ @NotNull
+ public void asyncClose(final Socket socket, final String address, final
Runnable runBeforeClose) {
+ asyncClose(socket, address, runBeforeClose, () -> {
+ });
+ }
+
+ /**
+ * Closes the specified socket in a background thread. In some cases we see
close hang.
+ * Depending on how the SocketCloser is configured (see
ASYNC_CLOSE_WAIT_MILLISECONDS)
+ * this method may block for a certain amount of time. If it is called after
the SocketCloser is
+ * closed then a normal synchronous close is done.
+ *
+ * @param socket the socket to close
+ * @param address identifies who the socket is connected to
+ * @param runBeforeClose a Runnable with stuff to execute before the socket
is closed
+ * @param runAfterClose a Runnable with stuff to execute after the socket is
closed
+ */
+ @NotNull
Review comment:
ditto
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]