Mercurial > hg > FederatedLinda
view src/fdl/test/debug2/MetaProtocolEngine.java @ 97:0ea086f0e96f fuchita
main loop modification, for easy meta engine addition.
add comments.
author | one |
---|---|
date | Wed, 26 May 2010 10:49:50 +0900 |
parents | ea4ee892baf5 |
children |
line wrap: on
line source
package fdl.test.debug2; import java.nio.ByteBuffer; import fdl.*; /** * MetaProtocolEngine * * @author Kazuki Akamine * * 接続する機能までを実装した MetaEngine * これを継承して、具体的な処理を書く * */ public class MetaProtocolEngine implements MetaEngine { // Fields private NodeProperty np; // Constructor public MetaProtocolEngine(int port, MetaLinda ml, String managerHostName, int managerPort) { this.np = new NodeProperty(port, ml, managerHostName, managerPort); ml.out(TupleId.BODY.id, ByteBuffer.wrap("dummy".getBytes())); } public void mainLoop(MetaLinda ml) { initPoller(); while (np.running) { np.ml.sync(0); } Debug.print("Terminated" + np.nodeId + " replies=" + np.ml.replies.size() + " qsize=" + np.ml.fdl.qsize); } protected void initPoller() { np.ml.in(TupleId.MANAGE.id, new AcceptXMLCallback(TupleId.MANAGE, np)); np.ml.in(TupleId.DEBUG.id, new AcceptXMLCallback(TupleId.DEBUG, np)); } }