KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > prevayler > implementation > replication > ServerListener


1 //Prevayler(TM) - The Free-Software Prevalence Layer.
2
//Copyright (C) 2001-2003 Klaus Wuestefeld
3
//This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
4

5 package org.prevayler.implementation.replication;
6
7 import java.io.IOException JavaDoc;
8 import java.net.ServerSocket JavaDoc;
9
10 import org.prevayler.implementation.publishing.TransactionPublisher;
11
12
13 /** Reserved for future implementation.
14  */

15 public class ServerListener extends Thread JavaDoc {
16
17     private final TransactionPublisher _publisher;
18     private final ServerSocket JavaDoc _serverSocket;
19
20
21     public ServerListener(TransactionPublisher publisher, int port) throws IOException JavaDoc {
22         _serverSocket = new ServerSocket JavaDoc(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 JavaDoc iox) {
33             iox.printStackTrace();
34         }
35     }
36 }
37
Popular Tags