Magentix2
2.1.1
|
Public Member Functions | |
PendingQueueRepository (long deltaToExpire, long intervalToClean) | |
void | addMessage (ACLMessage msg) |
ArrayList< QueueWithTimestamp > | popQueues (MessageFilter template) |
Queue< ACLMessage > | popQueue (String cid) |
synchronized void | cleanRepository (long delta) |
synchronized HashMap< String, QueueWithTimestamp > | getQueueMap () |
long | getDeltaToExpire () |
void | setDeltaToExpire (long deltaToExpire) |
long | getIntervalToClean () |
void | setIntervalToClean (long intervalToClean) |
Definition at line 11 of file PendingQueueRepository.java.
es.upv.dsic.gti_ia.cAgents.PendingQueueRepository.PendingQueueRepository | ( | long | deltaToExpire, |
long | intervalToClean | ||
) |
Definition at line 18 of file PendingQueueRepository.java.
{ this.deltaToExpire = deltaToExpire; this.intervalToClean = intervalToClean; queueMap = new HashMap<String, QueueWithTimestamp>(); referenceDate = new Date(); }
Definition at line 25 of file PendingQueueRepository.java.
{ if (!hasQueueWithCid(msg)) { queueMap.put(msg.getConversationId(), new QueueWithTimestamp()); queueMap.get(msg.getConversationId()).addMessage(msg); } else { queueMap.get(msg.getConversationId()).addMessage(msg); } if(new Date().getTime()- referenceDate.getTime() > intervalToClean){ cleanRepository(getDeltaToExpire()); referenceDate = new Date(); } }
synchronized void es.upv.dsic.gti_ia.cAgents.PendingQueueRepository.cleanRepository | ( | long | delta | ) |
Definition at line 78 of file PendingQueueRepository.java.
{ ArrayList<String> cidsToClean = new ArrayList<String>(); for (String cId : queueMap.keySet()) { if (!queueMap.get(cId).checkTimestamp(delta)) { cidsToClean.add(cId); } } if (!cidsToClean.isEmpty()) { for (String cid : cidsToClean) { queueMap.remove(cid); } } }
Definition at line 96 of file PendingQueueRepository.java.
{
return deltaToExpire;
}
Definition at line 104 of file PendingQueueRepository.java.
{
return intervalToClean;
}
synchronized HashMap<String, QueueWithTimestamp> es.upv.dsic.gti_ia.cAgents.PendingQueueRepository.getQueueMap | ( | ) |
Definition at line 92 of file PendingQueueRepository.java.
{
return queueMap;
}
Queue<ACLMessage> es.upv.dsic.gti_ia.cAgents.PendingQueueRepository.popQueue | ( | String | cid | ) |
Definition at line 70 of file PendingQueueRepository.java.
{ if (hasQueueWithCid(cid)) { return getQueueMap().get(cid).getQueue(); } else { return null; } }
ArrayList<QueueWithTimestamp> es.upv.dsic.gti_ia.cAgents.PendingQueueRepository.popQueues | ( | MessageFilter | template | ) |
Definition at line 57 of file PendingQueueRepository.java.
{ ArrayList<QueueWithTimestamp> queuesWithTimestamp = new ArrayList<QueueWithTimestamp>( queueMap.values()); ArrayList<QueueWithTimestamp> matchingQueues = new ArrayList<QueueWithTimestamp>(); for (QueueWithTimestamp theQueue : queuesWithTimestamp) { if (template == null || template.compareHeaders(theQueue.getQueue().peek())) { matchingQueues.add(theQueue); } } return matchingQueues; }
void es.upv.dsic.gti_ia.cAgents.PendingQueueRepository.setDeltaToExpire | ( | long | deltaToExpire | ) |
Definition at line 100 of file PendingQueueRepository.java.
{ this.deltaToExpire = deltaToExpire; }
void es.upv.dsic.gti_ia.cAgents.PendingQueueRepository.setIntervalToClean | ( | long | intervalToClean | ) |
Definition at line 108 of file PendingQueueRepository.java.
{ this.intervalToClean = intervalToClean; }