public class GenerateUniqueId extends Object
This code was borrowed from Apache JServ.JServServletManager.java. It is what Apache JServ uses to generate session ids for users. Unfortunately, it was not included in Apache JServ as a class, so I had to create one here in order to use it.
Modifier and Type | Field and Description |
---|---|
static long |
maxRandomLen
We want to have a random string with a length of 6 characters.
|
static long |
maxSessionLifespanTics
The session identifier must be unique within the typical
lifespan of a Session; the value can roll over after that. 3
characters: (this means a roll over after over a day, which is
much larger than a typical lifespan)
|
static long |
ticDifference
Millisecons between different tics.
|
Constructor and Description |
---|
GenerateUniqueId() |
Modifier and Type | Method and Description |
---|---|
static String |
getIdentifier()
Get the unique id.
|
String |
getIdentifier(String jsIdent)
Get the unique id.
|
static void |
main(String[] args)
Simple test of the functionality.
|
public static final long maxRandomLen
public static final long maxSessionLifespanTics
public static final long ticDifference
public GenerateUniqueId()
public static String getIdentifier()
NOTE: This must work together with get_jserv_session_balance() in jserv_balance.c
public String getIdentifier(String jsIdent)
jsIdent
- A String.Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.