Пример #1
0
        public bool isExpired(TicketState ticketState)
        {
            if (ticketState.getCountOfUses() == 0 &&
                (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() < this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is not expired due to a count of zero and the time being less than the timeToKillInMilliseconds");
                //}
                return(false);
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
                //}
                return(true);
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() <= this.timeInBetweenUsesInMilliSeconds))
            {
                //log
                //    .warn("Ticket is expired due to the time being less than the waiting period.");
                return(true);
            }

            return(false);
        }
        public bool isExpired(TicketState ticketState)
        {
            if (ticketState.getCountOfUses() == 0
                && (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() < this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is not expired due to a count of zero and the time being less than the timeToKillInMilliseconds");
                //}
                return false;
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds))
            {
                //if (log.isDebugEnabled())
                //{
                //    log
                //        .debug("Ticket is expired due to the time being greater than the timeToKillInMilliseconds");
                //}
                return true;
            }

            if ((System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() <= this.timeInBetweenUsesInMilliSeconds))
            {
                //log
                //    .warn("Ticket is expired due to the time being less than the waiting period.");
                return true;
            }

            return false;
        }
Пример #3
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)
            || (ticketState.getCountOfUses() >= this.numberOfUses)
            || (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= this.timeToKillInMilliSeconds);
 }
 public bool isExpired(TicketState ticketState)
 {
     return((ticketState == null) ||
            (System.DateTime.Now.Ticks - ticketState.getLastTimeUsed() >= 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;
        }