File tree 1 file changed +4
-0
lines changed
java/src/org/openqa/selenium/grid/node/httpd
1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 34
34
import org .openqa .selenium .grid .config .Role ;
35
35
import org .openqa .selenium .grid .data .NodeAddedEvent ;
36
36
import org .openqa .selenium .grid .data .NodeDrainComplete ;
37
+ import org .openqa .selenium .grid .data .NodeRemovedEvent ;
37
38
import org .openqa .selenium .grid .data .NodeStatusEvent ;
38
39
import org .openqa .selenium .grid .log .LoggingOptions ;
39
40
import org .openqa .selenium .grid .node .HealthCheck ;
@@ -74,6 +75,8 @@ public class NodeServer extends TemplateGridServerCommand {
74
75
private final AtomicBoolean nodeRegistered = new AtomicBoolean (false );
75
76
private Node node ;
76
77
private EventBus bus ;
78
+ private final Thread shutdownHook =
79
+ new Thread (() -> bus .fire (new NodeRemovedEvent (node .getStatus ())));
77
80
78
81
@ Override
79
82
public String getName () {
@@ -223,6 +226,7 @@ public NettyServer start() {
223
226
protected void execute (Config config ) {
224
227
Require .nonNull ("Config" , config );
225
228
229
+ Runtime .getRuntime ().addShutdownHook (shutdownHook );
226
230
Server <?> server = asServer (config ).start ();
227
231
228
232
BuildInfo info = new BuildInfo ();
You can’t perform that action at this time.
0 commit comments