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


Java StaleProxyException.printStackTrace方法代码示例

本文整理汇总了Java中jade.wrapper.StaleProxyException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java StaleProxyException.printStackTrace方法的具体用法?Java StaleProxyException.printStackTrace怎么用?Java StaleProxyException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jade.wrapper.StaleProxyException的用法示例。


在下文中一共展示了StaleProxyException.printStackTrace方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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();
	}

}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:25,代码来源:MultiplePlatformsTest.java

示例2: 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;
}
 
开发者ID:tATAmI-Project,项目名称:tATAmI-PC,代码行数:26,代码来源:ClaimBehavior.java

示例3: 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();
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:15,代码来源:MultiplePlatformsTest.java

示例4: 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();
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:10,代码来源:MultiplePlatformsTest.java

示例5: 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();
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:10,代码来源:MultiplePlatformsTest.java

示例6: addPainterContainer

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
private static void addPainterContainer(Runtime rt){
	ProfileImpl pContainer = new ProfileImpl("192.168.111.1", 8888, "painter");
	AgentContainer cont = rt.createAgentContainer(pContainer);
	try {
		cont.createNewAgent("Painter", "gseproject.robot.RobotAgent", null);
	} catch (StaleProxyException e1) {
		e1.printStackTrace();
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:10,代码来源:MultiplePlatformsTest.java

示例7: initiateJadeRma

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
public static void initiateJadeRma() {
	rt.setCloseVM(true); // Exit the JVM when there are no more containers around
	
	if(rma == null){
		try {
			rma = getMainContainer().createNewAgent("rma", "jade.tools.rma.rma", new Object[0]);
			rma.start();
		} catch (StaleProxyException e1) {
			e1.printStackTrace();
		}
	}
	else{
		System.out.println("JADE RMA is already intiated.");
	}
}
 
开发者ID:gabriel-augusto,项目名称:AcSimus,代码行数:16,代码来源:Util.java

示例8: initiateAmbient

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
public static void initiateAmbient() throws StaleProxyException {		
	if(getAmbient() == null){
		String id = "Ambient";
		try {
			ambient = getSimulatorContainer().createNewAgent(id, "simulator.agents.Ambient", new Object[0]);
			ambient.start();
			ambientAID = new AID(id,AID.ISLOCALNAME);
		} catch (StaleProxyException e1) {
			e1.printStackTrace();
		}
	} else {
		System.out.println("Ambient is already intiated.");
	}
}
 
开发者ID:gabriel-augusto,项目名称:AcSimus,代码行数:15,代码来源:Util.java

示例9: setup

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
protected void setup() {
	AgentContainer container = getContainerController();
	agents = new HashMap<String, Integer>();

	// How many of which agents do we want to have?
	agents.put("DeliveryRobot", 1);
	agents.put("Picker", 1);
	agents.put("Shelf", 1);

	// the request dummy spawns a recipient
	agents.put("Recipient", 0);
	agents.put("Requestdummy", 1);

	// Spawn Agents
	for (Entry<String, Integer> agent : agents.entrySet()) {
		for (int i = 0; i < agent.getValue(); i++) {
			try {
				controller = container.createNewAgent(agent.getKey()
						+ Integer.toString(i),
						"src.kiva." + agent.getKey(), null);
				controller.start();
				System.out.println("Spawning " + agent.getKey()
						+ Integer.toString(i));
			} catch (StaleProxyException e1) {
				e1.printStackTrace();
			}
		}
	}
	takeDown();
}
 
开发者ID:ChrisQuignon,项目名称:kivasim,代码行数:31,代码来源:Warehouse.java

示例10: addModule

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
public void addModule(String modulename)
{
	messageQueues.put(modulename,new LinkedList<APLMessage>());
	
	Object[] args = new Object[2];
	args[0] = this;
	args[1] = modulename;
	try {
		agentController = agentContainer.createNewAgent(modulename,"apapl.messaging.MessageAgent",args);
		agentController.start();
	}
	catch (StaleProxyException e) {
		e.printStackTrace();
	}
}
 
开发者ID:ROSAPL,项目名称:2APL_fork,代码行数:16,代码来源:JadeMessenger.java

示例11: addAgentToContainer

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
/**
 * Method which creates and starts an agent in a container specified by its name
 * 
 * @param containerName
 *            - the name of the container; null for the main container - should be on the same machine
 * @param agentName
 *            - the name of the agent
 * @param agentClassName
 *            - the class of the agent, including the package
 * @param agentArgs
 *            - array of Objects, representing the arguments of the agent
 */
@Override
public void addAgentToContainer(String containerName, String agentName, String agentClassName, Object[] agentArgs)
{
	try
	{
		(containerName != null ? containerList.get(containerName) : getMainContainer()).createNewAgent(agentName, agentClassName, agentArgs).start();
	} catch(StaleProxyException e)
	{
		e.printStackTrace();
	} catch(NullPointerException npe)
	{
		npe.printStackTrace();
	}
}
 
开发者ID:tATAmI-Project,项目名称:tATAmI-PC,代码行数:27,代码来源:PCJadeInterface.java

示例12: setup

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
@Override
protected void setup() {
	super.setup();
	
	System.out.println("Starting Background System-Agent '" + this.getName() + "'");
	
	this.getContentManager().registerLanguage(codec);
	this.getContentManager().registerOntology(ontology);
	this.getContentManager().registerOntology(ontologyJadeMgmt);
	
	LoadServiceHelper loadHelper = null;
	try {
		loadHelper = (LoadServiceHelper) getHelper(LoadService.NAME);
		// --- get the local systems-informations ---------
		myCRCreply = loadHelper.getLocalCRCReply();

		// --- Define Platform-Info -----------------------
		myPlatform = myCRCreply.getRemoteAddress();
		// --- Set the Performance of machine -------------
		myPerformance = myCRCreply.getRemotePerformance();
		// --- Set OS-Informations ------------------------
		myOS = myCRCreply.getRemoteOS();
		// --- Set version info ---------------------------
		myVersion = myCRCreply.getRemoteAgentGuiVersion();
		
	} catch (ServiceException e) {
		// --- problems to get the SimulationsService ! ---
		if (loadHelper==null) {
			this.doDelete();
			return;
		} else {
			e.printStackTrace();	
		}
	}
	
	// --- Define Main-Platform-Info ------------------
	JadeUrlConfiguration myURL = Application.getGlobalInfo().getJadeUrlConfigurationForMaster();
	if(!myURL.hasErrors()){
		mainPlatform.setIp(myURL.getHostIP());
		mainPlatform.setUrl(myURL.getHostName());
		mainPlatform.setPort(myURL.getPort());
		mainPlatform.setHttp4mtp(myURL.getJadeURL4MTP());
		
		// --- Define Receiver of local Status-Info -------
		String jadeURL = myURL.getJadeURL();
		if (jadeURL!=null) {
			mainPlatformAgent = new AID("server.master" + "@" + myURL.getJadeURL(), AID.ISGUID );
			mainPlatformAgent.addAddresses(mainPlatform.getHttp4mtp());	
		}		
	}
	// --- Set myTime ---------------------------------
	myPlatformTime.setTimeStampAsString( Long.toString(System.currentTimeMillis()) ) ;
	
	// --- Send 'Register'-Information ----------------
	myRegistration.setClientAddress(myPlatform);
	myRegistration.setClientTime(myPlatformTime);
	myRegistration.setClientPerformance(myPerformance);
	myRegistration.setClientOS(myOS);
	myRegistration.setClientVersion(myVersion);
	this.sendMessage2MainServer(myRegistration);
	
	// --- Add Main-Behaviours ------------------------
	parBehaiv = new ParallelBehaviour(this,ParallelBehaviour.WHEN_ALL);
	parBehaiv.addSubBehaviour( new MessageReceiveBehaviour() );
	trigger = new TriggerBehaiviour(this,triggerTime);
	parBehaiv.addSubBehaviour( trigger );
	sndBehaiv = new SaveNodeDescriptionBehaviour(this, 500);
	parBehaiv.addSubBehaviour( sndBehaiv );
	
	// --- Add the parallel Behaviour from above ------
	this.addBehaviour(parBehaiv);
	
	// --- Finally start the LoadAgent ----------------
	try {
		this.getContainerController().createNewAgent("server.load", agentgui.simulationService.agents.LoadMeasureAgent.class.getName(), null).start();
	} catch (StaleProxyException agentErr) {
		agentErr.printStackTrace();
	}
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:81,代码来源:ServerClientAgent.java

示例13: onWake

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
/** Performs the creation and dispatchiong of calculating agents, as well as the routing
 * of calculation parameters to them. Also, queues behaviours for the reception of results.
 */
protected void onWake() {
    synchronized (myAgent) 
    {
        // Create and send agents
        ResultsAgent aCaller= (ResultsAgent)myAgent;
        try 
        {                        
            while (aCaller.InitializedAgents.size() + aCaller.ActiveAgents.size()
                    < aCaller.MaxAgents) {
                // Create new agent
                AgentController acCur = myAgent.getContainerController().createNewAgent("CalcAgent"+
                        aCaller.createAgentID(aCaller.AgentUniqueIDLength), 
                        "jinsect.distributed.NGramDocumentComparatorAgent", AgentArgs);
                aCaller.InitializedAgents.add(acCur.getName());                            
                acCur.start();
                // Wait for move complete message
                myAgent.addBehaviour(new ReceiveResultBehaviour(aCaller, Interval,
                    OutputStream));                                
            }
        } catch (StaleProxyException ex) {
            System.err.println("Cannot execute agent...");
            ex.printStackTrace(System.err);
        }

        // Check if there are any active agents
        if (aCaller.ActiveAgents.size() > 0) {
            if (aCaller.CurrentAgent == null)
                // Position iterator to the end
                aCaller.CurrentAgent = aCaller.ActiveAgents.listIterator(aCaller.ActiveAgents.size());
            while (aCaller.PendingRequests < aCaller.MaxPendingRequests)
            {
                AgentData adCur = (AgentData)CalcArgs.poll();
                if (adCur != null) {
                    // Send texts to next agent, using round robin.
                    String sNextAgentName;
                    if (!aCaller.CurrentAgent.hasPrevious())
                        aCaller.CurrentAgent = 
                                aCaller.ActiveAgents.listIterator(aCaller.ActiveAgents.size());
                    
                    // Check for change in iterator data
                    try {
                        aCaller.CurrentAgent.previous();
                        aCaller.CurrentAgent.next();
                    }
                    catch (ConcurrentModificationException cmeE) {
                        aCaller.CurrentAgent = aCaller.ActiveAgents.listIterator(aCaller.ActiveAgents.size());
                    }

                    // Actually get name
                    sNextAgentName = (String)aCaller.CurrentAgent.previous();

                    // Send texts message
                    myAgent.addBehaviour(new SendTextsBehaviour(adCur.ID,
                            adCur.Texts[0], adCur.Texts[1], sNextAgentName));
                    // Wait for result message
                    myAgent.addBehaviour(new ReceiveResultBehaviour(aCaller, Interval,
                        OutputStream));                                
                    ((ResultsAgent)myAgent).PendingRequests++;
                }
                else
                    break; // AgentData have all been sent
            }

        }

        // If pending requests exist, then repeat behaviour.
        if ((!CalcArgs.isEmpty()))
            myAgent.addBehaviour(new ActivateAgentListBehaviour(aCaller, 
                    Interval, CalcArgs, OutputStream, MigrationProbability, AgentArgs));
            
    }
}
 
开发者ID:ayushoriginal,项目名称:Ngram-Graphs,代码行数:76,代码来源:ActivateAgentListBehaviour.java

示例14: setup

import jade.wrapper.StaleProxyException; //导入方法依赖的package包/类
protected void setup() {

		// read args
		Object[] args = getArguments();
		if (args != null && args.length > 2) {
			maxPartsPerOrder = Integer.parseInt(args[0].toString());
			maxAmountPerPart = Integer.parseInt(args[1].toString());
			maxSecDelay = Double.parseDouble(args[2].toString());
		}

		// spawn recipient
		AgentContainer container = getContainerController();
		try {
			recAgent = container.createNewAgent(recipient,
					"src.kiva.Recipient", null);
			recAgent.start();

		} catch (StaleProxyException e1) {
			e1.printStackTrace();
		}

		// generate orders
		while (true) {

			Random rand = new Random();

			// randomly create an order
			order = "";
			for (int parts = 0; parts <= rand.nextInt(maxPartsPerOrder); parts++) {
				int random = rand.nextInt(10);
				String product = Integer.toString(random);

				for (int amount = 0; amount <= rand.nextInt(maxAmountPerPart); amount++) {
					order = order + product + ", ";
				}
			}
			order.substring(0, (order.length() - 2));

			// publish order
			System.out.println("ORDER: " + order);
			AID dest = new AID(recipient, AID.ISLOCALNAME);
			ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
			msg.setContent(order);
			msg.addReceiver(dest);
			send(msg);

			// System.out.println("send msg" + msg + " to " +
			// dest.getLocalName());

			// wait some time
			try {
				Thread.sleep(rand.nextInt((int) (maxSecDelay * 1000)));
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			// repeat
		}
	}
 
开发者ID:ChrisQuignon,项目名称:kivasim,代码行数:59,代码来源:Requestdummy.java


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