Save data when server restarts
Posted: 26 Jan 2009, 15:57
Hi!
Im having some extra data on each user that i'd like to save when the server restarts. The problem is that the I can't find any place to save the data at.
First i hoped that the internal event "userLost" would be fired when the server stopped but that didnt happen.
Then I tried destoy() in my zone extension like this.
it only traces
This is a problem right now since all users online will lose their stats if we restart the database.
There are sone exceptions thrown after "Zone destoyed" but i think thats a trailproblem from users not being kicked and then our Ping-module tries to kick it again since it havn't been cleaned up correctly.
Anyway it looks like this. Might be to any help:
Thanks in advance
b.t.w we are using SFS Pro 1.6.3
Im having some extra data on each user that i'd like to save when the server restarts. The problem is that the I can't find any place to save the data at.
First i hoped that the internal event "userLost" would be fired when the server stopped but that didnt happen.
Then I tried destoy() in my zone extension like this.
Code: Select all
public void destroy() {
System.out.println("Kicking all users in zone");
@SuppressWarnings("unchecked")
LinkedList<User> allUsers = this.zone.getAllUsersInZone();
//try to logout all users
for(User u:allUsers){
System.out.println("Kicking user " + u.getName());
this.server.logoutUser(u, false, true);
}
System.out.println("Zone destoyed");
}Is there any other place that I can handle a logut nice and save all my data to a mysql-database.2009-jan-26 17:59:34 it.gotoandplay.smartfoxserver.extensions.AdminExtension sendHaltSignal
INFO: Server Halt was requested by administrator.
Halting Server ...
Kicking all users in zone
Zone destoyed
This is a problem right now since all users online will lose their stats if we restart the database.
There are sone exceptions thrown after "Zone destoyed" but i think thats a trailproblem from users not being kicked and then our Ping-module tries to kick it again since it havn't been cleaned up correctly.
Anyway it looks like this. Might be to any help:
Thanks in advance
b.t.w we are using SFS Pro 1.6.3
17:59:44.969 - [ WARNING ] > Generic Exception in acceptNewConnections():java.nio.channels.ClosedSelectorException
2009-jan-26 17:59:44 it.gotoandplay.smartfoxserver.SmartFoxServer acceptNewConnections
VARNING: Generic Exception in acceptNewConnections():java.nio.channels.ClosedSelectorException
java.nio.channels.ClosedSelectorException
at sun.nio.ch.SelectorImpl.selectedKeys(SelectorImpl.java:57)
at it.gotoandplay.smartfoxserver.SmartFoxServer.acceptNewConnections(SmartFoxServer.java:711)
at it.gotoandplay.smartfoxserver.SmartFoxServer.run(SmartFoxServer.java:657)
2009-jan-26 17:59:45 org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing org.apache.cxf.bus.spring.BusApplicationContext@4c261e41: display name [org.apache.cxf.bus.spring.BusApplicationContext@4c261e41]; startup date [Mon Jan 26 17:59:06 CET 2009]; parent: org.springframework.web.context.support.XmlWebApplicationContext@5820c3da
2009-jan-26 17:59:45 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@8505bad: defining beans []; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@4f5c1769
2009-01-26 17:59:45.877:/cxfApp:INFO: Closing Spring root WebApplicationContext
2009-jan-26 17:59:45 org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing org.springframework.web.context.support.XmlWebApplicationContext@5820c3da: display name [Root WebApplicationContext]; startup date [Mon Jan 26 17:58:53 CET 2009]; root of context hierarchy
2009-jan-26 17:59:45 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4f5c1769: defining beans [cxf,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,loginservice]; root of factory hierarchy
2009-jan-26 17:59:46 it.gotoandplay.smartfoxserver.webserver.WebServer stop
INFO: Web server stopped.
---------------------Native error-----------------------
Exception name: java.lang.NullPointerException
Error Time: 26 jan 09 - 18:00:18
Error Code: Not availible
Error Desc: Not availible
Error Mess: null
User Name: Not availible
User Ip: Not availible
Stack Trace:
null
null
it.gotoandplay.smartfoxserver.SmartFoxServer.getChannelQueue(SmartFoxServer.java:795)
it.gotoandplay.smartfoxserver.EventWriter.handleEvent(EventWriter.java:136)
it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.sendGenericMessage(ExtensionHelper.java:261)
se.raketspel.smartbox.core.ExtensionCore.sendSmartBoxMessage(ExtensionCore.java:217)
se.raketspel.smartbox.application.authManager.AuthManagerProtocolManager.PING(AuthManagerProtocolManager.java:145)
se.raketspel.smartbox.core.IdleUsersHandler.checkTimeOuts(IdleUsersHandler.java:124)
se.raketspel.smartbox.core.IdleUsersHandler.run(IdleUsersHandler.java:105)
java.util.TimerThread.mainLoop(Timer.java:512)
java.util.TimerThread.run(Timer.java:462)
--------------------------------------------------------
18:00:38.590 - [ WARNING ] > Exception during client disconnection: java.lang.NullPointerException
2009-jan-26 18:00:38 it.gotoandplay.smartfoxserver.SmartFoxServer lostConnection
VARNING: Exception during client disconnection: java.lang.NullPointerException
java.lang.NullPointerException
at it.gotoandplay.smartfoxserver.SmartFoxServer.lostConnection(SmartFoxServer.java:1451)
at it.gotoandplay.smartfoxserver.controllers.SystemHandler.kickUser(SystemHandler.java:2558)
at it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.disconnectUser(ExtensionHelper.java:940)
at se.raketspel.smartbox.core.IdleUsersHandler.checkTimeOuts(IdleUsersHandler.java:158)
at se.raketspel.smartbox.core.IdleUsersHandler.run(IdleUsersHandler.java:105)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Exception in thread "IdleUserManagerClock" java.lang.NullPointerException
at it.gotoandplay.smartfoxserver.SmartFoxServer.lostConnection(SmartFoxServer.java:1546)
at it.gotoandplay.smartfoxserver.controllers.SystemHandler.kickUser(SystemHandler.java:2558)
at it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.disconnectUser(ExtensionHelper.java:940)
at se.raketspel.smartbox.core.IdleUsersHandler.checkTimeOuts(IdleUsersHandler.java:158)
at se.raketspel.smartbox.core.IdleUsersHandler.run(IdleUsersHandler.java:105)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)