public class

TokenTracker

extends Object
java.lang.Object
   ↳ sun.security.mule.jgss.TokenTracker

Class Overview

A utility class that implements a number list that keeps track of which tokens have arrived by storing their token numbers in the list. It helps detect old tokens, out of sequence tokens, and duplicate tokens. Each element of the list is an interval [a, b]. Its existence in the list implies that all token numbers in the range a, a+1, ..., b-1, b have arrived. Gaps in arrived token numbers are represented by the numbers that fall in between two elements of the list. eg. {[a,b], [c,d]} indicates that the token numbers b+1, ..., c-1 have not arrived yet. The maximum number of intervals that we keep track of is MAX_INTERVALS. Thus if there are too many gaps, then some of the older sequence numbers are deleted from the list. The earliest sequence number that exists in the list is the windowStart. The next expected sequence number, or expectedNumber, is one greater than the latest sequence number in the list. The list keeps track the first token number that should have arrived (initNumber) so that it is able to detect if certain numbers occur after the first valid token number but before windowStart. That would happen if the number of elements (intervals) exceeds MAX_INTERVALS and some initial elements had to be deleted. The working of the list is optimized for the normal case where the tokens arrive in sequence.

Summary

Constants
int MAX_INTERVALS
Fields
private int expectedNumber
private int initNumber
private LinkedList<TokenTracker.Entry> list
private int windowStart
private int windowStartIndex
Public Constructors
TokenTracker(int initNumber)
Public Methods
synchronized final void getProps(int number, MessageProp prop)
Sets the sequencing and replay information for the given token number.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

static final int MAX_INTERVALS

Constant Value: 5 (0x00000005)

Fields

private int expectedNumber

private int initNumber

private LinkedList<TokenTracker.Entry> list

private int windowStart

private int windowStartIndex

Public Constructors

public TokenTracker (int initNumber)

Parameters
initNumber

Public Methods

public final synchronized void getProps (int number, MessageProp prop)

Sets the sequencing and replay information for the given token number. The following represents the number line with positions of initNumber, windowStart, expectedNumber marked on it. Regions in between them show the different sequencing and replay state possibilites for tokens that fall in there. (1) windowStart initNumber expectedNumber | | ---|---------------------------|--- GAP | DUP/UNSEQ | GAP (2) initNumber windowStart expectedNumber | | | ---|---------------|--------------|--- GAP | OLD | DUP/UNSEQ | GAP (3) windowStart expectedNumber initNumber | | ---|---------------------------|--- DUP/UNSEQ | GAP | DUP/UNSEQ (4) expectedNumber initNumber windowStart | | | ---|---------------|--------------|--- DUP/UNSEQ | GAP | OLD | DUP/UNSEQ (5) windowStart expectedNumber initNumber | | | ---|---------------|--------------|--- OLD | DUP/UNSEQ | GAP | OLD (This analysis leaves out the possibility that expectedNumber passes initNumber after wrapping around. That may be added later.)

Parameters
number
prop

public String toString ()