1 5 package org.prevayler.implementation.replication; 6 7 import java.io.IOException ; 8 import java.net.ServerSocket ; 9 10 import org.prevayler.implementation.publishing.TransactionPublisher; 11 12 13 15 public class ServerListener extends Thread { 16 17 private final TransactionPublisher _publisher; 18 private final ServerSocket _serverSocket; 19 20 21 public ServerListener(TransactionPublisher publisher, int port) throws IOException { 22 _serverSocket = new ServerSocket (port); 23 _publisher = publisher; 24 setDaemon(true); 25 start(); 26 } 27 28 29 public void run() { 30 try { 31 while (true) new ServerConnection(_publisher, _serverSocket.accept()); 32 } catch (IOException iox) { 33 iox.printStackTrace(); 34 } 35 } 36 } 37 | Popular Tags |