Package edu.caltech.nanodb.client
Class ExclusiveClient
- java.lang.Object
-
- edu.caltech.nanodb.client.InteractiveClient
-
- edu.caltech.nanodb.client.ExclusiveClient
-
public class ExclusiveClient extends InteractiveClient
This class is used for starting the NanoDB database in "exclusive mode," where only a single client interacts directly with the database system. In fact, the exclusive client embeds the
NanoDBServer
instance in the client object, since there is no need to interact with the server over a network socket.Note that it is wrong to start multiple exclusive clients against the same data directory!!! Exclusive-mode operation expects that only this server is interacting with the data files. For concurrent access from multiple clients, see the
SharedServerClient
class.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Logger
logger
private NanoDBServer
server
The server that this exclusive client is using.
-
Constructor Summary
Constructors Constructor Description ExclusiveClient()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CommandResult
handleCommand(java.lang.String command)
Subclasses can implement this method to handle each command entered by the user.static void
main(java.lang.String[] args)
void
shutdown()
Shut down the interactive client.void
startup()
Start up the interactive client.-
Methods inherited from class edu.caltech.nanodb.client.InteractiveClient
mainloop
-
-
-
-
Field Detail
-
logger
private static org.apache.logging.log4j.Logger logger
-
server
private NanoDBServer server
The server that this exclusive client is using.
-
-
Method Detail
-
startup
public void startup()
Description copied from class:InteractiveClient
Start up the interactive client. The specific way the client interacts with the server dictates how this startup mechanism will work.- Specified by:
startup
in classInteractiveClient
-
handleCommand
public CommandResult handleCommand(java.lang.String command)
Description copied from class:InteractiveClient
Subclasses can implement this method to handle each command entered by the user. For example, a subclass may send the command over a socket to the server, wait for a response, then output the response to the console.- Specified by:
handleCommand
in classInteractiveClient
- Parameters:
command
- the command to handle.- Returns:
- the command-result from executing the command
-
shutdown
public void shutdown()
Description copied from class:InteractiveClient
Shut down the interactive client. The specific way the client interacts with the server dictates how this shutdown mechanism will work.- Specified by:
shutdown
in classInteractiveClient
-
main
public static void main(java.lang.String[] args)
-
-