Package edu.caltech.nanodb.server
Class SharedServer
- java.lang.Object
-
- edu.caltech.nanodb.server.SharedServer
-
public class SharedServer extends java.lang.Object
This class implements a "shared" database server that listens for incoming connections on a socket, so that the database can have multiple concurrent clients connected at the same time.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.HashMap<java.lang.Integer,ClientHandlerThread>
clientThreads
A mapping from client ID to the thread handling the client.static int
DEFAULT_SERVER_PORT
The default server port is 12200, since we use NanoDB in CS122!private static org.apache.logging.log4j.Logger
logger
A logging object for reporting anything interesting that happens.private NanoDBServer
server
The actual NanoDB server that handles incoming requests from various clients.private int
serverPort
The actual server port being used.
-
Constructor Summary
Constructors Constructor Description SharedServer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
void
shutdown()
void
startup()
-
-
-
Field Detail
-
logger
private static org.apache.logging.log4j.Logger logger
A logging object for reporting anything interesting that happens.
-
DEFAULT_SERVER_PORT
public static final int DEFAULT_SERVER_PORT
The default server port is 12200, since we use NanoDB in CS122!- See Also:
- Constant Field Values
-
serverPort
private int serverPort
The actual server port being used.
-
server
private NanoDBServer server
The actual NanoDB server that handles incoming requests from various clients.
-
clientThreads
private final java.util.HashMap<java.lang.Integer,ClientHandlerThread> clientThreads
A mapping from client ID to the thread handling the client. This is declared final since we synchronize on it.
-
-