mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
17.32.2013 3c0945a130c4433a1e2515353c013462d6a83f23
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Tuesday, December 17, 2013 13:32 +0100
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Tuesday, December 17, 2013 13:32 +0100
commit3c0945a130c4433a1e2515353c013462d6a83f23
tree 39b28f998cff046c349d650df39487873d18d6ed tree | zip | gz
parent eb933a0105d63d1640a32a70d86dfa4e72afc1fe view | diff
OPENDJ-1255 SEVERE_ERROR (Socket closed) in logs/errors file after uninstallation of a replicated server

Code review: Matthew Swift


Problem lied in the MonitoringPublisher thread which sends the monitoring information at regular intervals (60s by default).
In run(), code was waiting for 60s then happily sending the monitor message regardless of whether the server was shutting down.
However, if the thread is notified by shutdown process while waiting 60s, then it will immediately try to send the monitor message.
Since the shutdown is initiated, it will receive a SocketException when trying to send a monitor message. This exception is then logged.

Fix consisted in checking whether the server is shutting down right after being notified.


MonitoringPublisher.java:
Removed shutdown instance field (superseded by initiateShutdown() and isShuttingDown()).
In run(), moved the call to wait(long) at the end of the loop, so a notification will be immediately followed by a check on whether the server is shutting down + also added a shutdown check in the body of the loop.
In shutdown(), called initiateShutdown() before entering the synchronized block + moved the logging code outside of the synchronized block.
In waitForShutdown(), used Thread.join(long) instead of ill looking code.
1 files modified
58 ■■■■■ changed files
opends/src/server/org/opends/server/replication/server/MonitoringPublisher.java 58 ●●●●● diff | view | raw | blame | history