Mercurial > hg > FederatedLinda
view src/fdl/MetaLogEngine.java @ 110:8ae522e1a4bf
add jar (junit and protobuf)
author | kazz |
---|---|
date | Wed, 04 Aug 2010 21:41:39 +0900 (2010-08-04) |
parents | 0ea086f0e96f |
children |
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(0); } while (running); if (running) { meta.out(PSX.META_MONITOR_DATA, data); meta.in(PSX.META_MONITOR,monitor_callback); } }}; public void mainLoop(MetaLinda meta) { 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(0); } }