public class TcpServer extends java.lang.Object implements Service
| Constructor and Description |
|---|
TcpServer() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
checkKeyAndGetDatabaseName(java.lang.String db)
If no key is set, return the original database name.
|
boolean |
getAllowOthers()
Check if remote connections are allowed.
|
static java.lang.String |
getManagementDbName(int port)
Get the database name of the management database.
|
java.lang.String |
getName()
Get the human readable name of the service.
|
int |
getPort()
Gets the port this service is listening on.
|
java.lang.String |
getType()
Get the human readable short name of the service.
|
java.lang.String |
getURL()
Get the URL of this service in a human readable form
|
void |
init(java.lang.String... args)
Initialize the service from command line options.
|
boolean |
isDaemon()
Check if a daemon thread should be used.
|
boolean |
isRunning(boolean traceError)
Check if the service is running.
|
void |
listen()
Listen for incoming connections.
|
void |
setShutdownHandler(ShutdownHandler shutdownHandler) |
static void |
shutdown(java.lang.String url,
java.lang.String password,
boolean force,
boolean all)
Stop the TCP server with the given URL.
|
void |
start()
Start the service.
|
void |
stop()
Stop the service.
|
static void |
stopServer(int port,
java.lang.String password,
int shutdownMode)
Stop a running server.
|
public static java.lang.String getManagementDbName(int port)
port - the TCP server portpublic void setShutdownHandler(ShutdownHandler shutdownHandler)
public void init(java.lang.String... args)
Servicepublic java.lang.String getURL()
Servicepublic int getPort()
Servicepublic void start()
throws java.sql.SQLException
Servicepublic void listen()
Servicepublic boolean isRunning(boolean traceError)
Servicepublic void stop()
Servicepublic static void stopServer(int port,
java.lang.String password,
int shutdownMode)
port - the port where the server runs, or 0 for all running serverspassword - the password (or null)shutdownMode - the shutdown mode, SHUTDOWN_NORMAL or SHUTDOWN_FORCE.public boolean getAllowOthers()
ServicegetAllowOthers in interface Servicepublic java.lang.String getType()
Servicepublic java.lang.String getName()
Servicepublic static void shutdown(java.lang.String url,
java.lang.String password,
boolean force,
boolean all)
throws java.sql.SQLException
url - the database URLpassword - the passwordforce - if the server should be stopped immediatelyall - whether all TCP servers that are running in the JVM should be
stoppedjava.sql.SQLExceptionpublic java.lang.String checkKeyAndGetDatabaseName(java.lang.String db)
db - the key to test (or database name if no key is used)DbException - if a key is set but doesn't match