Enum Class BrowserPageContext
- All Implemented Interfaces:
 Serializable,Comparable<BrowserPageContext>,Constable
- Since:
 - 2.0.0
 
- 
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> - 
Enum Constant Summary
Enum Constants - 
Method Summary
Modifier and TypeMethodDescriptionaddBrowserPage(String httpSessionId, BrowserPage browserPage) voidclean(long maxIdleTimeout) If any object is idle for a time which is greater than or equal the givenmaxIdleTimeoutit will be removed from theBrowserPageContext.voiddestroyContext(String httpSessionId) This should be called when the http session is closedvoidvoidenableAutoClean(long maxIdleTimeout) Runs a periodic clean operation when idle time of objects likeBrowserPage,HeartbeatManageretc..voidenableAutoClean(long maxIdleTimeout, Executor executor) Runs a periodic clean operation when idle time of objects likeBrowserPage,HeartbeatManageretc..booleanexists(BrowserPage browserPage) Checks the existence ofbrowserPagein this context.booleanexistsAndValid(BrowserPage browserPage) Checks the existence of validbrowserPagein this context.getBrowserPage(String instanceId) Gets the browserPage object for the given instance id.getBrowserPage(String httpSessionId, String instanceId) getBrowserPageIfValid(String instanceId) gets the browserPage object for the given instance id.getBrowserPageIfValid(String httpSessionId, String instanceId) Gets the browserPage object for the given instance id.getBrowserPages(String httpSessionId) Gets all browser pages associated with this session.getHeartbeatManagerForBrowserPage(String wffInstanceId) getHeartbeatManagerForHttpSession(String httpSessionId) voidhttpSessionClosed(String httpSessionId) should be called when the httpsession is closed.booleanstatic booleanvoidremoveBrowserPage(String wffInstanceId) No need to call this method unless there is a special case like extending the functionality ofBrowserPageContextinstance.static voidsetDebugMode(boolean enabled) static BrowserPageContextReturns the enum constant of this class with the specified name.static BrowserPageContext[]values()Returns an array containing the constants of this enum class, in the order they are declared.voidwebSocketClosed(String wffInstanceId) Deprecated.this method is for future developmentwebSocketClosed(String wffInstanceId, String sessionId) this method should be called when the websocket is closed.websocketMessaged(String wffInstanceId, byte[] message) Deprecated.use webSocketMessaged which does the same job.webSocketMessaged(String wffInstanceId, byte[] message) this method should be called when the websocket is messaged.webSocketOpened(String wffInstanceId) this method should be called when the websocket is openedwebSocketOpened(String wffInstanceId, Function<String, HeartbeatManager> computeHeartbeatManager) this method should be called when the websocket is opened 
- 
Enum Constant Details
- 
INSTANCE
 
 - 
 - 
Method Details
- 
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
 - an array containing the constants of this enum class, in the order they are declared
 
 - 
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
 name- the name of the enum constant to be returned.- Returns:
 - the enum constant with the specified name
 - Throws:
 IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
 - 
addBrowserPage
- Parameters:
 httpSessionId-browserPage-- Returns:
 - the instance id (unique) of the browser page.
 - Since:
 - 2.0.0
 
 - 
getBrowserPage
- Parameters:
 httpSessionId-instanceId-- Returns:
 - Since:
 - 2.0.0
 
 - 
getBrowserPageIfValid
Gets the browserPage object for the given instance id. It also checks if thebrowserPageis valid.getBrowserPageIfValid(String, String)method is better than this method in terms of performance.
Note: this operation is not atomic.- Parameters:
 httpSessionId-instanceId-- Returns:
 - the 
browserPageobject if exists and its internal idle time is not greater than or equal to the time set byenableAutoClean(long)methods otherwisenull. - Since:
 - 3.0.16
 
 - 
getBrowserPage
Gets the browserPage object for the given instance id.getBrowserPage(String, String)method is better than this method in terms of performance.- Parameters:
 instanceId-- Returns:
 - browser page object if it exists otherwise null.
 - Since:
 - 2.0.0
 
 - 
getBrowserPageIfValid
gets the browserPage object for the given instance id. It also checks if thebrowserPageis valid.getBrowserPageIfValid(String, String)method is better than this method in terms of performance.
Note: this operation is not atomic.- Parameters:
 instanceId-- Returns:
 - the 
browserPageobject if exists and its internal idle time is not greater than or equal to the time set byenableAutoClean(long)methods otherwisenull. - Since:
 - 3.0.16
 
 - 
getBrowserPages
Gets all browser pages associated with this session.- Parameters:
 httpSessionId-- Returns:
 - an unmodifiable map of BrowserPages associated with this session where key as instanceId and value as BrowserPage.
 - Since:
 - 2.0.2
 
 - 
destroyContext
This should be called when the http session is closed- Parameters:
 httpSessionId- the session id of http session- Since:
 - 2.0.0
 
 - 
webSocketOpened
this method should be called when the websocket is opened- Parameters:
 wffInstanceId- the wffInstanceId which can be retried from the request parameter in websocket connection- Returns:
 - the 
BrowserPageobject associated with this instance id, if the instanceId is associated with a closed http session it will return null. - Since:
 - 2.0.0
 
 - 
webSocketOpened
public WebSocketOpenedRecord webSocketOpened(String wffInstanceId, Function<String, HeartbeatManager> computeHeartbeatManager) this method should be called when the websocket is opened- Parameters:
 wffInstanceId- the wffInstanceId which can be retried from the request parameter in websocket connectioncomputeHeartbeatManager- the function to computeHeartbeatManager.- Returns:
 - the 
WebSocketOpenedRecordobject. It containsBrowserPageobject associated with thiswffInstanceIdandHeartbeatManagerassociated with its http session id. If thewffInstanceIdis associated with a closed http session orwffInstanceIdis associated with theBrowserPageis already removed from the context then this method will returnnull. If this method returnsnull, the givencomputeHeartbeatManagerwill be ignored. - Since:
 - 3.0.16
 
 - 
removeBrowserPage
No need to call this method unless there is a special case like extending the functionality ofBrowserPageContextinstance.- Parameters:
 wffInstanceId- the instance id ofBrowserPage.- Since:
 - 3.0.16
 
 - 
clean
public void clean(long maxIdleTimeout) If any object is idle for a time which is greater than or equal the givenmaxIdleTimeoutit will be removed from theBrowserPageContext. Usually may not need to call this method directly because onceBrowserPageContext#startAutoCleanis called it is internally calling thiscleanmethod.- Parameters:
 maxIdleTimeout- the max idle time to remove the objects. It is usually equal to themaxIdleTimeoutof websocket session. It should be greater than the minInterval given in theHeartbeatManager.- Since:
 - 3.0.16
 
 - 
enableAutoClean
public void enableAutoClean(long maxIdleTimeout) Runs a periodic clean operation when idle time of objects likeBrowserPage,HeartbeatManageretc.. are greater than or equal to the givenmaxIdleTimeout. If it is started it will do the clean operation whenever appropriate, there is no fixed interval of time for this execution.- Parameters:
 maxIdleTimeout- the max idle time in milliseconds to remove the objects. It is usually equal to themaxIdleTimeoutof websocket session. It should be greater than the minInterval given in theHeartbeatManager.- Since:
 - 3.0.16
 
 - 
enableAutoClean
Runs a periodic clean operation when idle time of objects likeBrowserPage,HeartbeatManageretc.. are greater than or equal to the givenmaxIdleTimeout. If it is started it will do the clean operation whenever appropriate, there is no fixed interval of time for this execution.- Parameters:
 maxIdleTimeout- the max idle time in milliseconds to remove the objects. It is usually equal to themaxIdleTimeoutof websocket session. It should be greater than the minInterval given in theHeartbeatManager.executor- the executor object from which the thread will be obtained to run the clean process.- Since:
 - 3.0.16, 3.0.18 bug fix
 
 - 
disableAutoClean
public void disableAutoClean()- Since:
 - 3.0.16
 
 - 
isAutoCleanEnabled
public boolean isAutoCleanEnabled()- Returns:
 - true if the auto clean is enabled by 
enableAutoCleanmethod. - Since:
 - 3.0.16
 
 - 
getHeartbeatManagerForHttpSession
- Parameters:
 httpSessionId-- Returns:
 - the 
HeartbeatManagerassociated with thishttpSessionIdornullif not available. If the last usage time ofHeartbeatManagerof this http session is greater than or equal tomaxIdleTimeoutgiven in theBrowserPageContext#enableAutoClean(long)then this method will returnnull. - Since:
 - 3.0.16
 
 - 
getHeartbeatManagerForBrowserPage
- Parameters:
 wffInstanceId- the wffInstanceId ofBrowserPage.- Returns:
 - the 
HeartbeatManagerassociated with thishttpSessionIdornullif not available. If the last usage time ofHeartbeatManagerof this http session is greater than or equal tomaxIdleTimeoutgiven in theBrowserPageContext#enableAutoClean(long)then this method will returnnull. - Since:
 - 3.0.16
 
 - 
webSocketClosed
Deprecated.this method is for future developmentthis method should be called when the websocket is closed- Parameters:
 wffInstanceId- the wffInstanceId which can be retried from the request parameter in websocket connection- Since:
 - 2.0.0
 
 - 
webSocketClosed
this method should be called when the websocket is closed.- Parameters:
 wffInstanceId- the wffInstanceId which can be retried from the request parameter in websocket connectionsessionId- the websocket session id, i.e. the unique id of the websocket session which is given inBrowserPage#addWebSocketPushListenermethod.- Returns:
 - browserPage instance associated with this wffInstanceId
 - Since:
 - 2.1.0
 
 - 
httpSessionClosed
should be called when the httpsession is closed. The closed http session id should be passed as an argument.- Parameters:
 httpSessionId-- Since:
 - 2.0.0
 
 - 
websocketMessaged
Deprecated.use webSocketMessaged which does the same job.This method is will be removed in the next version. UsewebSocketMessagedmethod instead of this method.- Parameters:
 wffInstanceId- the wffInstanceId which can be retried from the request parameter in websocket connection.message- the message received from websocket- Since:
 - 2.0.0
 
 - 
webSocketMessaged
this method should be called when the websocket is messaged.- Parameters:
 wffInstanceId- the wffInstanceId which can be retried from the request parameter in websocket connection.message- the message received from websocket- Since:
 - 2.1.0
 
 - 
exists
Checks the existence ofbrowserPagein this context.- Parameters:
 browserPage-- Returns:
 - true if the given browserPage exists in the BrowserPageContext.
 - Throws:
 NullValueException- if the given browserPage instance is null- Since:
 - 2.1.13
 
 - 
existsAndValid
Checks the existence of validbrowserPagein this context.
Note: this operation is not atomic. The validity is time dependent, even if the method returns truebrowserPagecould be invalid in the next moment. However, if it returns false it is trust worthy.- Parameters:
 browserPage-- Returns:
 - true if the given browserPage exists in the BrowserPageContext and
         has not expired. The 
browserPageinstance will be considered as invalid if the internal idle time of it is greater than or equal to the time set byenableAutoClean(long)methods. - Throws:
 NullValueException- if the given browserPage instance is null- Since:
 - 3.0.16
 
 - 
isDebugMode
public static boolean isDebugMode()- Returns:
 - true if enabled otherwise false
 - Since:
 - 3.0.18
 
 - 
setDebugMode
public static void setDebugMode(boolean enabled) - Parameters:
 enabled-- Since:
 - 3.0.18
 
 
 -