Thread: 'What does this do?

Results 1 to 4 of 4
  1. #1 'What does this do? 
    ZRPS
    Guest
    I was looking through my server.java and found this...

    /**
    * Main Server Tick
    */
    try {
    while (!Server.shutdownServer) {
    if (sleepTime >= 0)
    Thread.sleep(sleepTime);
    else
    Thread.sleep(500);

    engineTimer.reset();
    itemHandler.process();
    playerHandler.process();
    npcHandler.process();
    shopHandler.process();
    objectManager.process();
    fightPits.process();
    pestControl.process();
    cycleTime = engineTimer.elapsed();
    sleepTime = cycleRate - cycleTime;
    totalCycleTime += cycleTime;
    cycles++;
    debug();
    }
    } catch (Exception ex) {
    ex.printStackTrace();
    System.out.println("A fatal exception has been thrown!");
    for (Player p : PlayerHandler.players) {
    if (p == null)
    continue;
    PlayerSave.saveGame((Client) p);
    System.out.println("Saved game for " + p.playerName + ".");
    }
    }
    acceptor = null;
    connectionHandler = null;
    sac = null;
    System.exit(0);
    }
    I marked something red, was just wondering what it does.
    Reply With Quote  
     

  2. #2  
    PokeNation! Xaves's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    3,476
    Thanks given
    356
    Thanks received
    788
    Rep Power
    646
    Makes the thread pause the execution for some time, 500 ms in your example.
    Reply With Quote  
     

  3. #3  
    ZRPS
    Guest
    What would removing it do?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Its paris's Avatar
    Join Date
    Apr 2009
    Posts
    1,141
    Thanks given
    56
    Thanks received
    234
    Rep Power
    689
    Removing it would make your server run (process the data) at an uncontrolable speed. That's something you wouldn't want.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •