[Pogamut-list] Proper Server Termination
jacob.schrum
pogamut-forum at diana.ms.mff.cuni.cz
Fri Apr 22 19:27:28 CEST 2011
Re: Proper Server Termination
Author: jacob.schrum
Good to know. I'll probably try it out once I figure out the best way to send custom controllers to the jar for the bot. In the meantime, I have a few questions about how I'm currently implementing things. I'm seeing the following error:
{CODE()}
FatalErrorEvent[
Component: ComponentBus[UT^2-9 at 192.168.1.104/61391a07-7839-8649-e458-00ff16f3a913, running=true, queue length=0]
Message: Exception happened during the event propagation.
Cause: class java.lang.NullPointerException: null (at cz.cuni.amis.pogamut.base3d.worldview.impl.VisionWorldView.objectUpdatedEvent(VisionWorldView.java:145))
Stacktrace:
cz.cuni.amis.pogamut.base.component.bus.event.impl.FatalErrorPropagatingEvent.(FatalErrorPropagatingEvent.java:11)
cz.cuni.amis.pogamut.base.component.bus.ComponentBus.processQueue(ComponentBus.java:688)
cz.cuni.amis.pogamut.base.component.bus.ComponentBus.event(ComponentBus.java:628)
cz.cuni.amis.pogamut.base.component.bus.ComponentBus.eventTransactional(ComponentBus.java:654)
cz.cuni.amis.pogamut.base.component.bus.event.ComponentBusEvents.eventTransactional(ComponentBusEvents.java:86)
cz.cuni.amis.pogamut.base.component.bus.event.ComponentBusEvents.stoppingTransactional(ComponentBusEvents.java:232)
cz.cuni.amis.pogamut.base.agent.impl.AbstractAgent.stop(AbstractAgent.java:583)
pogamut.killers.BotKiller.call(BotKiller.java:38)
pogamut.killers.BotKiller.call(BotKiller.java:15)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:619)
Caused by: class java.lang.NullPointerException: null (at cz.cuni.amis.pogamut.base3d.worldview.impl.VisionWorldView.objectUpdatedEvent(VisionWorldView.java:145))
cz.cuni.amis.pogamut.base3d.worldview.impl.VisionWorldView.objectUpdatedEvent(VisionWorldView.java:145)
cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView.innerNotify(EventDrivenWorldView.java:124)
cz.cuni.amis.pogamut.base.communication.worldview.impl.EventDrivenWorldView.notifyImmediately(EventDrivenWorldView.java:238)
cz.cuni.amis.pogamut.base3d.worldview.impl.BatchAwareWorldView.notifyImmediately(BatchAwareWorldView.java:96)
cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Raycasting.cleanUp(Raycasting.java:67)
cz.cuni.amis.pogamut.base.agent.module.AgentModule.stop(AgentModule.java:183)
cz.cuni.amis.pogamut.base.agent.module.AgentModule$1.stop(AgentModule.java:146)
cz.cuni.amis.pogamut.base.component.controller.ComponentController.stop(ComponentController.java:1369)
cz.cuni.amis.pogamut.base.component.controller.ComponentController.stoppingChangedByStoppingEvent(ComponentController.java:1147)
cz.cuni.amis.pogamut.base.component.controller.ComponentController.stoppingEvent(ComponentController.java:892)
cz.cuni.amis.pogamut.base.component.controller.ComponentController.access$700(ComponentController.java:122)
cz.cuni.amis.pogamut.base.component.controller.ComponentController$8.notify(ComponentController.java:220)
cz.cuni.amis.pogamut.base.component.controller.ComponentController$8.notify(ComponentController.java:216)
cz.cuni.amis.pogamut.base.component.bus.ComponentBus.notifyListenersC(ComponentBus.java:444)
cz.cuni.amis.pogamut.base.component.bus.ComponentBus.innerRaiseEvent(ComponentBus.java:549)
cz.cuni.amis.pogamut.base.component.bus.ComponentBus.processQueue(ComponentBus.java:682)
cz.cuni.amis.pogamut.base.component.bus.ComponentBus.event(ComponentBus.java:628)
cz.cuni.amis.pogamut.base.component.bus.ComponentBus.eventTransactional(ComponentBus.java:654)
cz.cuni.amis.pogamut.base.component.bus.event.ComponentBusEvents.eventTransactional(ComponentBusEvents.java:86)
cz.cuni.amis.pogamut.base.component.bus.event.ComponentBusEvents.stoppingTransactional(ComponentBusEvents.java:232)
cz.cuni.amis.pogamut.base.agent.impl.AbstractAgent.stop(AbstractAgent.java:583)
pogamut.killers.BotKiller.call(BotKiller.java:38)
pogamut.killers.BotKiller.call(BotKiller.java:15)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:619)
]
{CODE}
BotKiller is a class I made that runs in a separate thread. Here is its call method:
{CODE()}
public Boolean call() throws Exception {
System.out.println(b.getName() + ": Killing " + b);
try {
b.stop();
} catch (ComponentCantStopException nostop) {
System.out.println("Can't stop, then kill: " + b.getName());
try {
b.kill();
} catch (Exception e) {
System.out.println("Exception within the kill for " + b.getName());
}
} catch (NullPointerException npe) {
System.out.println("NullPointerException on bot kill: " + npe);
} catch (Exception e) {
System.out.println("Exception on bot kill: " + e);
}
System.out.println(b.getName() + ": Done killing " + b);
return true;
}
{CODE}
I want to catch and suppress these errors. What exactly are FatalErrors in Pogamut, and how can I suppress them like Exceptions? Since I only call this when killing a server, I don't care if errors happen on shutdown. Also, I find it strange that even when I get a FatalError with a NullPointerException, the code in my catch (NullPointerException npe) block is never executed (I never see the result of the println).
--
Reply Link: <http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?forumId=4&comments_reply_threadId=4&comments_parentId=682&post_reply=1#form>
More information about the Pogamut-list
mailing list