Java jade错误代理a1未正确终止而死亡。错误状态2
我是刚来翡翠的,我想建立一个拍卖代理,提供时间和物品数量,然后。。。但是我得到了这个错误Java jade错误代理a1未正确终止而死亡。错误状态2,java,agents-jade,Java,Agents Jade,我是刚来翡翠的,我想建立一个拍卖代理,提供时间和物品数量,然后。。。但是我得到了这个错误 jade错误代理a1未正确终止而死亡。错误 国家2 我的代码: int timeout=Integer.parseInt(JOptionPane.showInputDialog(“拍卖的运行时间是多少秒?”) 考虑到JADE代理最终是一个Java线程,无论哪里发生错误,都会导致代理或线程终止(如果我没记错的话,这通常发生在AgentWrapper类中) 还请记住,调用JOptionPane(即Swing
- jade错误代理a1未正确终止而死亡。错误 国家2 我的代码: int timeout=Integer.parseInt(JOptionPane.showInputDialog(“拍卖的运行时间是多少秒?”)
还请记住,调用JOptionPane(即Swing)会影响两个线程:代理线程和可能导致并发问题的Swing线程。最好不要把它们混在一起;相反,通过将最终用户应用程序/可视化与代理分离,使用代理的O2A接口 这是一种行为准则吗?据我所知,当行为执行过程中发生错误时,会出现此错误。尝试将所有代码包装在Try-catch块中,以查找错误或查找代码。有任何线索吗?
number=Integer.parseInt(JOptionPane.showInputDialog("What's the number of items?"));
//service registration
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
ServiceDescription sd = new ServiceDescription();
sd.setType("Uniform-Price-Auction");
sd.setName("Uniform-Price-Auction");
dfd.addServices(sd);
try {
DFService.register(this, dfd);
}
catch (FIPAException fe) {
fe.printStackTrace();
}
// Add the behaviour serving queries from buyer agents
addBehaviour(new getBids());
// Add the behaviour serving purchase orders from buyer agents
addBehaviour(new DetermineWinner(this,timeout*1000));
gui=new ActioneerGUI();
gui.setVisible(true);
gui.setlabel1("We want to sell "+number+" items");
gui.setlabel2("Auction is running...");