You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bs...@apache.org on 2018/01/03 17:57:07 UTC
[geode] branch feature/GEODE-4176 updated: fixed auto-reconnect
unit test failures
This is an automated email from the ASF dual-hosted git repository.
bschuchardt pushed a commit to branch feature/GEODE-4176
in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/feature/GEODE-4176 by this push:
new 9a701d5 fixed auto-reconnect unit test failures
9a701d5 is described below
commit 9a701d5104a90141a1fef40e5fcda6536b7c8e65
Author: Bruce Schuchardt <bs...@pivotal.io>
AuthorDate: Wed Jan 3 09:56:13 2018 -0800
fixed auto-reconnect unit test failures
---
.../distributed/internal/tcpserver/TcpServer.java | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
index b6baa8b..97158e3 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
@@ -217,12 +217,12 @@ public class TcpServer {
public void start() throws IOException {
this.shuttingDown = false;
- initializeServerSocket();
startServerThread();
handler.init(this);
}
private void startServerThread() throws IOException {
+ initializeServerSocket();
if (serverThread == null || !serverThread.isAlive()) {
serverThread = new Thread(threadGroup, threadName) {
@Override
@@ -235,7 +235,7 @@ public class TcpServer {
}
}
- void initializeServerSocket() throws IOException {
+ private void initializeServerSocket() throws IOException {
if (srv_sock == null || srv_sock.isClosed()) {
if (bind_address == null) {
srv_sock = getSocketCreator().createServerSocket(port, BACKLOG);
@@ -246,7 +246,6 @@ public class TcpServer {
// GEODE-4176 - set the port from a wild-card bind so that handlers know the correct value
if (this.port <= 0) {
this.port = srv_sock.getLocalPort();
- log.warn("DEBUG: set local port to {}", port);
}
if (log.isInfoEnabled()) {
@@ -299,11 +298,17 @@ public class TcpServer {
// Allocate no objects here!
try {
srv_sock.close();
+ return;
} catch (IOException ignore) {
// ignore
}
SystemFailure.checkFailure(); // throws
}
+ if (srv_sock.isClosed()) {
+ log.error("Locator socket was closed unexpectedly - server thread is exiting.");
+ shuttingDown = true;
+ break;
+ }
try {
try {
sock = srv_sock.accept();
@@ -324,11 +329,12 @@ public class TcpServer {
}
}
- try {
- srv_sock.close();
-
- } catch (java.io.IOException ex) {
- log.warn("exception closing server socket during shutdown", ex);
+ if (!srv_sock.isClosed()) {
+ try {
+ srv_sock.close();
+ } catch (java.io.IOException ex) {
+ log.warn("exception closing server socket during shutdown", ex);
+ }
}
if (shuttingDown) {
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].