monkey-island/src/fr/eseo/game/network/MonkeyIsland.java
public static void main(String[] args) {

        try {

            // Start the monkey island game and open the socket.
            System.out.println("MonkeyIsland server is running.");
            ServerSocket listener = new ServerSocket(PORT);

            // Call a timeout to make each monkey move every time.
            ScheduledExecutorService execCrazy = Executors.newSingleThreadScheduledExecutor();
            for (Monkey monkey : island.getCrazyMonkeys()) {
            	execCrazy.scheduleAtFixedRate(monkey, 0, monkey.getSpeed(), TimeUnit.SECONDS);
            }
            ScheduledExecutorService execHunter = Executors.newSingleThreadScheduledExecutor();
            for (Monkey monkey : island.getHunterMonkeys()) {
            	execHunter.scheduleAtFixedRate(monkey, 0, monkey.getSpeed(), TimeUnit.SECONDS);
            }

            // Wait on new client connection.
            try {

                while (true) {
                    new Client(listener.accept()).start();
                }

            } finally {
                listener.close();
            }

        } catch (IOException e) {
            e.printStackTrace();
        }

    }
/**
     * The appplication main method, which just listens on a port and
     * spawns client threads.
     * @param args The args of the main.
     */
The appplication main method, which just listens on a port and
spawns client threads.
@param args The args of the main.
The appplication main method which just listens on a port and spawns client threads . @param args The args of the main .
public static void main(String[] args) {
        try {
            System.out.println("MonkeyIsland server is running.");
            ServerSocket listener = new ServerSocket(PORT);
            ScheduledExecutorService execCrazy = Executors.newSingleThreadScheduledExecutor();
            for (Monkey monkey : island.getCrazyMonkeys()) {
            	execCrazy.scheduleAtFixedRate(monkey, 0, monkey.getSpeed(), TimeUnit.SECONDS);
            }
            ScheduledExecutorService execHunter = Executors.newSingleThreadScheduledExecutor();
            for (Monkey monkey : island.getHunterMonkeys()) {
            	execHunter.scheduleAtFixedRate(monkey, 0, monkey.getSpeed(), TimeUnit.SECONDS);
            }
            try {
                while (true) {
                    new Client(listener.accept()).start();
                }
            } finally {
                listener.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
public static void main ( String [ ] args ) { try { System . out . println ( "MonkeyIsland server is running." ) ; ServerSocket listener = new ServerSocket ( PORT ) ; ScheduledExecutorService execCrazy = Executors . newSingleThreadScheduledExecutor ( ) ; for ( Monkey monkey : island . getCrazyMonkeys ( ) ) { execCrazy . scheduleAtFixedRate ( monkey , 0 , monkey . getSpeed ( ) , TimeUnit . SECONDS ) ; } ScheduledExecutorService execHunter = Executors . newSingleThreadScheduledExecutor ( ) ; for ( Monkey monkey : island . getHunterMonkeys ( ) ) { execHunter . scheduleAtFixedRate ( monkey , 0 , monkey . getSpeed ( ) , TimeUnit . SECONDS ) ; } try { while ( true ) { new Client ( listener . accept ( ) ) . start ( ) ; } } finally { listener . close ( ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } }
The appplication main method, which just listens on a port and
 spawns client threads.
The appplication main method which just listens on a port and spawns client threads .
// Start the monkey island game and open the socket. // Call a timeout to make each monkey move every time. // Wait on new client connection.