Package org.h2.server
Interface Service
public interface Service
Classes implementing this interface usually provide a
TCP/IP listener such as an FTP server.
The can be started and stopped, and may or may not
allow remote connections.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if remote connections are allowed.getName()
Get the human readable name of the service.int
getPort()
Gets the port this service is listening on.getType()
Get the human readable short name of the service.getURL()
Get the URL of this service in a human readable formvoid
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
start()
Start the service.void
stop()
Stop the service.
-
Method Details
-
init
Initialize the service from command line options.- Parameters:
args
- the command line options- Throws:
Exception
- on failure
-
getURL
String getURL()Get the URL of this service in a human readable form- Returns:
- the url
-
start
Start the service. This usually means create the server socket. This method must not block.- Throws:
SQLException
- on failure
-
listen
void listen()Listen for incoming connections. This method blocks. -
stop
void stop()Stop the service. -
isRunning
boolean isRunning(boolean traceError) Check if the service is running.- Parameters:
traceError
- if errors should be written- Returns:
- if the server is running
-
getAllowOthers
boolean getAllowOthers()Check if remote connections are allowed.- Returns:
- true if remote connections are allowed
-
getName
String getName()Get the human readable name of the service.- Returns:
- the name
-
getType
String getType()Get the human readable short name of the service.- Returns:
- the type
-
getPort
int getPort()Gets the port this service is listening on.- Returns:
- the port
-
isDaemon
boolean isDaemon()Check if a daemon thread should be used.- Returns:
- true if a daemon thread should be used
-