Subject: Experts!!!: Getting Current Agent List anytime I want--PLS HelP
From: OgaTom (oeze@engga.uwo.ca)
Date: Mon Dec 02 2002 - 05:25:30 MET
Hi Jaders,
I have the following method within my CareerAgent:
Vector AgentList=new Vector();
public Vector getCurrentList() {
DFAgentDescription dfd = new DFAgentDescription();
try {
List onlineAgents = DFServiceCommunicator.search(this, getDefaultDF(), dfd);
AID agentFound =new AID();
Iterator iter = onlineAgents.iterator();
while (iter.hasNext()) {
DFAgentDescription desc = (DFAgentDescription)iter.next();
agentFound = (AID) (desc.getName());
System.out.println(this.getLocalName()+": "+agentFound);
AgentList.add(agentFound);
}
}catch (Exception fe) {
System.err.println(getLocalName() + " search with DF is not succeeded because of " +
fe.getMessage());
doDelete();
}
System.out.println("Found atleast one"+AgentList.get(0));
return this.AgentList;
}
I have another class which I call Sender. This sender is not an Agent and has a method Called getMeCurrentAgents.I need this list inorder to send messages to all Agents from the Sender class
CareerAgent all= new CareerAgent();
public void getMeCurrentAgents() {
Vector newList=all.getCurrentList();
.
.
.
}
The newList is always empty.Why is it impossible for me to get current List of agents anytime I want.
I keep getting this error: java.lang.NullPointerException
It appears that AgentList returns empty.
WILL APPRECIATE YOUR HELP!!!!
Oga
This archive was generated by hypermail 2a22 : Mon Dec 02 2002 - 05:24:33 MET