Code example for ConcurrentMap

Methods: put

0
    public void save(final String proxyGrantingTicketIou, final String proxyGrantingTicket) {
        final ProxyGrantingTicketHolder holder = new ProxyGrantingTicketHolder(proxyGrantingTicket);
 
        logger.debug("Saving ProxyGrantingTicketIOU and ProxyGrantingTicket combo: [{}, {}]", proxyGrantingTicketIou,
                proxyGrantingTicket);
        this.cache.put(proxyGrantingTicketIou, holder);
    } 
 
    /** 
     * Cleans up old, expired proxy tickets. This method must be 
     * called regularly via an external thread or timer. 
     */ 
    public void cleanUp() { 
        for (final Map.Entry<String, ProxyGrantingTicketHolder> holder : this.cache.entrySet()) {
            if (holder.getValue().isExpired(this.timeout)) {
                this.cache.remove(holder.getKey());
            } 
        } 
    } 
 
    private static final class ProxyGrantingTicketHolder {