本文整理汇总了Java中jade.core.behaviours.WakerBehaviour类的典型用法代码示例。如果您正苦于以下问题:Java WakerBehaviour类的具体用法?Java WakerBehaviour怎么用?Java WakerBehaviour使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WakerBehaviour类属于jade.core.behaviours包,在下文中一共展示了WakerBehaviour类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleError
import jade.core.behaviours.WakerBehaviour; //导入依赖的package包/类
private void handleError() {
if (this.retries > 0 && this.timeout > 0) {
logger.warn("Action is delayed.");
this.myAgent.addBehaviour(new WakerBehaviour(this.myAgent, timeout) {
@Override
protected void onWake() {
super.onWake();
this.myAgent.addBehaviour(new FTPUpLoadRequestInitiatorBehaviour(
this.myAgent,
FTPUpLoadRequestInitiatorBehaviour.this.source,
FTPUpLoadRequestInitiatorBehaviour.this.destination,
FTPUpLoadRequestInitiatorBehaviour.this.timeout,
FTPUpLoadRequestInitiatorBehaviour.this.retries - 1));
}
});
} else {
logger.warn("Action is aborted: file " + this.source.getAbsolutePath() + " not transmitted.");
}
}
示例2: complete
import jade.core.behaviours.WakerBehaviour; //导入依赖的package包/类
/** Completes the evaluation process, updating the dispatched agents of the
*event .
*/
public void complete() {
System.err.println("Completed successfully. Releasing sent agents...");
String sCur;
Object oNext;
// For every agent
while ((oNext=ActiveAgents.poll()) != null) {
sCur = (String)oNext;
// Send termination signal
ACLMessage msg = new ACLMessage(ACLMessage.CANCEL);
msg.setSender(getAID());
msg.addReceiver(new AID(sCur, false));
msg.setContent(NGramDocumentComparatorAgent.TERMINATION_MESSAGE);
send(msg);
}
psOutputStream.flush();
psOutputStream.close();
addBehaviour(new WakerBehaviour(this, 10000) {
public void onWake() {
doDelete();
}
});
}