public class DebugInfoReceiverQueue extends java.lang.Object implements DebugReceiver
DebugReceiver interface. A queue abstraction for caching
DebugInfo elements allows for
capacity bounds and the definition of a retention policy. Elements are
maintained in a FIFO order and stored and retrieved on a per agent basis.
Retrieval can be blocking or non-blocking and the caching of new elements can
be dynamically suspended and resumed on a solution wide basis.
This class was not explicitly designed to be extended.
| Modifier and Type | Class and Description |
|---|---|
static class |
DebugInfoReceiverQueue.DiscardPolicy
Define the the retention policy options for the agent queues.
|
| Constructor and Description |
|---|
DebugInfoReceiverQueue()
Deprecated.
|
DebugInfoReceiverQueue(DriverProperties driverProperties)
Create a new
DebugInfoReceiverQueue cache for the agents of a
given solution. |
| Modifier and Type | Method and Description |
|---|---|
void |
addDebugInfo(DebugInfo instance,
java.lang.String sourceagent)
The default policy is to discard the newest (arriving) elements if the
capacity limits for a given agent queue are reached.
|
java.lang.String[] |
agentQueueNames()
Answers with the names of all agent queues in use for caching at the time
of the call.
|
void |
clearDebugInfo()
Remove all
DebugInfo elements from all agent queues. |
void |
clearDebugInfo(java.lang.String agent)
Remove all
DebugInfo elements from the target agent queue. |
int |
getCapacity()
Answers with the maximum element capacity of the individual agent queues.
|
DebugInfo |
getDebugInfo(java.lang.String agent)
Retrieves the element at the head of the queue for a given agent,
removing it from the queue.
|
DebugInfo[] |
getDebugInfo(java.lang.String agent,
int count)
Retrieves and removes at most the given number of available elements from
the named agent queue.
|
DebugInfo |
getDebugInfo(java.lang.String agent,
long timeout,
java.util.concurrent.TimeUnit unit)
Retrieves and removes the element at the head of the given agent queue,
waiting up to the specified wait time if necessary for an element to
become available.
|
DebugInfo[] |
getDebugInfo(java.lang.String agent,
long timeout,
java.util.concurrent.TimeUnit unit,
int count)
Retrieves and removes at most the given number of available elements from
the named agent queue, waiting up to the specified amount of time for those
elements to appear.
|
DebugInfoReceiverQueue.DiscardPolicy |
getDiscardPolicy()
Answers with the current state of the agent queue retention policy.
|
boolean |
isPaused()
Answers whether the the caching of new
DebugInfo elements has been
suspended. |
DebugInfo |
peekDebugInfo(java.lang.String agent)
Retrieves the element at the head of the queue for the given agent.
|
void |
setDiscardPolicy(DebugInfoReceiverQueue.DiscardPolicy policy)
Set the retention policy for all agent queues.
|
void |
setPaused(boolean pause)
Suspend or resume the caching of
DebugInfo elements on a
solution wide basis. |
int |
sizeDebugInfo(java.lang.String agent)
Answers the number of
DebugInfo
elements in a given agent's queue at the time of the call. |
DebugInfo |
takeDebugInfo(java.lang.String agent)
Retrieves and removes the element at the head of this agent queue,
waiting if necessary until an element becomes available.
|
@Deprecated public DebugInfoReceiverQueue()
DebugInfoReceiverQueue(DriverProperties).DebugInfoReceiverQueue cache for the agents of a
given solution. Capacity limits for the agent element queues are set to
the default value from DriverProperties class.public DebugInfoReceiverQueue(DriverProperties driverProperties)
DebugInfoReceiverQueue cache for the agents of a
given solution. Capacity limits for the agent element queues are set to
the value from the supplied DriverProperties class.driverProperties - a DriverProperties object containing the desired
capacity limit for agent queuespublic void addDebugInfo(DebugInfo instance, java.lang.String sourceagent)
addDebugInfo in interface DebugReceiversourceagent - - the name of the agent which generated the eventDebugReceiver.addDebugInfo(com.ibm.ia.common.debug.DebugInfo,
java.lang.String)public DebugInfo peekDebugInfo(java.lang.String agent)
agent - the name of agent queue to peek intoDebugInfo element or
null if the queue is empty or there is no queue for the agentpublic DebugInfo takeDebugInfo(java.lang.String agent) throws java.lang.InterruptedException
java.lang.InterruptedException - if interrupted while waitingagent - the name of agent queue to take fromDebugInfo element
from the head of the agent's queue, null if there is no queue
for the requested agentpublic DebugInfo getDebugInfo(java.lang.String agent)
agent - the name of agent queue to get fromDebugInfo element or
null if the queue is empty or there is no queue for the agentpublic DebugInfo getDebugInfo(java.lang.String agent, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
java.lang.InterruptedException - if interrupted while waitingagent - the name of the agent queue to get fromtimeout - how long to wait in units of unit before returningunit - a TimeUnit describing how to interpret the
timeout valueDebugInfo element or
null if the time to wait expires and the queue is still empty
or there is no queue for the agentpublic DebugInfo[] getDebugInfo(java.lang.String agent, int count)
agent - the name of the agent queue to get fromcount - the maximum number of DebugInfo elements to returnDebugInfo
elements where the size of the array is from zero up to the
countpublic DebugInfo[] getDebugInfo(java.lang.String agent, long timeout, java.util.concurrent.TimeUnit unit, int count) throws java.lang.InterruptedException
count is 1) then use
getDebugInfo(String, long, TimeUnit).java.lang.InterruptedException - if interrupted while waitingagent - the agent queue to get fromtimeout - how long to wait in units of unit before returningunit - a TimeUnit describing how to interpret the
timeout valuecount - the maximum number of DebugInfo elements to returnDebugInfo
elements where the size of the array is from zero up to the
countpublic java.lang.String[] agentQueueNames()
DebugInfo
object arrives a new queue is created. When an agent queue is cleared via
clearDebugInfo(String) or
clearDebugInfo() it is dropped until a new
DebugInfo arrives.public int sizeDebugInfo(java.lang.String agent)
DebugInfo
elements in a given agent's queue at the time of the call.agent - the name of agent queue to sizeDebugInfo elements in the agent queue, -1
if the size could not be determinedpublic void clearDebugInfo()
DebugInfo elements from all agent queues. Caching is
automatically paused during this operation if it was not paused already.
The state of caching is restored before exiting.public void clearDebugInfo(java.lang.String agent)
DebugInfo elements from the target agent queue.
Caching is automatically paused during this operation if it was not
paused already. The state of caching is restored before exiting.agent - the name of the agent queue to clearpublic int getCapacity()
DebugInfo elements are
handled according to the queue retention policy.DebugInfo elements each agent queue
can holdpublic DebugInfoReceiverQueue.DiscardPolicy getDiscardPolicy()
DISCARDNEWEST if arriving elements are to be discarded or
DISCARDOLDEST if the oldest elements should be evicted insteadpublic void setDiscardPolicy(DebugInfoReceiverQueue.DiscardPolicy policy)
DebugInfo element would cause
an agent's queue to exceed its capacity, elements are discarded or evicted
from the queue. The elements to be discarded can be the arriving elements
or the oldest elements in the queue.policy - DISCARDNEWEST to have arriving elements discarded or
DISCARDOLDEST to have the oldest elements removed from
the queuepublic boolean isPaused()
DebugInfo elements has been
suspended. When caching is suspended arriving DebugInfo elements
are discarded.boolean value of true if caching is suspended,
false if caching is activepublic void setPaused(boolean pause)
DebugInfo elements on a
solution wide basis. When caching is paused, arriving DebugInfo
elements are discarded.pause - a boolean value of true suspends caching,
false resumes© Copyright IBM 2017