FRODO Version 2.19.1
An open-source framework for Distributed Constraint Optimization (DCOP)
Loading...
Searching...
No Matches
frodo2.communication.Queue Class Reference

A queue. More...

Inheritance diagram for frodo2.communication.Queue:

Public Member Functions

 Queue (boolean measureMsgs)
 Constructor.
 Queue (boolean measureMsgs, boolean init)
 Constructor.
void toBeClosedUponKill (QueueInputPipeInterface input)
 Reminds the queue to close the given pipe when it is killed.
void removeInputPipe (QueueInputPipeInterface input)
 Removes the given input pipe from the list of input pipes.
void addOutputPipe (Object recipient, QueueOutputPipeInterface output)
 Adds an output pipe to this queue.
QueueOutputPipeInterface getOutputPipe (Object recipient)
 Returns the output pipe corresponding to the given recipient.
void removeOutputPipe (Object recipient)
 Removes the output pipe corresponding to the given recipient.
QueueIOPipe addOutputQueue (Object recipient, Queue queue)
 Adds a new output pipe to the provided queue.
void addIncomingMessagePolicy (IncomingMsgPolicyInterface< MessageType > policy)
 Adds a listener to be notified of new incoming messages.
void addIncomingMessagePolicy (Collection< MessageType > msgTypes, IncomingMsgPolicyInterface< MessageType > policy)
 Adds a listener to be notified of new incoming messages.
void addIncomingMessagePolicy (MessageType type, IncomingMsgPolicyInterface< MessageType > policy)
 Adds a listener to be notified of new incoming messages of type type.
void addOutgoingMessagePolicy (OutgoingMsgPolicyInterface< MessageType > policy)
 Adds a listener to be notified of new outgoing messages.
void addOutgoingMessagePolicy (Collection< MessageType > msgTypes, OutgoingMsgPolicyInterface< MessageType > policy)
 Adds a listener to be notified of new outgoing messages.
void addOutgoingMessagePolicy (MessageType type, OutgoingMsgPolicyInterface< MessageType > policy)
 Adds a listener to be notified of new outgoing messages of type type.
void addToInbox (MessageWrapper msg)
 Adds the input message to this queue's inbox.
void sendMessage (Object to, Message msg)
 Sends a message to a specified recipient.
void sendMessage (Object to, MessageWrapper msgWrap)
 Send a message that has already been wrapped.
void sendMessageToSelf (Message msg)
 Sends a message to itself.
void end ()
 Kills the queue, making it unusable.
void run ()
 Continuously processes all messages in the inbox.
void deleteIncomingMessagePolicy (IncomingMsgPolicyInterface< MessageType > policy)
 Completely removes the input policy from all lists of listeners.
void deleteStatsReporters ()
 Delete all StatsReporters.
void deleteOutgoingMessagePolicy (OutgoingMsgPolicyInterface< MessageType > policy)
 Completely removes the outgoing message policy from all lists of listeners.
void cleanQueue ()
 Removes all messages from the inbox.
void setProblem (ProblemInterface<?, ?> problem)
 Sets the problem that is queried for NCCCs.
void updateNCCCs (long msgNCCCs)
 Updates the queue's NCCC counter to the input count if the input is greater.
long getCurrentTime ()
int getInboxSize ()
MessageWrapper getCurrentMessageWrapper ()
HashMap< MessageType, Integer > getMsgNbrs ()
HashMap< Object, Integer > getMsgNbrsSent ()
HashMap< MessageType, Long > getMsgSizes ()
HashMap< Object, Long > getMsgSizesSent ()
HashMap< MessageType, Long > getMaxMsgSizes ()
void resetStats ()
 Resets the metrics statistics.
void resetMsgSizeMonitor ()
 Closes the MsgSizeMonitor and creates a new one.

Static Public Member Functions

static String networkToDOT (Queue[] queues)
 Generates a String representation in DOT format of a network of queues.

Protected Member Functions

 Queue ()
 Empty constructor that does absolutely nothing.
void notifyInListeners (Message msg, Object toAgent)
 Notifies the incoming message listeners of a message.
boolean notifyOutListeners (Object fromAgent, Message msg, Collection<? extends Object > toAgents)
 Notifies the outgoing message listeners of a message.
void recordStats (Object to, Message msg)
 Records statistics about the input message.

Protected Attributes

Set< QueueInputPipeInterfaceinputs
 List of input pipes.
HashMap< Object, QueueOutputPipeInterfaceoutputs
 Map associating an output pipe to each destination ID.
MsgSizeMonitor monitor
 A monitor used to measure the sizes of the messages.
HashMap< MessageType, ArrayList< IncomingMsgPolicyInterface< MessageType > > > inPolicies
 A list of listeners notified of incoming objects.
HashMap< MessageType, ArrayList< OutgoingMsgPolicyInterface< MessageType > > > outPolicies
 A list of listeners notified of outgoing messages.
ProblemInterface<?, ?> problem
 The problem used to obtain the current NCCC count.
final boolean measureMsgs
 Whether to measure the number of messages and the total amount of information sent.
HashMap< MessageType, Integer > msgNbrs
 For each message type, the number of messages sent of that type.
HashMap< MessageType, Long > msgSizes
 For each message type, the total amount of information sent in messages of that type, in bytes.
HashMap< MessageType, Long > maxMsgSizes
 For each message type, the size (in bytes) of the largest message of that type.
MessageWrapper msgWrap
 The last wrapped message to have been received.

Package Functions

public< T extends Object > void sendMessageToMulti (Collection< T > recipients, Message msg)
 Sends a message to all specified recipients.

Private Member Functions

void init ()
 Helper function called by the constructors to avoid code redundancy.
void toDOT (StringBuilder out, int ID)
 Creates a fragment of DOT representation for this queue and its pipes.

Private Attributes

BlockingQueue< MessageWrapperinbox
 The list of incoming messages waiting to be processed.
final ReentrantLock outPolicies_lock = new ReentrantLock()
 Lock for outPolicies field.
boolean keepGoing = true
 Used to tell the thread to stop.
Thread myThread
 The queue's thread.
HashMap< Object, Integer > msgNbrsSent
 The number of messages sent to each other agent.
HashMap< Object, Long > msgSizesSent
 The amount of information sent to each other agent, in bytes.
final ReentrantLock input_lock = new ReentrantLock()
 lock for input field
final ReentrantLock output_lock = new ReentrantLock()
 lock for output field
final ReentrantLock inPolicies_lock = new ReentrantLock()
 lock for inPolicies field

Detailed Description

A queue.

Author
Thomas Leaute

Constructor & Destructor Documentation

◆ Queue() [1/3]

frodo2.communication.Queue.Queue ( )
protected

◆ Queue() [2/3]

frodo2.communication.Queue.Queue ( boolean measureMsgs)

Constructor.

Parameters
measureMsgswhether to measure the number of messages and the total amount of information sent

References measureMsgs.

◆ Queue() [3/3]

frodo2.communication.Queue.Queue ( boolean measureMsgs,
boolean init )

Constructor.

Parameters
measureMsgswhether to measure the number of messages and the total amount of information sent
initwhether the init() method should be called

References init(), and measureMsgs.

Here is the call graph for this function:

Member Function Documentation

◆ addIncomingMessagePolicy() [1/3]

void frodo2.communication.Queue.addIncomingMessagePolicy ( Collection< MessageType > msgTypes,
IncomingMsgPolicyInterface< MessageType > policy )

Adds a listener to be notified of new incoming messages.

Parameters
msgTypesthe message types the policy should be registered for
policyIncoming object policy to be added

References addIncomingMessagePolicy().

Here is the call graph for this function:

◆ addIncomingMessagePolicy() [2/3]

void frodo2.communication.Queue.addIncomingMessagePolicy ( IncomingMsgPolicyInterface< MessageType > policy)

Adds a listener to be notified of new incoming messages.

It prompts the listener for the types of messages it wants to listen to.

Parameters
policyIncoming object policy to be added

Reimplemented in frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.FakeQueue.

References addIncomingMessagePolicy(), and frodo2.communication.MessageListener< T >.getMsgTypes().

Referenced by addIncomingMessagePolicy(), addIncomingMessagePolicy(), frodo2.algorithms.dpop.param.test.ParamVALUEtest< U extends Addable< U > >.Listener.getStatsFromQueue(), frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.Listener.getStatsFromQueue(), frodo2.algorithms.varOrdering.election.tests.SecureVarElectionTest.initiateParamAndListener(), frodo2.algorithms.varOrdering.election.tests.VariableElectionTest< S extends Comparable< S > &Serializable >.initiateParamAndListener(), frodo2.algorithms.varOrdering.election.tests.LeaderElectionMaxIDTest< S extends Comparable< S > >.initiatingIDandListener(), frodo2.algorithms.varOrdering.election.tests.VarElectionMessengerTest.initiatingIDandListener(), frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.Listener(), frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.Listener.Listener(), frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.randomTest(), frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.randomTest(), frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.setModules(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.setModules(), frodo2.algorithms.dpop.privacy.test.SecureCircularRoutingTest.setUp(), frodo2.algorithms.dpop.stochastic.test.ExpectedUTILtest.Listener.setUpPrelimModules(), frodo2.algorithms.adopt.test.testADOPT.test(), frodo2.algorithms.asodpop.tests.ASODPOPBinaryTest< V extends Addable< V >, U extends Addable< U > >.test(), frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.test(), frodo2.algorithms.duct.tests.NormalizeInfTest.test(), frodo2.algorithms.duct.tests.NormalizeTest.test(), frodo2.algorithms.odpop.tests.UTILpropagationTest< V extends Addable< V >, U extends Addable< U > >.test(), frodo2.algorithms.odpop.tests.VALUEpropagationTest< V extends Addable< V >, U extends Addable< U > >.test(), frodo2.algorithms.varOrdering.linear.tests.CentralLinearOrderingTest.test(), frodo2.daemon.TestLocalWhitePages.testLocalAgentAddressRequestUnknown(), frodo2.communication.mailer.tests.testCentralMailer.testNext(), frodo2.algorithms.adopt.test.testPreprocessing.testRandom(), frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.testRandom(), and frodo2.algorithms.varOrdering.election.tests.VariableElectionTest< S extends Comparable< S > &Serializable >.testRandom().

Here is the call graph for this function:

◆ addIncomingMessagePolicy() [3/3]

void frodo2.communication.Queue.addIncomingMessagePolicy ( MessageType type,
IncomingMsgPolicyInterface< MessageType > policy )

Adds a listener to be notified of new incoming messages of type type.

Parameters
typethe type of messages
policyincoming object policy to be used

Reimplemented in frodo2.communication.mailer.CentralMailer.FakeQueue.

References inPolicies, inPolicies_lock, and frodo2.communication.MessageListener< T >.setQueue().

Here is the call graph for this function:

◆ addOutgoingMessagePolicy() [1/3]

void frodo2.communication.Queue.addOutgoingMessagePolicy ( Collection< MessageType > msgTypes,
OutgoingMsgPolicyInterface< MessageType > policy )

Adds a listener to be notified of new outgoing messages.

Parameters
msgTypesthe message types the policy should be registered for
policyoutgoing message policy to be added

References addOutgoingMessagePolicy().

Here is the call graph for this function:

◆ addOutgoingMessagePolicy() [2/3]

void frodo2.communication.Queue.addOutgoingMessagePolicy ( MessageType type,
OutgoingMsgPolicyInterface< MessageType > policy )

Adds a listener to be notified of new outgoing messages of type type.

Parameters
typethe type of messages
policyoutgoing object policy to be used

Reimplemented in frodo2.communication.mailer.CentralMailer.FakeQueue.

References outPolicies, outPolicies_lock, and frodo2.communication.MessageListener< T >.setQueue().

Here is the call graph for this function:

◆ addOutgoingMessagePolicy() [3/3]

void frodo2.communication.Queue.addOutgoingMessagePolicy ( OutgoingMsgPolicyInterface< MessageType > policy)

Adds a listener to be notified of new outgoing messages.

It prompts the listener for the types of messages it wants to listen to.

Parameters
policyoutgoing message policy to be added

References addOutgoingMessagePolicy(), and frodo2.communication.MessageListener< T >.getMsgTypes().

Referenced by addOutgoingMessagePolicy(), addOutgoingMessagePolicy(), frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.randomTest(), and frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.randomTest().

Here is the call graph for this function:

◆ addOutputPipe()

void frodo2.communication.Queue.addOutputPipe ( Object recipient,
QueueOutputPipeInterface output )

Adds an output pipe to this queue.

Parameters
recipientID of the recipient
outputoutput pipe corresponding to the recipient
Warning
If there already exists a known recipient with name name, its pipe will be replaced by output.

Reimplemented in frodo2.communication.mailer.CentralMailer.FakeQueue.

References frodo2.output, output_lock, and outputs.

Referenced by addOutputQueue(), frodo2.algorithms.test.AllTests.createQueueNetwork(), frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.setup(), frodo2.daemon.TestLocalWhitePages.testLocalAgentAddressRequestKnown(), frodo2.daemon.TestLocalWhitePages.testLocalAgentAddressRequestUnknown(), and frodo2.daemon.TestLocalWhitePages.testLocalAgentReporting().

◆ addOutputQueue()

QueueIOPipe frodo2.communication.Queue.addOutputQueue ( Object recipient,
Queue queue )

Adds a new output pipe to the provided queue.

Parameters
recipientID of the recipient
queuerecipient
Returns
the created output pipe
Warning
If there already exists a known recipient with name recipient, its pipe will be replaced.

References addOutputPipe(), and Queue().

Here is the call graph for this function:

◆ addToInbox()

void frodo2.communication.Queue.addToInbox ( MessageWrapper msg)

Adds the input message to this queue's inbox.

Parameters
msgthe message

Reimplemented in frodo2.communication.mailer.CentralMailer.FakeQueue.

References inbox.

Referenced by sendMessageToSelf().

◆ cleanQueue()

void frodo2.communication.Queue.cleanQueue ( )

Removes all messages from the inbox.

Reimplemented in frodo2.communication.mailer.CentralMailer.FakeQueue.

References inbox.

◆ deleteIncomingMessagePolicy()

void frodo2.communication.Queue.deleteIncomingMessagePolicy ( IncomingMsgPolicyInterface< MessageType > policy)

Completely removes the input policy from all lists of listeners.

Parameters
policythe policy to be removed

References inPolicies, and inPolicies_lock.

◆ deleteOutgoingMessagePolicy()

void frodo2.communication.Queue.deleteOutgoingMessagePolicy ( OutgoingMsgPolicyInterface< MessageType > policy)

Completely removes the outgoing message policy from all lists of listeners.

Parameters
policythe policy to be removed

References outPolicies, and outPolicies_lock.

◆ deleteStatsReporters()

void frodo2.communication.Queue.deleteStatsReporters ( )

Delete all StatsReporters.

References inPolicies.

Referenced by frodo2.controller.ConfigurationManager.cleanProblem().

◆ end()

◆ getCurrentMessageWrapper()

MessageWrapper frodo2.communication.Queue.getCurrentMessageWrapper ( )
Returns
The message wrapper of the last message received

◆ getCurrentTime()

long frodo2.communication.Queue.getCurrentTime ( )

◆ getInboxSize()

int frodo2.communication.Queue.getInboxSize ( )
Returns
the size of the inbox

Reimplemented in frodo2.communication.mailer.CentralMailer.FakeQueue.

◆ getMaxMsgSizes()

HashMap< MessageType, Long > frodo2.communication.Queue.getMaxMsgSizes ( )
Returns
for each message type, the size (in bytes) of the largest message of that type

References maxMsgSizes.

◆ getMsgNbrs()

HashMap< MessageType, Integer > frodo2.communication.Queue.getMsgNbrs ( )
Returns
for each message type, the number of messages sent of that type

References msgNbrs.

◆ getMsgNbrsSent()

HashMap< Object, Integer > frodo2.communication.Queue.getMsgNbrsSent ( )
Returns
the number of messages sent to each other agent

References msgNbrsSent.

◆ getMsgSizes()

HashMap< MessageType, Long > frodo2.communication.Queue.getMsgSizes ( )
Returns
for each message type, the total amount of information sent in messages of that type, in bytes

References msgSizes.

◆ getMsgSizesSent()

HashMap< Object, Long > frodo2.communication.Queue.getMsgSizesSent ( )
Returns
the amount of information sent to each other agent, in bytes

References msgSizesSent.

◆ getOutputPipe()

QueueOutputPipeInterface frodo2.communication.Queue.getOutputPipe ( Object recipient)

Returns the output pipe corresponding to the given recipient.

Parameters
recipientthe recipient
Returns
its corresponding output pipe, or null if none

References output_lock, and outputs.

Referenced by frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.connect(), and frodo2.algorithms.test.AllTests.createQueueNetwork().

◆ init()

void frodo2.communication.Queue.init ( )
private

Helper function called by the constructors to avoid code redundancy.

Reimplemented in frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >.

References inbox, inPolicies, inputs, myThread, outPolicies, outputs, and frodo2.communication.MessageType.ROOT.

Referenced by Queue().

◆ networkToDOT()

String frodo2.communication.Queue.networkToDOT ( Queue[] queues)
static

Generates a String representation in DOT format of a network of queues.

Parameters
queueslist of queues in the network
Returns
DOT representation for the network
Note
Only works with QueueIOPipes.

References Queue(), and toDOT().

Here is the call graph for this function:

◆ notifyInListeners()

void frodo2.communication.Queue.notifyInListeners ( Message msg,
Object toAgent )
protected

Notifies the incoming message listeners of a message.

Parameters
msgthe message
toAgentID of the destination agent

Reimplemented in frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.FakeQueue, and frodo2.communication.mailer.CentralMailer.FakeQueue.

References frodo2.communication.MessageType.getParent(), frodo2.communication.Message.getType(), inPolicies, and inPolicies_lock.

Referenced by run().

Here is the call graph for this function:

◆ notifyOutListeners()

boolean frodo2.communication.Queue.notifyOutListeners ( Object fromAgent,
Message msg,
Collection<? extends Object > toAgents )
protected

Notifies the outgoing message listeners of a message.

Parameters
fromAgentthe sender agent
msgthe message
toAgentsthe destination agents
Returns
true if the message should be discarded
Bug
very rarely throws a NullPointerException

Reimplemented in frodo2.communication.mailer.CentralMailer.FakeQueue.

References frodo2.communication.OutgoingMsgPolicyInterface< T >.Decision.DISCARD, frodo2.communication.MessageType.getParent(), frodo2.communication.Message.getType(), and frodo2.java.

Referenced by sendMessage(), sendMessageToMulti(), and sendMessageToSelf().

Here is the call graph for this function:

◆ recordStats()

void frodo2.communication.Queue.recordStats ( Object to,
Message msg )
protected

◆ removeInputPipe()

void frodo2.communication.Queue.removeInputPipe ( QueueInputPipeInterface input)

Removes the given input pipe from the list of input pipes.

Parameters
inputthe input pipe to be removed

References input_lock, and inputs.

◆ removeOutputPipe()

void frodo2.communication.Queue.removeOutputPipe ( Object recipient)

Removes the output pipe corresponding to the given recipient.

Author
Brammert Ottens
Parameters
recipientthe recipient

References output_lock, and outputs.

◆ resetMsgSizeMonitor()

void frodo2.communication.Queue.resetMsgSizeMonitor ( )

Closes the MsgSizeMonitor and creates a new one.

Makes the queue forget all previously sent data, hereby resetting the one-time serialization overheads.

References frodo2.communication.MsgSizeMonitor.close().

Here is the call graph for this function:

◆ resetStats()

void frodo2.communication.Queue.resetStats ( )

Resets the metrics statistics.

Reimplemented in frodo2.communication.mailer.CentralMailer.FakeQueue.

References msgWrap.

◆ run()

void frodo2.communication.Queue.run ( )

Continuously processes all messages in the inbox.

See also
java.lang.Runnable#run()

References frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgent(), frodo2.communication.MessageWrapper.getNCCCs(), keepGoing, msgWrap, notifyInListeners(), and updateNCCCs().

Here is the call graph for this function:

◆ sendMessage() [1/2]

void frodo2.communication.Queue.sendMessage ( Object to,
Message msg )

Sends a message to a specified recipient.

Parameters
torecipient of the message
msgmessage to be sent

Reimplemented in frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.FakeQueue, frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.SinkQueue, and frodo2.communication.mailer.CentralMailer.FakeQueue.

References frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgent(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getNCCCs(), msgWrap, notifyOutListeners(), and sendMessage().

Referenced by frodo2.algorithms.afb.AFB< V extends Addable< V >, U extends Addable< U > >.assign_CPA(), frodo2.algorithms.afb.AFB< V extends Addable< V >, U extends Addable< U > >.backtrack(), frodo2.algorithms.dpop.count.CountSolutionsVALUE< Val extends Addable< Val >, U extends Addable< U > >.computeOptValAndSendVALUEmsgs(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.init(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.nextMultiplication(), frodo2.algorithms.dpop.memory.LabelingPhase< V extends Addable< V > >.notifyIn(), frodo2.algorithms.maxsum.MaxSum< V extends Addable< V >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.notifyIn(), frodo2.algorithms.varOrdering.linear.LinearOrdering< V extends Addable< V >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.afb.AFB< V extends Addable< V >, U extends Addable< U > >.processFbCpa(), frodo2.algorithms.SingleQueueAgent< Val extends Addable< Val > >.report(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.revealSol(), frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.send_token(), frodo2.controller.ConfigurationManager.sendEmptyConfigs(), sendMessage(), sendMessage(), sendMessageToMulti(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.share(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.share0(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.shareVector(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.shareVectorOfZeros(), frodo2.algorithms.maxsum.MaxSum< V extends Addable< V >, U extends Addable< U > >.start(), frodo2.algorithms.afb.AFB< V extends Addable< V >, U extends Addable< U > >.terminate(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.terminate(), and frodo2.algorithms.synchbb.SynchBB< V extends Addable< V >, U extends Addable< U > >.terminate().

Here is the call graph for this function:

◆ sendMessage() [2/2]

void frodo2.communication.Queue.sendMessage ( Object to,
MessageWrapper msgWrap )

Send a message that has already been wrapped.

Parameters
toThe destination of the message
msgWrapThe wrapped message
Warning
Does not notify outgoing message listeners.

Reimplemented in frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.FakeQueue, and frodo2.communication.mailer.CentralMailer.FakeQueue.

References msgWrap, output_lock, outputs, frodo2.communication.QueueOutputPipeInterface.pushMessage(), recordStats(), and sendMessage().

Here is the call graph for this function:

◆ sendMessageToMulti()

◆ sendMessageToSelf()

void frodo2.communication.Queue.sendMessageToSelf ( Message msg)

Sends a message to itself.

Parameters
msgmessage to be sent

Reimplemented in frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.FakeQueue, frodo2.algorithms.varOrdering.election.VariableElection< S extends Comparable< S > &Serializable >, and frodo2.communication.mailer.CentralMailer.FakeQueue.

References addToInbox(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getAgent(), frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getNCCCs(), msgWrap, and notifyOutListeners().

Referenced by frodo2.algorithms.dpop.privacy.EncryptedUTIL< V extends Addable< V >, U extends Addable< U >, E extends AddableLimited< U, E >.askDecrypt(), frodo2.algorithms.maxsum.MaxSum< V extends Addable< V >, U extends Addable< U > >.checkForTermination(), frodo2.algorithms.dpop.count.CountSolutionsVALUE< Val extends Addable< Val >, U extends Addable< U > >.computeOptValAndSendVALUEmsgs(), frodo2.algorithms.dpop.VALUEpropagation< Val extends Addable< Val > >.computeOptValAndSendVALUEmsgs(), frodo2.algorithms.localSearch.dsa.DSA< Val extends Addable< Val >, U extends Addable< U > >.init(), frodo2.algorithms.localSearch.mgm.mgm2.MGM2< V extends Addable< V >, U extends Addable< U > >.init(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.init(), frodo2.algorithms.varOrdering.dfs.DFSgeneration< V extends Addable< V >, U extends Addable< U > >.init(), frodo2.algorithms.varOrdering.dfs.DFSgenerationParallel< S extends Comparable< S > &Serializable >.init(), frodo2.algorithms.varOrdering.linear.CentralLinearOrdering< V extends Addable< V >, U extends Addable< U > >.init(), frodo2.daemon.userIO.UserIO.load(), frodo2.algorithms.dpop.memory.LabelingPhase< V extends Addable< V > >.notifyIn(), frodo2.algorithms.maxsum.MaxSum< V extends Addable< V >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.notifyIn(), frodo2.algorithms.reformulation.ProblemRescaler< U extends Addable< U > >.notifyIn(), frodo2.algorithms.varOrdering.factorgraph.FactorGraphGen< V extends Addable< V >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.varOrdering.linear.LinearOrdering< V extends Addable< V >, U extends Addable< U > >.notifyIn(), frodo2.algorithms.dpop.privacy.SecureRerooting< C extends Addable< C >, E extends AddableLimited< C, E >.passOn(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.processPending(), frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.randomTest(), frodo2.algorithms.dpop.privacy.EncryptedUTIL< V extends Addable< V >, U extends Addable< U >, E extends AddableLimited< U, E >.sendOutput(), frodo2.algorithms.adopt.test.testADOPT.startADOPT(), frodo2.algorithms.duct.tests.NormalizeInfTest.startNormalization(), frodo2.algorithms.duct.tests.NormalizeTest.startNormalization(), frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.startUTIL(), frodo2.algorithms.asodpop.tests.ASODPOPBinaryTest< V extends Addable< V >, U extends Addable< U > >.startUTILpropagation(), frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.startUTILpropagation(), frodo2.algorithms.odpop.tests.UTILpropagationTest< V extends Addable< V >, U extends Addable< U > >.startUTILpropagation(), frodo2.algorithms.odpop.tests.VALUEpropagationTest< V extends Addable< V >, U extends Addable< U > >.startUTILpropagation(), frodo2.algorithms.mpc_discsp.MPC_DisCSP4< V extends Addable< V > >.terminate(), frodo2.algorithms.dpop.stochastic.test.LowestCommonAncestorsTest.test(), and frodo2.algorithms.adopt.test.testPreprocessing.testRandom().

Here is the call graph for this function:

◆ setProblem()

void frodo2.communication.Queue.setProblem ( ProblemInterface<?, ?> problem)

Sets the problem that is queried for NCCCs.

Parameters
problemthe problem

References problem.

Referenced by frodo2.algorithms.varOrdering.election.tests.SecureVarElectionTest.initiateParamAndListener(), frodo2.algorithms.varOrdering.election.tests.VariableElectionTest< S extends Comparable< S > &Serializable >.initiateParamAndListener(), frodo2.algorithms.dpop.test.UTILpropagationTest< U extends Addable< U > >.Listener.Listener(), frodo2.algorithms.dpop.test.VALUEpropagationTest< U extends Addable< U > >.Listener.Listener(), frodo2.algorithms.dpop.privacy.test.SecureRerootingTest.randomTest(), frodo2.algorithms.dpop.privacy.test.VariableObfuscationTest< V extends Addable< V > >.randomTest(), frodo2.algorithms.dpop.stochastic.test.SamplingPhaseTest.setModules(), frodo2.algorithms.dpop.privacy.test.SecureCircularRoutingTest.setUp(), frodo2.algorithms.adopt.test.testADOPT.test(), frodo2.algorithms.asodpop.tests.ASODPOPBinaryTest< V extends Addable< V >, U extends Addable< U > >.test(), frodo2.algorithms.asodpop.tests.ASODPOPTest< V extends Addable< V >, U extends Addable< U > >.test(), frodo2.algorithms.duct.tests.NormalizeInfTest.test(), frodo2.algorithms.duct.tests.NormalizeTest.test(), frodo2.algorithms.odpop.tests.UTILpropagationTest< V extends Addable< V >, U extends Addable< U > >.test(), frodo2.algorithms.odpop.tests.VALUEpropagationTest< V extends Addable< V >, U extends Addable< U > >.test(), frodo2.algorithms.varOrdering.linear.tests.CentralLinearOrderingTest.test(), frodo2.algorithms.adopt.test.testPreprocessing.testRandom(), frodo2.algorithms.varOrdering.dfs.tests.DFSgenerationTest.testRandom(), and frodo2.algorithms.varOrdering.election.tests.VariableElectionTest< S extends Comparable< S > &Serializable >.testRandom().

◆ toBeClosedUponKill()

void frodo2.communication.Queue.toBeClosedUponKill ( QueueInputPipeInterface input)

Reminds the queue to close the given pipe when it is killed.

Parameters
inputpipe to be closed

References input_lock, and inputs.

◆ toDOT()

void frodo2.communication.Queue.toDOT ( StringBuilder out,
int ID )
private

Creates a fragment of DOT representation for this queue and its pipes.

Parameters
outStringBuilder
IDID to be used to represent this queue

References inputs, frodo2.output, and outputs.

Referenced by networkToDOT().

◆ updateNCCCs()

void frodo2.communication.Queue.updateNCCCs ( long msgNCCCs)

Updates the queue's NCCC counter to the input count if the input is greater.

Parameters
msgNCCCsinput NCCC count

References frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.getNCCCs(), and frodo2.solutionSpaces.ProblemInterface< V extends Addable< V >, U extends Addable< U > >.setNCCCs().

Referenced by frodo2.communication.mailer.CentralMailer.run(), and run().

Here is the call graph for this function:

Member Data Documentation

◆ inbox

BlockingQueue<MessageWrapper> frodo2.communication.Queue.inbox
private

The list of incoming messages waiting to be processed.

Referenced by addToInbox(), cleanQueue(), and init().

◆ inPolicies

◆ inPolicies_lock

final ReentrantLock frodo2.communication.Queue.inPolicies_lock = new ReentrantLock()
private

lock for inPolicies field

Referenced by addIncomingMessagePolicy(), deleteIncomingMessagePolicy(), and notifyInListeners().

◆ input_lock

final ReentrantLock frodo2.communication.Queue.input_lock = new ReentrantLock()
private

lock for input field

Referenced by end(), removeInputPipe(), and toBeClosedUponKill().

◆ inputs

◆ keepGoing

boolean frodo2.communication.Queue.keepGoing = true
private

Used to tell the thread to stop.

Referenced by end(), and run().

◆ maxMsgSizes

HashMap<MessageType, Long> frodo2.communication.Queue.maxMsgSizes
protected

For each message type, the size (in bytes) of the largest message of that type.

Referenced by getMaxMsgSizes().

◆ measureMsgs

final boolean frodo2.communication.Queue.measureMsgs
protected

Whether to measure the number of messages and the total amount of information sent.

Referenced by frodo2.communication.mailer.CentralMailer.FakeQueue.end(), Queue(), and Queue().

◆ monitor

MsgSizeMonitor frodo2.communication.Queue.monitor
protected

A monitor used to measure the sizes of the messages.

Referenced by frodo2.communication.mailer.CentralMailer.FakeQueue.end(), and end().

◆ msgNbrs

HashMap<MessageType, Integer> frodo2.communication.Queue.msgNbrs
protected

For each message type, the number of messages sent of that type.

Referenced by getMsgNbrs().

◆ msgNbrsSent

HashMap<Object, Integer> frodo2.communication.Queue.msgNbrsSent
private

The number of messages sent to each other agent.

Referenced by getMsgNbrsSent().

◆ msgSizes

HashMap<MessageType, Long> frodo2.communication.Queue.msgSizes
protected

For each message type, the total amount of information sent in messages of that type, in bytes.

Referenced by getMsgSizes().

◆ msgSizesSent

HashMap<Object, Long> frodo2.communication.Queue.msgSizesSent
private

The amount of information sent to each other agent, in bytes.

Referenced by getMsgSizesSent().

◆ msgWrap

◆ myThread

Thread frodo2.communication.Queue.myThread
private

The queue's thread.

Referenced by end(), and init().

◆ outPolicies

HashMap<MessageType, ArrayList< OutgoingMsgPolicyInterface<MessageType> > > frodo2.communication.Queue.outPolicies
protected

◆ outPolicies_lock

final ReentrantLock frodo2.communication.Queue.outPolicies_lock = new ReentrantLock()
private

Lock for outPolicies field.

Referenced by addOutgoingMessagePolicy(), and deleteOutgoingMessagePolicy().

◆ output_lock

final ReentrantLock frodo2.communication.Queue.output_lock = new ReentrantLock()
private

lock for output field

Referenced by addOutputPipe(), end(), getOutputPipe(), removeOutputPipe(), and sendMessage().

◆ outputs

HashMap<Object, QueueOutputPipeInterface> frodo2.communication.Queue.outputs
protected

◆ problem

ProblemInterface<?, ?> frodo2.communication.Queue.problem
protected

The documentation for this class was generated from the following file: