NetworkServerControl provides the ability to start a Network Server or connect to a running Network Server to shutdown, configure or retrieve diagnostic information. With the exception of ping, these commands can only be performed from the machine on which the server is running. Commands can be performed from the command line with the following arguments:
Properties can be set in the derby.properties file or on the command line. Properties on the command line take precedence over properties in the derby.properties file. Arguments on the command line take precedence over properties. The following is a list of properties that can be set for NetworkServerControl:
Examples.
This is an example of shutting down the server on port 1621.
java org.apache.derby.drda.NetworkServerControl shutdown -p 1621
This is an example of turning tracing on for session 3
java org.apache.derby.drda.NetworkServerControl trace on -s 3
This is an example of starting and then shutting down the Network Server on port 1621 on machine myhost
java org.apache.derby.drda.NetworkServerControl start -h myhost -p 1621
java org.apache.derby.drda.NetworkServerControl shutdown -h myhost -p 1621
This is an example of starting and shutting down the Network Server in the example above with the API.
NetworkServerControl serverControl = new NetworkServerControl(InetAddress.getByName("myhost"),1621)
serverControl.shutdown();
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| private static final String | |
| private static final String | |
| private static final String | |
| private NetworkServerControlImpl | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public | NetworkServerControl(InetAddress
The IP address of the Network Server host.
address cannot be null. address, int port number server is to used. If <= 0,
default port number is used portNumber, String The user name for actions requiring authorization. userName, String The password for actions requiring authorization. password)Creates a NetworkServerControl object that is configured to control a Network Server on a specified port and InetAddress with given user credentials. |
| public | NetworkServerControl(String
The user name for actions requiring authorization. userName, String The password for actions requiring authorization. password)Creates a NetworkServerControl object that is configured to control a Network Server on the default host and the default port with given user credentials. |
| public | NetworkServerControl(InetAddress
The IP address of the Network Server host.
address cannot be null. address, int port number server is to used. If <= 0,
default port number is used portNumber)Creates a NetworkServerControl object that is configured to control a Network Server on a specified port and InetAddress. |
| public | NetworkServerControl()
Creates a NetworkServerControl object that is configured to control a Network Server on the default host(localhost) and the default port(1527) unless derby.drda.portNumber and derby.drda.host are set. |
| Modifier and Type | Method and Description |
|---|---|
| public Properties | Returns: Properties object containing Network server propertiesGet current Network server properties |
| public int | Returns: maxThreads settingReturns the current maxThreads setting for the running Network Server |
| public String | Returns: run time informationReturn detailed session runtime information about sessions, prepared statements, and memory usage for the running Network Server. |
| public String | Returns: sysinfo outputReturn classpath and version information about the running Network Server. |
| public int | Returns: timeSlice settingReturn the current timeSlice setting for the running Network Server |
| private static boolean | |
| private static boolean | |
| public void | |
| public static void | |
| public void | |
| protected void | |
| public void | setMaxThreads(int
maximum number of connection threads.
If <= 0, connection threads will be created when
there are no free connection threads. max)Set Network Server maxthread parameter. |
| public void | setTimeSlice(int
number of milliseconds given to each session before yielding to
another session, if <=0, never yield. timeslice)Set Network Server connection time slice parameter. |
| public void | setTraceDirectory(String
directory for trace files on machine
where server is running traceDirectory)Set directory for trace files. |
| public void | |
| public void | start(PrintWriter
PrintWriter to which server console will be
output. Null will disable console output. consoleWriter)Start a Network Server. |
| public void | trace(boolean
true to turn tracing on, false to turn tracing off. on)Turn tracing on or off for the specified connection on the Network Server. |
| public void | trace(int
connection number. connNum, boolean Note Connection numbers will print in the Derby error log if logConnections is on true to turn tracing on, false to turn tracing off. on)Turn tracing on or off for all connections on the Network Server. |
| DEFAULT_PORTNUMBER | back to summary |
|---|---|
| public static final int DEFAULT_PORTNUMBER | |
| DERBY_HOSTNAME_WILDCARD | back to summary |
|---|---|
| private static final String DERBY_HOSTNAME_WILDCARD | |
| DERBYNET_JAR | back to summary |
|---|---|
| private static final String DERBYNET_JAR | |
| IPV6_HOSTNAME_WILDCARD | back to summary |
|---|---|
| private static final String IPV6_HOSTNAME_WILDCARD | |
| serverImpl | back to summary |
|---|---|
| private NetworkServerControlImpl serverImpl | |
| SOCKET_PERMISSION_HOSTNAME_WILDCARD | back to summary |
|---|---|
| private static final String SOCKET_PERMISSION_HOSTNAME_WILDCARD | |
| NetworkServerControl | back to summary |
|---|---|
| public NetworkServerControl(InetAddress address, int portNumber, String userName, String password) throws Exception Creates a NetworkServerControl object that is configured to control a Network Server on a specified port and InetAddress with given user credentials.
| |
| NetworkServerControl | back to summary |
|---|---|
| public NetworkServerControl(String userName, String password) throws Exception Creates a NetworkServerControl object that is configured to control a Network Server on the default host and the default port with given user credentials. | |
| NetworkServerControl | back to summary |
|---|---|
| public NetworkServerControl(InetAddress address, int portNumber) throws Exception Creates a NetworkServerControl object that is configured to control a Network Server on a specified port and InetAddress. Examples: To configure for port 1621 and listen on the loopback address:
NetworkServerControl util = new
NetworkServerControl(InetAddress.getByName("localhost"), 1621);
| |
| NetworkServerControl | back to summary |
|---|---|
| public NetworkServerControl() throws Exception Creates a NetworkServerControl object that is configured to control a Network Server on the default host(localhost) and the default port(1527) unless derby.drda.portNumber and derby.drda.host are set.
new NetworkServerControl()
is equivalent to calling
new NetworkServerControl(InetAddress.getByName("localhost"),1527);
| |
| getCurrentProperties | back to summary |
|---|---|
| public Properties getCurrentProperties() throws Exception Get current Network server properties
| |
| getMaxThreads | back to summary |
|---|---|
| public int getMaxThreads() throws Exception Returns the current maxThreads setting for the running Network Server
| |
| getRuntimeInfo | back to summary |
|---|---|
| public String getRuntimeInfo() throws Exception Return detailed session runtime information about sessions, prepared statements, and memory usage for the running Network Server. | |
| getSysinfo | back to summary |
|---|---|
| public String getSysinfo() throws Exception Return classpath and version information about the running Network Server. | |
| getTimeSlice | back to summary |
|---|---|
| public int getTimeSlice() throws Exception Return the current timeSlice setting for the running Network Server
| |
| hostnamesEqual | back to summary |
|---|---|
| private static boolean hostnamesEqual(String left, String right) | |
| isIPV6Address | back to summary |
|---|---|
| private static boolean isIPV6Address(String hostname) | |
| logConnections | back to summary |
|---|---|
| public void logConnections(boolean on) throws Exception Turn logging connections on or off. When logging is turned on a message is written to the Derby error log each time a connection is made.
| |
| main | back to summary |
|---|---|
| public static void main(String[] args) main routine for NetworkServerControl
| |
| ping | back to summary |
|---|---|
| public void ping() throws Exception Check if the Network Server is started. Excecutes and returns without error if the server has started
| |
| setClientLocale | back to summary |
|---|---|
| protected void setClientLocale(String locale) set the client locale. Used by servlet for localization
| |
| setMaxThreads | back to summary |
|---|---|
| public void setMaxThreads(int max) throws Exception Set Network Server maxthread parameter. This is the maximum number of threads that will be used for JDBC client connections. setTimeSlice should also be set so that clients will yield appropriately.
| |
| setTimeSlice | back to summary |
|---|---|
| public void setTimeSlice(int timeslice) throws Exception Set Network Server connection time slice parameter. This should be set and is only relevant if setMaxThreads > 0.
| |
| setTraceDirectory | back to summary |
|---|---|
| public void setTraceDirectory(String traceDirectory) throws Exception Set directory for trace files. The directory must be on the machine where the server is running. | |
| shutdown | back to summary |
|---|---|
| public void shutdown() throws Exception Shutdown a Network Server. Shuts down the Network Server listening on the port and InetAddress specified in the constructor for this NetworkServerControl object.
| |
| start | back to summary |
|---|---|
| public void start(PrintWriter consoleWriter) throws Exception Start a Network Server. This method will launch a separate thread and start a Network Server. This method may return before the server is ready to accept connections. Use the ping method to verify that the server has started. Note an alternate method to starting the Network Server with the API, is to use the derby.drda.startNetworkServer property in derby.properties.
| |
| trace | back to summary |
|---|---|
| public void trace(boolean on) throws Exception Turn tracing on or off for the specified connection on the Network Server.
| |
| trace | back to summary |
|---|---|
| public void trace(int connNum, boolean on) throws Exception Turn tracing on or off for all connections on the Network Server.
| |