/*
 * The MIT License
 *
 * Copyright 2015 AE97
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package net.ae97.notlet.server.engine;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import net.ae97.notlet.logging.LoggerFactory;

public class GameEngine implements Runnable {

    //Indicates which game number is the newest
    private static Integer engineCounter = 0;
    private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    private final Logger logger;
    private long tickCount = 0;
    private final int threadId;
    private final int seed;
    private final boolean isSingleLevel;

    public GameEngine(String seed) {
        synchronized (engineCounter) {
            engineCounter++;
            threadId = engineCounter;
        }
        logger = LoggerFactory.create("Engine-" + threadId);
        if (seed == null || seed.isEmpty()) {
            isSingleLevel = false;
            this.seed = 0;
        } else {
            isSingleLevel = true;
            this.seed = seed.hashCode();
        }
    }

    /**
     * Start the game engine
     */
    public void start() {
        executor.scheduleAtFixedRate(this, 0, 25, TimeUnit.MILLISECONDS);
    }

    /**
     * Executes a single 'tick'
     */
    @Override
    public void run() {
        tickCount++;
        logger.info("Ticking " + tickCount);
    }

    /**
     * Stops future ticks from occurring
     */
    public void stop() {
        executor.shutdown();
    }

}

@@ -1489,13 +1489,25 @@
 tic 
-Integ
+final EngineCount
 er e
@@ -1521,17 +1521,35 @@
 unter = 
-0
+new EngineCounter()
 ;%0A    pr
@@ -1858,115 +1858,45 @@
     
-synchronized (engineCounter) %7B%0A            engineCounter++;%0A            threadId = engineCounter;%0A        %7D
+threadId = engineCounter.increment();
 %0A   
@@ -2474,16 +2474,84 @@
 Count);%0A
+        if (tickCount == 1000) %7B%0A            this.stop();%0A        %7D%0A
     %7D%0A%0A 
@@ -2643,28 +2643,254 @@
     
-executor.shutdown();
+logger.info(%22Stopping%22);%0A        executor.shutdown();%0A    %7D%0A%0A    private final static class EngineCounter %7B%0A%0A        private int counter;%0A%0A        public synchronized int increment() %7B%0A            counter++;%0A            return counter;%0A        %7D%0A
 %0A   

Use final counter engine for thread id, stop after so many ticks