Skip to content

Commit

Permalink
GEODE-10337: add use of SocketCreatorFactory.close() (apache#7842)
Browse files Browse the repository at this point in the history
* GEODE-10337: add use of SocketCreatorFactory.close()

* GEODE-10337: added UT
  • Loading branch information
mivanac authored Sep 7, 2022
1 parent dd485b2 commit 596a601
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 197 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,7 @@ protected void disconnect(boolean preparingForReconnect, String reason, boolean
removeSystem(this);
if (!attemptingToReconnect) {
loggingSession.shutdown();
SocketCreatorFactory.close();
}
alertingService.useAlertMessaging(new NullAlertMessaging());
clusterAlertMessaging.get().close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ private DistributionConfig getDistributionConfig() {
}

private static synchronized SocketCreatorFactory getInstance(boolean closing) {
if (instance == null && !closing) {
instance = new SocketCreatorFactory();
SocketCreatorFactory result = instance;
if (result == null && !closing) {
result = new SocketCreatorFactory();
instance = result;
} else if (result != null && closing) {
instance = null;
}
return instance;
return result;
}

private static synchronized SocketCreatorFactory getInstance() {
Expand All @@ -74,6 +78,10 @@ public static SocketCreator getSocketCreatorForComponent(
sslConfigForComponent);
}

static boolean checkInstanceIsNull() {
return instance == null;
}

public static SocketCreator getSocketCreatorForComponent(
SecurableCommunicationChannel sslEnabledComponent) {
return getSocketCreatorForComponent(getInstance().getDistributionConfig(), sslEnabledComponent);
Expand Down
Loading

0 comments on commit 596a601

Please sign in to comment.