本文整理汇总了Java中jade.wrapper.StaleProxyException类的典型用法代码示例。如果您正苦于以下问题:Java StaleProxyException类的具体用法?Java StaleProxyException怎么用?Java StaleProxyException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StaleProxyException类属于jade.wrapper包,在下文中一共展示了StaleProxyException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: action
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
@Override
public void action()
{
System.out.println("On GameLoadBehaviour action()...");
try
{
loadGhosts();
System.out.println("Ghosts agents initialized...");
loadPacman();
System.out.println("Pacman agent initialized...");
if (Constant.DEBUG)
{
System.out.println("Fully loaded initial board:");
board.print();
}
}
catch (StaleProxyException ex)
{
System.out.println("Couldn't initialize agents...");
}
}
示例2: main
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
public static void main(String[] args) {
Runtime rt = Runtime.instance();
// Exit the JVM when there are no more containers around
rt.setCloseVM(true);
// Create a default profile
Profile profile = new ProfileImpl("192.168.111.1", 8888, "main");
AgentContainer mainContainer = rt.createMainContainer(profile);
addStationToRuntime(rt);
addTransporterContainer(rt);
addCleanerContainer(rt);
addPainterContainer(rt);
AgentController rma = null;
try {
rma = mainContainer.createNewAgent("rma", "jade.tools.rma.rma", new Object[0]);
rma.start();
} catch (StaleProxyException e) {
e.printStackTrace();
}
}
示例3: main
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
public static void main(String[] args) throws StaleProxyException {
// Start a new JADE runtime system
Runtime.instance().setCloseVM(true);
Runtime rt = jade.core.Runtime.instance();
Properties props = new ExtendedProperties();
props.setProperty(Profile.GUI, "true");
props.setProperty(Profile.LOCAL_HOST, "172.16.0.83");
AgentContainer cc = rt.createMainContainer(new ProfileImpl(props));
// Start a FTPAgent
AgentController ftpAgent = cc.createNewAgent("ftp", "com.jools.jade.agent.FTPAgent",
new String[]{
"username",
"password",
"ftp.server.net"
}
);
ftpAgent.start();
}
示例4: main
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(HomeFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
HomeFrame.getHomeFrame().setVisible(true);
Util.initiateJadeRma();
try {
Util.initiateAmbient();
} catch (StaleProxyException e) {
e.printStackTrace();
}
}
});
}
示例5: setup
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
protected void setup() {
// listen to requestdummy
addBehaviour(new CyclicBehaviour(this) {
public void action() {
ACLMessage msg = receive();
if (msg != null) {
orders = msg.getContent().split(", ");
AgentContainer container = getContainerController();
try {
// TODO: Fix agent hash
orderAgent = container.createNewAgent(
"order:" + msg.hashCode(), "src.kiva.Order",
orders);
orderAgent.start();
} catch (StaleProxyException e1) {
e1.printStackTrace();
}
}
block();
}
});
}
示例6: handleNew
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
/**
* Creates a new agent, based on the given arguments
*
* @param - args the arguments of the call to "new" construct. The first two elements of the vector are the name and
* the class name of the agent. The rests are arguments that the created agent will process after creation
* @return - whether the creation was successful or not
*/
private boolean handleNew(Vector<ClaimConstruct> args)
{
ClaimValue agentName = (ClaimValue) args.get(0);
// ClaimValue agentClassName = (ClaimValue)args.get(1);
try
{
((BaseAgent) this.myAgent).getContainerController().createNewAgent((String) agentName.getValue(),
"core.claim.ClaimAgent", args.subList(1, args.size()).toArray());
} catch(StaleProxyException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
示例7: getFaultMeasure
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
@Override
public Runnable getFaultMeasure() {
// --- 0. Is the platform still running? ----------
if (this.isPlatformRunning()==false) {
this.unregisterTask();
return null;
}
// -- In case of an individual measure action -----
if (this.measure!=null) return this.measure;
// --- Only for the restart of the agent ----------
Runnable failureMeasure = new Runnable() {
@Override
public void run() {
try {
containerController.createNewAgent(agentName, agentClass, agentStartArguments).start();
} catch (StaleProxyException spex) {
//spex.printStackTrace();
System.err.println("[MonitoringEvent] Agent restart failed.");
setMonitoringState(MonitoringState.FAULTY_PROCESS_FAULTY_MEASURE);
}
}
};
return failureMeasure;
}
示例8: isAgentRunning
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
/**
* Checks, whether one Agent is running (or not) in the specified container.
*
* @param localAgentName the agent name
* @param agentContainer the agent container
* @return true, if the agent is running
*/
public boolean isAgentRunning(String localAgentName, AgentContainer agentContainer) {
if (this.isMainContainerRunning()==false) return false;
if (localAgentName==null) return false;
if (agentContainer==null) return false;
// --- 1. Try to find the agent in the container ------------
AgentController agentController = null;
try {
agentController = agentContainer.getAgent(localAgentName);
} catch (ControllerException ce) {
// ce.printStackTrace();
return false;
}
// --- 2. Try to get the agent's state ----------------------
boolean isRunning;
try {
agentController.getState();
isRunning = true;
} catch (StaleProxyException spex) {
// spex.printStackTrace();
isRunning = false;
}
return isRunning;
}
示例9: killContainer
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
/**
* Kills an AgentContainer to the local platform.
* @param containerName the container name
*/
public void killContainer(String containerName) {
AgentContainer agentContainer = this.getContainer(containerName);
if (agentContainer!=null) {
try {
this.getAgentContainerList().remove(agentContainer);
agentContainer.kill();
} catch (StaleProxyException e) {
//e.printStackTrace();
}
}
}
示例10: loadGhosts
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
private void loadGhosts() throws StaleProxyException
{
int ghostInstance = 1;
for (Cell freeGhostsHouse : board.getFreeGhostsHouses())
{
((GameAgent) myAgent).incrementWaitingInitialization();
Object[] args = { board, freeGhostsHouse };
AgentController ghost = containerManager.instantiateAgent("Ghost-" + ghostInstance++, GhostAgent.class.getName(), args);
((GameAgent) myAgent).addGhost(ghost);
}
}
示例11: loadPacman
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
private void loadPacman() throws StaleProxyException
{
((GameAgent) myAgent).incrementWaitingInitialization();
Cell house = board.getPacmanHouse();
Object[] args = { board, house };
AgentController pacman = containerManager.instantiateAgent("Pacman", PacmanAgent.class.getName(), args);
((GameAgent) myAgent).setPacman(pacman);
}
示例12: main
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
public static void main(String[] args)
{
try
{
Object[] agentArgs = { "01.board" };
ContainerManager.getInstance().instantiateAgent(Constant.GAME_AGENT_NAME, GameAgent.class.getName(), agentArgs);
}
catch (StaleProxyException ex)
{
Logger.getLogger(Starter.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例13: addStationToRuntime
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
private static void addStationToRuntime(Runtime rt){
ProfileImpl pContainer = new ProfileImpl("192.168.111.1", 8888, "stations");
AgentContainer cont = rt.createAgentContainer(pContainer);
try {
cont.createNewAgent("CleaningFloor", "gseproject.passive.CleaningFloorAgent", null);
cont.createNewAgent("PaintingFloor", "gseproject.passive.PaintingFloorAgent", null);
cont.createNewAgent("SourcePalette", "gseproject.passive.SourcepaletteAgent", null);
cont.createNewAgent("GoalPalette", "gseproject.passive.GoalpaletteAgent", null);
} catch (StaleProxyException e1) {
e1.printStackTrace();
}
}
示例14: addTransporterContainer
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
private static void addTransporterContainer(Runtime rt){
ProfileImpl pContainer = new ProfileImpl("192.168.111.1", 8888, "transporter");
AgentContainer cont = rt.createAgentContainer(pContainer);
try {
cont.createNewAgent("Transporter", "gseproject.robot.RobotAgent", null);
} catch (StaleProxyException e1) {
e1.printStackTrace();
}
}
示例15: addCleanerContainer
import jade.wrapper.StaleProxyException; //导入依赖的package包/类
private static void addCleanerContainer(Runtime rt){
ProfileImpl pContainer = new ProfileImpl("192.168.111.1", 8888, "cleaner");
AgentContainer cont = rt.createAgentContainer(pContainer);
try {
cont.createNewAgent("Cleaner", "gseproject.robot.RobotAgent", null);
} catch (StaleProxyException e1) {
e1.printStackTrace();
}
}