Class TimedBuffer<O,K>
- java.lang.Object
-
- hudson.plugins.project_inheritance.util.TimedBuffer<O,K>
-
public class TimedBuffer<O,K> extends Object
-
-
Constructor Summary
Constructors Constructor Description TimedBuffer()
Creates a timed buffer that does not make use of a timeoutTimedBuffer(long timeoutMillis)
Creates a timed buffer with the given timeout in milliseconds.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(O obj)
This method removes all keys (and thus values) associated with the given object.void
clearAll()
This method clears everything in this buffer.void
clearAll(K key)
This method clears all values associated with the given key across all objects.void
cull()
This method will remove all entries that aged beyond the assigned timeout.Object
get(O obj, K key)
Map.Entry<Object,Long>
getWithTimestamp(O obj, K key)
void
remove(O obj, K key)
void
set(O obj, K key, Object value)
-
-
-
Constructor Detail
-
TimedBuffer
public TimedBuffer()
Creates a timed buffer that does not make use of a timeout
-
TimedBuffer
public TimedBuffer(long timeoutMillis)
Creates a timed buffer with the given timeout in milliseconds. If this value is zero or negative, no timeout will be used.- Parameters:
timeoutMillis
- timeout in milliseconds.
-
-
Method Detail
-
clear
public void clear(O obj)
This method removes all keys (and thus values) associated with the given object.- Parameters:
obj
- the key to clear
-
clearAll
public void clearAll()
This method clears everything in this buffer.
-
clearAll
public void clearAll(K key)
This method clears all values associated with the given key across all objects.- Parameters:
key
- the value to clear
-
cull
public void cull()
This method will remove all entries that aged beyond the assigned timeout. As this method has a linear complexity, don't call it too often. This method is a O(1) no-op if no timeout is defined for this method.
-
-