本文整理汇总了Java中se.sics.kompics.Handler类的典型用法代码示例。如果您正苦于以下问题:Java Handler类的具体用法?Java Handler怎么用?Java Handler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Handler类属于se.sics.kompics包,在下文中一共展示了Handler类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RespawnerComponent
import se.sics.kompics.Handler; //导入依赖的package包/类
public RespawnerComponent(RespawnerInit init) {
final Positive<Network> net = requires(Network.class);
self = init.self;
Handler<Start> startHandler = new Handler<Start>() {
@Override
public void handle(Start event) {
System.out.println("Started (" + netAddr + ").");
byte id = self.getId()[0];
byte newId = (byte) (id + 1);
if (newId < NUM_SPAWNS) {
trigger(new StartVNode(self, netAddr, new byte[]{newId}, schema), net);
TestUtil.submit(SPAWN_SENT);
}
trigger(new StopVNode(self, self), net);
}
};
subscribe(startHandler, control);
}
示例2: ComponentBodyAdapter
import se.sics.kompics.Handler; //导入依赖的package包/类
ComponentBodyAdapter(ResolutionContext context, JDefinedClass clazz) {
super(context, clazz);
initBlock = clazz.instanceInit();
handlerType = (JClass) context.unit._ref(Handler.class);
posPortType = (JClass) context.unit._ref(Positive.class);
negPortType = (JClass) context.unit._ref(Negative.class);
componentType = (JClass) context.unit._ref(Component.class);
initType = (JClass) context.unit._ref(Init.class);
}
示例3: startBootstrapClient
import se.sics.kompics.Handler; //导入依赖的package包/类
private void startBootstrapClient() {
final Component bootstrapClient = create(BootstrapClient.class, new BootstrapCInit(netSelf, config));
connect(bootstrapClient.getNegative(Timer.class), sharedComponents.getTimer());
sharedComponents.connectNetwork(bootstrapClient);
connect(bootPort.getPair(), bootstrapClient.getPositive(Bootstrap.class));
Handler<Bootstrapped> bootHandler = new Handler<Bootstrapped>() {
@Override
public void handle(Bootstrapped event) {
trigger(Stop.event, bootstrapClient.control());
sharedComponents.disconnectNetwork(bootstrapClient);
disconnect(bootPort.getPair(), bootstrapClient.getPositive(Bootstrap.class));
disconnect(bootstrapClient.getNegative(Timer.class), sharedComponents.getTimer());
unsubscribe(this, bootPort);
LOG.debug("{} is bootstrapped", netSelf);
startLUTManager(event);
}
};
subscribe(bootHandler, bootPort);
// CLIENT only
for (ComponentHook hook : config.getHostHooks(SystemPhase.BOOTSTRAP_CLIENT)) {
hook.setUp(sharedComponents, proxy);
}
}
示例4: startBootstrapServer
import se.sics.kompics.Handler; //导入依赖的package包/类
private void startBootstrapServer() {
final Component bootstrapServer = create(BootstrapServer.class, new BootstrapSInit(netSelf, config));
connect(bootstrapServer.getNegative(Timer.class), sharedComponents.getTimer());
sharedComponents.connectNetwork(bootstrapServer);
connect(bootPort.getPair(), bootstrapServer.getPositive(Bootstrap.class));
Handler<Bootstrapped> bootHandler = new Handler<Bootstrapped>() {
@Override
public void handle(Bootstrapped event) {
trigger(Stop.event, bootstrapServer.control());
sharedComponents.disconnectNetwork(bootstrapServer);
disconnect(bootPort.getPair(), bootstrapServer.getPositive(Bootstrap.class));
disconnect(bootstrapServer.getNegative(Timer.class), sharedComponents.getTimer());
unsubscribe(this, bootPort);
LOG.debug("{} is bootstrapped", netSelf);
startLUTManager(event);
}
};
subscribe(bootHandler, bootPort);
// SERVER only
for (ComponentHook hook : config.getHostHooks(SystemPhase.BOOTSTRAP_SERVER)) {
hook.setUp(sharedComponents, proxy);
}
}
示例5: SenderComponent
import se.sics.kompics.Handler; //导入依赖的package包/类
public SenderComponent(SenderInit init) {
final Positive<Network> net = requires(Network.class);
self = init.self;
Handler<Start> startHandler = new Handler<Start>() {
@Override
public void handle(Start event) {
System.out.println("Started (" + self + ").");
trigger(new TestMsg(self, self), net);
TestUtil.submit(MSG_SENT);
}
};
subscribe(startHandler, control);
}
示例6: doSubscribe
import se.sics.kompics.Handler; //导入依赖的package包/类
@Override
public <E extends KompicsEvent, P extends PortType> void doSubscribe(Handler<E> handler, Port<P> port) {
subscribe(handler, port);
}
示例7: doSubscribe
import se.sics.kompics.Handler; //导入依赖的package包/类
@Override
public <E extends KompicsEvent, P extends PortType> void doSubscribe(Handler<E> handler, Port<P> port) {
}
示例8: doSubscribe
import se.sics.kompics.Handler; //导入依赖的package包/类
public <E extends KompicsEvent, P extends PortType> void doSubscribe(Handler<E> handler, Port<P> port);