Package com.sun.identity.common
Class PeriodicGroupMap
- java.lang.Object
-
- com.sun.identity.common.GeneralTaskRunnable
-
- com.sun.identity.common.PeriodicRunnable
-
- com.sun.identity.common.PeriodicGroupRunnable
-
- com.sun.identity.common.PeriodicGroupMap
-
- All Implemented Interfaces:
ScheduleableGroupAction,TaskRunnable,Runnable,Map
- Direct Known Subclasses:
PeriodicCleanUpMap
public class PeriodicGroupMap extends PeriodicGroupRunnable implements Map
PeriodicGroupMap is a general Map and a scheduleable unit. Elements pairs will be grouped by using the time they enter the map. PeriodicGroupMap can be scheduled to Timer or TimerPool. For every run period, ScheduleableGroupAction will act on the elements which are timeout in the map.
-
-
Field Summary
Fields Modifier and Type Field Description protected Mapmap-
Fields inherited from class com.sun.identity.common.PeriodicGroupRunnable
target
-
Fields inherited from class com.sun.identity.common.PeriodicRunnable
containerNeeded, nextTurn, removeElementAfterAction, runPeriod, thisTurn, timeoutPeriod
-
Fields inherited from class com.sun.identity.common.GeneralTaskRunnable
headTask, nextTask, previousTask
-
-
Constructor Summary
Constructors Constructor Description PeriodicGroupMap(ScheduleableGroupAction target, long runPeriod, long timeoutPeriod, boolean removeElementAfterAction)Constructor of PeriodicGroupMap.PeriodicGroupMap(ScheduleableGroupAction target, long runPeriod, long timeoutPeriod, boolean removeElementAfterAction, Map map)Constructor of PeriodicGroupMap.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all the elements.booleancontainsKey(Object key)Checks if the map contains the key.booleancontainsValue(Object value)Checks if the map contains the value.SetentrySet()Returns a Set view of entry in this map.booleanequals(Object o)Compares whether this map is equal to Object o.Objectget(Object key)Gets the element assoicated with the key.inthashCode()Returns hash code of the map.booleanisEmpty()Indicates whether this PeriodicRunnable is empty.SetkeySet()Returns the Set of keys of this map.Objectput(Object key, Object value)Puts the key and element to the map.voidputAll(Map m)Puts all the elements in the map to this map.Objectremove(Object key)Removes the element associated with the key.voidrun()Implements for TaskRunnable.intsize()Returns the size of this map.Collectionvalues()Returns the Collection of values of this map.-
Methods inherited from class com.sun.identity.common.PeriodicGroupRunnable
doGroupAction
-
Methods inherited from class com.sun.identity.common.PeriodicRunnable
addElement, getRunPeriod, getTimeoutPeriod, removeElement
-
Methods inherited from class com.sun.identity.common.GeneralTaskRunnable
cancel, getHeadTask, isScheduled, next, previous, scheduledExecutionTime, setHeadTask, setNext, setPrevious
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Field Detail
-
map
protected Map map
-
-
Constructor Detail
-
PeriodicGroupMap
public PeriodicGroupMap(ScheduleableGroupAction target, long runPeriod, long timeoutPeriod, boolean removeElementAfterAction)
Constructor of PeriodicGroupMap.- Parameters:
target- The ScheduleableGroupAction to run when there is timerunPeriod- Run period in mstimeoutPeriod- timeout period in msremoveElementAfterAction- A boolean to indicate whether to remove the elements after action
-
PeriodicGroupMap
public PeriodicGroupMap(ScheduleableGroupAction target, long runPeriod, long timeoutPeriod, boolean removeElementAfterAction, Map map) throws IllegalArgumentException
Constructor of PeriodicGroupMap.- Parameters:
target- The ScheduleableGroupAction to run when there is timerunPeriod- Run period in mstimeoutPeriod- timeout period in msremoveElementAfterAction- A boolean to indicate whether to remove the elements after actionmap- The synchronized map to use- Throws:
IllegalArgumentException
-
-
Method Detail
-
containsKey
public boolean containsKey(Object key)
Checks if the map contains the key.- Specified by:
containsKeyin interfaceMap- Parameters:
key- The key of the element- Returns:
- boolean to indicate whether the map contains the key
-
containsValue
public boolean containsValue(Object value)
Checks if the map contains the value.- Specified by:
containsValuein interfaceMap- Parameters:
value- The value of the element- Returns:
- boolean to indicate whether the map contains the value
-
putAll
public void putAll(Map m)
Puts all the elements in the map to this map.
-
keySet
public Set keySet()
Returns the Set of keys of this map.
-
values
public Collection values()
Returns the Collection of values of this map.
-
entrySet
public Set entrySet()
Returns a Set view of entry in this map.
-
equals
public boolean equals(Object o)
Compares whether this map is equal to Object o.
-
hashCode
public int hashCode()
Returns hash code of the map.
-
isEmpty
public boolean isEmpty()
Indicates whether this PeriodicRunnable is empty.- Specified by:
isEmptyin interfaceMap- Specified by:
isEmptyin interfaceTaskRunnable- Overrides:
isEmptyin classPeriodicRunnable- Returns:
- A boolean to indicate whether this PeriodicRunnable is empty
-
run
public void run()
Implements for TaskRunnable. Run the function of ScheduleableGroupAction on the objects in thisTurn 1 by 1, and interchange thisTurn and nextTurn.- Specified by:
runin interfaceRunnable- Overrides:
runin classPeriodicGroupRunnable
-
-