Ejemplo n.º 1
0
  /** Generate and return a new session identifier. */
  protected String generateSessionId() {

    String result = null;

    do {
      if (result != null) {
        duplicates++;
      }

      result = sessionIdGenerator.generateSessionId();

    } while (sessions.containsKey(result));

    return result;
  }
Ejemplo n.º 2
0
  @Override
  protected void startInternal() throws LifecycleException {

    // Ensure caches for timing stats are the right size by filling with
    // nulls.
    while (sessionCreationTiming.size() < TIMING_STATS_CACHE_SIZE) {
      sessionCreationTiming.add(null);
    }
    while (sessionExpirationTiming.size() < TIMING_STATS_CACHE_SIZE) {
      sessionExpirationTiming.add(null);
    }

    sessionIdGenerator = new SessionIdGenerator();
    sessionIdGenerator.setJvmRoute(getJvmRoute());
    sessionIdGenerator.setSecureRandomAlgorithm(getSecureRandomAlgorithm());
    sessionIdGenerator.setSecureRandomClass(getSecureRandomClass());
    sessionIdGenerator.setSecureRandomProvider(getSecureRandomProvider());
    sessionIdGenerator.setSessionIdLength(getSessionIdLength());

    // Force initialization of the random number generator
    if (log.isDebugEnabled()) log.debug("Force random number initialization starting");
    sessionIdGenerator.generateSessionId();
    if (log.isDebugEnabled()) log.debug("Force random number initialization completed");
  }