Created
February 14, 2017 03:53
-
-
Save abhirockzz/3503a8a38c986598e13cc4d44970008f to your computer and use it in GitHub Desktop.
Stateful EJB In WebSocket (2/2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Stateful | |
| public class ClientChatState { | |
| ... | |
| @Remove | |
| public void dispose(){ | |
| //this can just be a marker method | |
| } | |
| @PreDestroy | |
| public void closeResources(){ | |
| //close connections, resources etc. | |
| } | |
| } | |
| @ServerEndpoint("/letschat/{login-id}") | |
| public class ChatEndpoint { | |
| .... | |
| @OnClose | |
| public void disconnected(Session session) { | |
| ccs.dispose(); //method annotated with @Remove | |
| } | |
| .... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment