Thread: Auto Restart - If crash happens within the main method

Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11  
    Registered Member
    Join Date
    Jul 2007
    Age
    91
    Posts
    131
    Thanks given
    3
    Thanks received
    8
    Rep Power
    36
    TheFearow/Phate already built this in with Scape-Rune

    Code:
    	while(!shutdownServer) {
    			try{
    			playerHandler.process();	npcHandler.process();	itemHandler.process();
    			} catch(Exception e) { }
    			sPointRound += 1;
    			if (sPointRound == 2) { sPointRound = 0; spawnPointManager.process(); }
    			/*if (cycle == 1200)
    			{
    				restartServerOne();
    			}
    			if (cycle == 1202)
    			{
    				restartServerTwo();
    			}*/
    			long timeSpent = System.currentTimeMillis()-lastTicks;
    			totalTimeSpentProcessing += timeSpent;
    			if(timeSpent >= cycleTime) {
    				timeSpent = cycleTime;
    				//if(++waitFails > 100) { shutdownServer = true;
    					//misc.printlnTag("Restart your computer"); }  
    				}
    
    			try { Thread.sleep(cycleTime-timeSpent); } catch(java.lang.Exception _ex) { }
    			lastTicks = System.currentTimeMillis();	cycle ++;
    			if(cycle % 100 == 0) {
    				float time = ((float)totalTimeSpentProcessing)/cycle; }
    		}
    
    			Database.destroyConnection();	shutdownServer = true; playerHandler.destruct();		clientHandler.killServer();		clientHandler = null;         main(null);
    	}
     

  2. #12  
    skippy the llama
    Guest
    nevermind i fixed it rep
     

Page 2 of 2 FirstFirst 12

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 67
    Last Post: 11-09-2015, 09:41 PM
  2. Method Of Auto-Save
    By Sir Tom in forum Snippets
    Replies: 10
    Last Post: 09-12-2010, 10:42 AM
  3. Java Main Method
    By Zonchord in forum Help
    Replies: 5
    Last Post: 06-27-2010, 10:11 PM
  4. Crasher Checker + Auto Restart
    By Lil Str Kid in forum Tutorials
    Replies: 19
    Last Post: 05-30-2009, 04:47 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •