-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle race condition on accessing session info
- Loading branch information
1 parent
6ba2751
commit c4b7c53
Showing
5 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
43 changes: 43 additions & 0 deletions
43
src/main/java/org/jlab/epics2web/websocket/SessionInfo.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.jlab.epics2web.websocket; | ||
|
||
/** | ||
* This class provides a snapshot of websocket information that will not throw Exceptions if you try to interrogate it | ||
* after the session happens to have closed. There is a race condition if you hand a list of javax.websocket.Session | ||
* objects to a debug console for example as if the session happens to close between the time you return it and the | ||
* time the debug console calls the userProperties method for example you get an exception. | ||
*/ | ||
public class SessionInfo { | ||
private String id; | ||
private String ip; | ||
private String name; | ||
private String agent; | ||
private long droppedMessageCount; | ||
|
||
public SessionInfo(String id, String ip, String name, String agent, long droppedMessageCount) { | ||
this.id = id; | ||
this.ip = ip; | ||
this.name = name; | ||
this.agent = agent; | ||
this.droppedMessageCount = droppedMessageCount; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getIp() { | ||
return ip; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getAgent() { | ||
return agent; | ||
} | ||
|
||
public long getDroppedMessageCount() { | ||
return droppedMessageCount; | ||
} | ||
} |
This file contains 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
This file contains 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