日期:2014-05-20  浏览次数:20709 次

msnm获得msn联系人列表后main函数还一直运行,怎么才能在我获得列表后main不处于监听状态?
public List getMsnList(String number, String password) throws DAOException {
MSNMessenger msn = new MSNMessenger(number, password);
msn.setInitialStatus(UserStatus.ONLINE);
msn.login();
BuddyGroup group = msn.getBuddyGroup();
BuddyList buddyList = group.getAllowList();

List list = new ArrayList();
String loginName = "";
MsnFriend friend = null;
for (Iterator it = buddyList.iterator(); it.hasNext();) {
friend = (MsnFriend) it.next();
loginName = friend.getLoginName();
list.add(loginName);

}
return list;

}

public static void main(String[] args) {
ImService s = new ImService();
List list = null;
try {
list = s.getMsnList("lilsean1985@hotmail.com", "325800");
} catch (DAOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("11111");
}
msn.logout()后还是处于监听状态
System.exit(0)的话
调用那方法的action就会自己销毁。。。
咋解决啊

------解决方案--------------------
return true;