public class TcpServer extends Object implements Service
Constructor and Description |
---|
TcpServer() |
Modifier and Type | Method and Description |
---|---|
String |
checkKeyAndGetDatabaseName(String db)
If no key is set, return the original database name.
|
boolean |
getAllowOthers()
Check if remote connections are allowed.
|
static String |
getManagementDbName(int port)
Get the database name of the management database.
|
String |
getName()
Get the human readable name of the service.
|
int |
getPort()
Gets the port this service is listening on.
|
String |
getType()
Get the human readable short name of the service.
|
String |
getURL()
Get the URL of this service in a human readable form
|
void |
init(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(String url,
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,
String password,
int shutdownMode)
Stop a running server.
|
public static String getManagementDbName(int port)
port
- the TCP server portpublic void setShutdownHandler(ShutdownHandler shutdownHandler)
public void init(String... args)
Service
public String getURL()
Service
public int getPort()
Service
public void start() throws SQLException
Service
start
in interface Service
SQLException
public void listen()
Service
public boolean isRunning(boolean traceError)
Service
public void stop()
Service
public static void stopServer(int port, 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()
Service
getAllowOthers
in interface Service
public String getType()
Service
public String getName()
Service
public static void shutdown(String url, String password, boolean force, boolean all) throws 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
stoppedSQLException
public String checkKeyAndGetDatabaseName(String db)
db
- the key to test (or database name if no key is used)DbException
- if a key is set but doesn't matchCopyright © 2012 JBoss by Red Hat. All Rights Reserved.