/**
* Generate and return a new session identifier.
*/
- protected synchronized String generateSessionId() {
+ protected String generateSessionId() {
byte random[] = new byte[16];
String jvmRoute = getJvmRoute();
}
while (resultLenBytes < this.sessionIdLength) {
- getRandomBytes(random);
- random = getDigest().digest(random);
+ synchronized (this) {
+ getRandomBytes(random);
+ random = getDigest().digest(random);
+ }
for (int j = 0;
j < random.length && resultLenBytes < this.sessionIdLength;
j++) {
/*
* Results on markt's 4-core dev box
- * 1 thread - 2,422ms
- * 2 threads - 5,047ms
- * 4 threads - 13,188ms
- * 16 threads - 54,422ms
+ * 1 thread - ~2,400ms
+ * 2 threads - ~4,700ms
+ * 4 threads - ~12,600ms
+ * 16 threads - ~53,700ms
*/
public void testManagerBaseCreateSession() {
doTestManagerBaseCreateSession(1, 100000);