Skip to content

Commit

Permalink
fix failure
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed May 26, 2020
1 parent 6b6032c commit 0defa43
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.apereo.cas.ticket.registry;

import org.apereo.cas.ticket.ExpirationPolicy;
import org.apereo.cas.ticket.Ticket;

import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -40,12 +41,9 @@ public void addTicket(final Ticket ticketToAdd) {
? expirationPolicy.getTimeToLive()
: expirationPolicy.getTimeToIdle();

LOGGER.debug("Adding ticket [{}] to cache store to live [{}] seconds and stay idle for [{}]",
ticketToAdd.getId(), getTimeToLive(expirationPolicy), idleTime);

this.cache.put(ticket.getId(), ticket,
expirationPolicy.getTimeToLive(), TimeUnit.SECONDS,
idleTime, TimeUnit.SECONDS);
val ttl = getTimeToLive(expirationPolicy);
LOGGER.debug("Adding ticket [{}] to cache store to live [{}] seconds and stay idle for [{}]", ticketToAdd.getId(), ttl, idleTime);
this.cache.put(ticket.getId(), ticket, ttl, TimeUnit.SECONDS, idleTime, TimeUnit.SECONDS);
}

@Override
Expand Down Expand Up @@ -73,19 +71,13 @@ public long deleteAll() {
this.cache.clear();
return size;
}

/**
* Retrieve all tickets from the registry.
*
* @return collection of tickets currently stored in the registry. Tickets
* might or might not be valid i.e. expired.
*/

@Override
public Collection<? extends Ticket> getTickets() {
return decodeTickets(this.cache.values());
}
private Long getTimeToLive(ExpirationPolicy expirationPolicy) {

private static Long getTimeToLive(final ExpirationPolicy expirationPolicy) {
val timeToLive = expirationPolicy.getTimeToLive();
return Long.MAX_VALUE == timeToLive ? Long.valueOf(Integer.MAX_VALUE) : timeToLive;
}
Expand Down

0 comments on commit 0defa43

Please sign in to comment.