当前位置: 首页>>代码示例>>Java>>正文


Java WakerBehaviour类代码示例

本文整理汇总了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.");
    }
}
 
开发者ID:0xC70FF3,项目名称:java-gems,代码行数:21,代码来源:FTPUpLoadRequestInitiatorBehaviour.java

示例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();
        }
    });
    
}
 
开发者ID:ayushoriginal,项目名称:Ngram-Graphs,代码行数:30,代码来源:ResultsAgent.java


注:本文中的jade.core.behaviours.WakerBehaviour类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。