/Users/lyon/j4p/src/classUtils/loaders/ReloadServer.java

1    package classUtils.loaders; 
2     
3    //package net.compute; 
4     
5    import java.io.IOException; 
6    import java.net.ServerSocket; 
7    import java.net.Socket; 
8     
9     
10   public class ReloadServer implements Runnable { 
11       public static final int PORT = 8086; 
12    
13       public static void main(String args[]) { 
14           Thread serverThread = new Thread( 
15                   new ReloadServer()); 
16           serverThread.start(); 
17           try { 
18               Thread.sleep(1000); 
19           } catch (InterruptedException e) { 
20           } 
21       } 
22    
23       public void run() { 
24           try { 
25               ServerSocket ss = 
26                       new ServerSocket(PORT); 
27               while (true) { 
28                   System.out.println("waiting"); 
29                   // block the primary thread of execution 
30                   // during the accept invocation 
31                   Socket socket = ss.accept(); 
32                   // use socket to get a computable object 
33                   // do the computation and return the result. 
34                   ReloadThread ct = 
35                           new ReloadThread(socket); 
36                   ct.start(); 
37    
38               } 
39           } catch (IOException e) { 
40               e.printStackTrace(); 
41           } 
42       } 
43   } 
44