__log.trace(ObjectPrinter.stringifyMethodEnter("add", new Object[] { "group", group }));
verifyNew(group);
CommGroupFrame commGroupFrame = new CommGroupFrame(group.isReplicated());
for (Iterator i = group.getElements(); i.hasNext();) {
Comm comm = (Comm) i.next();
ChannelFrame chnlFrame = findChannelFrame(comm.getChannel().getId());
if (comm instanceof CommSend) {
if (chnlFrame.replicatedSend) {
// TODO: JACOB "bad-process" ex
throw new IllegalStateException("Send attempted on channel containing replicated send! Channel= "
+ comm.getChannel());
}
if (group.isReplicated())
chnlFrame.replicatedSend = true;
CommSend commSend = (CommSend) comm;
MessageFrame mframe = new MessageFrame(commGroupFrame, chnlFrame, commSend.getMethod().getName(),
commSend.getArgs());
commGroupFrame.commFrames.add(mframe);
chnlFrame.msgFrames.add(mframe);
} else if (comm instanceof CommRecv) {
if (chnlFrame.replicatedRecv) {
// TODO: JACOB "bad-process" ex
throw new IllegalStateException(
"Receive attempted on channel containing replicated receive! Channel= " + comm.getChannel());
}
if (group.isReplicated())
chnlFrame.replicatedRecv = true;
CommRecv commRecv = (CommRecv) comm;
ObjectFrame oframe = new ObjectFrame(commGroupFrame, chnlFrame, commRecv.getContinuation());
commGroupFrame.commFrames.add(oframe);
chnlFrame.objFrames.add(oframe);
}
}
// Match communications.
for (Iterator i = group.getElements(); i.hasNext();) {
Comm comm = (Comm) i.next();
matchCommunications(comm.getChannel());
}
}