Thanks for responding!
> Sorry for the late reply, was in vacation.
Absolutely no worries!
> Can you define what "gracefully" means for you?
When shutting down node A I want it to notify node B that it is about to leave the cluster. Then I want node B to remove node A locally and to clear OortMap from node A's entries.
At the moment when I terminate node A, node B will then try to connect to it for the duration of maxInterval and only then remove the entry.
Due to my limited knowledge I was thinking that if I explicitly try to disconnect the comet I would I achieve what I want.
So I guess my real question is how to stop Oort client on node A so that node B will remove the comet immediately from its cluster list?
> I'm a bit lost here.
> Why is it a problem if the WS connection is already closed?
I was planning to notify node B when node A is terminated. Sorry this question was more about JVM and servlets than about cometD.
I fail to figure out how to run code when servlet context is about to terminate but not yet.
Example of trying to call oortComet.disconnect() manually:
W|14:56:27.884|JettyShutdownThread| (OortConfig.java:84) ##### Disconnecting elv8gc8yn5hgo1er9rshqcwln6:
http://127.0.0.1:18080/test/cometdD|14:56:27.885|JettyShutdownThread| (BayeuxClient.java:1511) State updated: UNCONNECTED -> DISCONNECTING
D|14:56:27.887|JettyShutdownThread| (BayeuxClient.java:469) Sending messages [{clientId=elv8gc8yn5hgo1er9rshqcwln6, channel=/meta/disconnect, id=66}]
D|14:56:27.887|JettyShutdownThread| (WebSocketTransport.java:93) Opening websocket session to ws://
127.0.0.1:18080/test/cometdD|14:56:27.960|JettyShutdownThread| (BayeuxClient.java:946) Messages failed [{clientId=elv8gc8yn5hgo1er9rshqcwln6, channel=/meta/disconnect, id=66}]
java.io.IOException: Connect failure
at org.eclipse.jetty.websocket.jsr356.ClientContainer.connect(ClientContainer.java:263) ~[javax-websocket-client-impl-9.4.30.v20200611.jar:9.4.30.v20200611]
...
Caused by: java.lang.RuntimeException: org.eclipse.jetty.websocket.jsr356.ClientContainer is not running yet
at org.eclipse.jetty.websocket.jsr356.DecoderFactory.init(DecoderFactory.java:171) ~[javax-websocket-client-impl-9.4.30.v20200611.jar:9.4.30.v20200611]
...