public abstract class SessionIdGeneratorBase extends LifecycleBase implements SessionIdGenerator
Lifecycle.SingleUse
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
Constructor and Description |
---|
SessionIdGeneratorBase() |
Modifier and Type | Method and Description |
---|---|
protected void |
destroyInternal()
Sub-classes implement this method to perform any instance destruction
required.
|
String |
generateSessionId()
Generate and return a new session identifier.
|
String |
getJvmRoute()
Return the node identifier associated with this node which will be
included in the generated session ID.
|
protected void |
getRandomBytes(byte[] bytes) |
int |
getSessionIdLength()
Return the number of bytes for a session ID
|
protected void |
initInternal()
Sub-classes implement this method to perform any instance initialisation
required.
|
void |
setJvmRoute(String jvmRoute)
Specify the node identifier associated with this node which will be
included in the generated session ID.
|
void |
setSecureRandomAlgorithm(String secureRandomAlgorithm)
Specify a non-default algorithm to use to generate random numbers.
|
void |
setSecureRandomClass(String secureRandomClass)
Specify a non-default @{link
SecureRandom implementation to use. |
void |
setSecureRandomProvider(String secureRandomProvider)
Specify a non-default provider to use to generate random numbers.
|
void |
setSessionIdLength(int sessionIdLength)
Specify the number of bytes for a session ID
|
protected void |
startInternal()
Sub-classes must ensure that the state is changed to
LifecycleState.STARTING during the execution of this method. |
protected void |
stopInternal()
Sub-classes must ensure that the state is changed to
LifecycleState.STOPPING during the execution of this method. |
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
generateSessionId
public void setSecureRandomClass(String secureRandomClass)
SecureRandom
implementation to use.secureRandomClass
- The fully-qualified class namepublic void setSecureRandomAlgorithm(String secureRandomAlgorithm)
secureRandomAlgorithm
- The name of the algorithmpublic void setSecureRandomProvider(String secureRandomProvider)
secureRandomProvider
- The name of the providerpublic String getJvmRoute()
getJvmRoute
in interface SessionIdGenerator
public void setJvmRoute(String jvmRoute)
setJvmRoute
in interface SessionIdGenerator
jvmRoute
- The node identifierpublic int getSessionIdLength()
getSessionIdLength
in interface SessionIdGenerator
public void setSessionIdLength(int sessionIdLength)
setSessionIdLength
in interface SessionIdGenerator
sessionIdLength
- Number of bytespublic String generateSessionId()
generateSessionId
in interface SessionIdGenerator
protected void getRandomBytes(byte[] bytes)
protected void initInternal() throws LifecycleException
LifecycleBase
initInternal
in class LifecycleBase
LifecycleException
- If the initialisation failsprotected void startInternal() throws LifecycleException
LifecycleBase
LifecycleState.STARTING
during the execution of this method.
Changing state will trigger the Lifecycle.START_EVENT
event.
If a component fails to start it may either throw a
LifecycleException
which will cause it's parent to fail to start
or it can place itself in the error state in which case LifecycleBase.stop()
will be called on the failed component but the parent component will
continue to start normally.startInternal
in class LifecycleBase
LifecycleException
- Start error occurredprotected void stopInternal() throws LifecycleException
LifecycleBase
LifecycleState.STOPPING
during the execution of this method.
Changing state will trigger the Lifecycle.STOP_EVENT
event.stopInternal
in class LifecycleBase
LifecycleException
- Stop error occurredprotected void destroyInternal() throws LifecycleException
LifecycleBase
destroyInternal
in class LifecycleBase
LifecycleException
- If the destruction failsCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.