Mercurial > hg > FederatedLinda
view src/fdl/MetaLogEngine.java @ 71:0352536c33fa
(example: writer) get linda server addr from commandline arg.
author | kazz@e065701.local |
---|---|
date | Fri, 23 Oct 2009 14:11:07 +0900 |
parents | 2a366abc3f1f |
children | 0ea086f0e96f |
line wrap: on
line source
package fdl; import java.nio.ByteBuffer; /** * @author kono * Meta Protocol Engine for each Linda Server */ public class MetaLogEngine implements MetaEngine { MetaLinda meta; boolean running = true; CommDebugHook commDebug; public MetaLogEngine(MetaLinda meta) { this.meta = meta; } PSXCallback monitor_callback_start = new PSXCallback() {public void callback(ByteBuffer reply) { meta.setTupleSpaceHook(commDebug = new CommDebugHook()); meta.out(PSX.META_MONITOR_DATA, null); meta.in(PSX.META_MONITOR,monitor_callback); }}; PSXCallback monitor_callback = new PSXCallback() {public void callback(ByteBuffer reply) { ByteBuffer data; do { data = commDebug.getLog(); if (data!=null) break; meta.sync(); } while (running); if (running) { meta.out(PSX.META_MONITOR_DATA, data); meta.in(PSX.META_MONITOR,monitor_callback); } }}; public void mainLoop() { meta.in(PSX.META_MONITOR,monitor_callback_start); meta.in(PSX.META_STOP, new PSXCallback() {public void callback(ByteBuffer reply) { running = false;}}); while(running) meta.sync(); } }