Пример #1
0
        public bool isExpired(TicketState ticketState)
        {
            // Ticket has been used, check maxTimeToLive (hard window)
            if ((System.DateTime.Now.Ticks - ticketState.getCreationTime() >= this._maxTimeToLiveInMilliSeconds))
            {
                //if (log.isDebugEnabled()) {
                //    log.debug("Ticket is expired due to the time since creation being greater than the maxTimeToLiveInMilliSeconds");
                //}
                return(true);
            }

            // Ticket is within hard window, check timeToKill (sliding window)
            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this._timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled()) {
                //    log.debug("Ticket is expired due to the time since last use being greater than the timeToKillInMilliseconds");
                //}
                return(true);
            }

            return(false);
        }
 public bool isExpired(TicketState ticketState)
 {
     return((ticketState == null) ||
            (System.DateTime.Now.Ticks - ticketState.getCreationTime() >= this.timeToKillInMilliSeconds));
 }
        public bool isExpired(TicketState ticketState)
        {
            // Ticket has been used, check maxTimeToLive (hard window)
            if ((System.DateTime.Now.Ticks - ticketState.getCreationTime() >= this._maxTimeToLiveInMilliSeconds))
            {
                //if (log.isDebugEnabled()) {
                //    log.debug("Ticket is expired due to the time since creation being greater than the maxTimeToLiveInMilliSeconds");
                //}
                return true;
            }

            // Ticket is within hard window, check timeToKill (sliding window)
            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this._timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled()) {
                //    log.debug("Ticket is expired due to the time since last use being greater than the timeToKillInMilliseconds");
                //}
                return true;
            }

            return false;
        }
 public bool isExpired(TicketState ticketState)
 {
     return (ticketState == null)
            || (System.DateTime.Now.Ticks - ticketState.getCreationTime() >= this.timeToKillInMilliSeconds);
 }