Code example for SecureRandom

Methods: nextInt

0
                        " buffers"); 
            } 
        } catch (AuthenticationException e) {
            throw new NotAuthorizedException(e.getMessage());
        } 
        SecureRandom rand = new SecureRandom();
        String token = Integer.toString(rand.nextInt());
        if (authorizedQueues.containsKey(queueName)) {
            // an already authorized user try to login again let him/her login again 
            String oldToken = authorizedQueues.get(queueName);
            authorizedQueues.remove(queueName);
            if (requestBuffers.containsKey(oldToken)) {
                BlockingQueue<Message> oldBuffer = requestBuffers.remove(oldToken);
                // initialize the new buffer with the existing messages 
                requestBuffers.put(token, new LinkedBlockingQueue<Message>(oldBuffer));
            } 
        } else { 
            // initialize the buffer for this request 
            requestBuffers.put(token, new LinkedBlockingQueue<Message>());
        } 
        authorizedQueues.put(queueName, token);