Java Doc for NetworkServerControl.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » drda » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.drda 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.drda.NetworkServerControl

NetworkServerControl
public class NetworkServerControl (Code)
NetworkServerControl provides the ability to start a Network Server or connect to a running Network Server to shutdown, configure or retreive 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:

  • start [-h <host>] [-p <portnumber>]: This starts the network server on the port/host specified or on localhost, port 1527 if no host/port is specified and no properties are set to override the defaults. By default Network Server will only listen for connections from the machine on which it is running. Use -h 0.0.0.0 to listen on all interfaces or -h <hostname> to listen on a specific interface on a multiple IP machine.
  • shutdown [-h <host>][-p <portnumber>]: This shutdowns the network server on the host and port specified or on the local host and port 1527(default) if no host or port is specified.
  • ping [-h <host>] [-p <portnumber>] This will test whether the Network Server is up.
  • sysinfo [-h <host>] [-p <portnumber>]: This prints classpath and version information about the Network Server, the JVM and the Derby engine.
  • runtimeinfo [-h <host] [-p <portnumber]: This prints extensive debbugging information about sessions, threads, prepared statements, and memory usage for the running Network Server.
  • logconnections {on | off} [-h <host>] [-p <portnumber>]: This turns logging of connections on or off. Connections are logged to derby.log. Default is off.
  • maxthreads <max> [-h <host>][-p <portnumber>]: This sets the maximum number of threads that can be used for connections. Default 0 (unlimitted).
  • timeslice <milliseconds> [-h <host>][-p <portnumber>]: This sets the time each session can have using a connection thread before yielding to a waiting session. Default is 0 (no yeild).
  • trace {on | off} [-s <session id>] [-h <host>] [-p <portnumber>]: This turns drda tracing on or off for the specified session or if no session is specified for all sessions. Default is off
  • tracedirectory <tracedirectory> [-h <host>] [-p <portnumber>]: This changes where new trace files will be placed. For sessions with tracing already turned on, trace files remain in the previous location. Default is derby.system.home, if it is set. Otherwise the default is the current directory.

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:

  • derby.drda.portNumber=<port number>: This property indicates which port should be used for the Network Server.
  • derby.drda.host=<host name or ip address >: This property indicates the ip address to which NetworkServerControl should connect
  • derby.drda.traceDirectory=<trace directory>: This property indicates where to put trace files.
  • derby.drda.traceAll=true: This property turns on tracing for all sessions. Default is tracing is off.
  • derby.drda.logConnections=true: This property turns on logging of connections. Default is connections are not logged.
  • derby.drda.minThreads=<value>: If this property is set, the <value> number of threads will be created when the Network Server is booted.
  • derby.drda.maxThreads=<value>: If this property is set, the <value> is the maximum number of connection threads that will be created. If a session starts when there are no connection threads available and the maximum number of threads has been reached, it will wait until a conection thread becomes available.
  • derby.drda.timeSlice=<milliseconds>: If this property is set, the connection threads will not check for waiting sessions until the current session has been working for <milliseconds>. A value of 0 causes the thread to work on the current session until the session exits. If this property is not set, the default value is 0.
  • 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();
     


Field Summary
final public static  intDEFAULT_PORTNUMBER
    

Constructor Summary
public  NetworkServerControl(InetAddress address, int portNumber)
     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);
 

Parameters:
  address - The IP address of the Network Server host.address cannot be null.
Parameters:
  portNumber - port number server is to used.
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.

Method Summary
public  PropertiesgetCurrentProperties()
    
public  intgetMaxThreads()
    
public  StringgetRuntimeInfo()
     Return detailed session runtime information about sessions, prepared statements, and memory usage for the running Network Server.
public  StringgetSysinfo()
     Return classpath and version information about the running Network Server.
public  intgetTimeSlice()
    
public  voidlogConnections(boolean on)
     Turn logging connections on or off.
public static  voidmain(String args)
    
public  voidping()
    
protected  voidsetClientLocale(String locale)
     set the client locale.
public  voidsetMaxThreads(int max)
     Set Network Server maxthread parameter.
public  voidsetTimeSlice(int timeslice)
     Set Network Server connection time slice parameter.
public  voidsetTraceDirectory(String traceDirectory)
     Set directory for trace files.
public  voidshutdown()
     Shutdown a Network Server.
public  voidstart(PrintWriter consoleWriter)
     Start a Network Server This method will launch a separate thread and start 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 cloudscape.properties.
Parameters:
  consoleWriter - PrintWriter to which server console will be output.

public  voidtrace(boolean on)
     Turn tracing on or off for the specified connection on the Network Server.
public  voidtrace(int connNum, boolean on)
     Turn tracing on or off for all connections on the Network Server.
Parameters:
  connNum - connection number.

Field Detail
DEFAULT_PORTNUMBER
final public static int DEFAULT_PORTNUMBER(Code)




Constructor Detail
NetworkServerControl
public NetworkServerControl(InetAddress address, int portNumber) throws Exception(Code)
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);
 

Parameters:
  address - The IP address of the Network Server host.address cannot be null.
Parameters:
  portNumber - port number server is to used. If <= 0,default port number is used
throws:
  Exception - on error



NetworkServerControl
public NetworkServerControl() throws Exception(Code)
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);
 

throws:
  Exception - on error




Method Detail
getCurrentProperties
public Properties getCurrentProperties() throws Exception(Code)
Get current Network server properties Properties object containing Network server properties
exception:
  Exception - throws an exception if an error occurs



getMaxThreads
public int getMaxThreads() throws Exception(Code)
Returns the current maxThreads setting for the running Network Server maxThreads setting
exception:
  Exception - throws an exception if an error occurs
See Also:   NetworkServerControl.setMaxThreads



getRuntimeInfo
public String getRuntimeInfo() throws Exception(Code)
Return detailed session runtime information about sessions, prepared statements, and memory usage for the running Network Server. run time information
exception:
  Exception - throws an exception if an error occurs



getSysinfo
public String getSysinfo() throws Exception(Code)
Return classpath and version information about the running Network Server. sysinfo output
exception:
  Exception - throws an exception if an error occurs



getTimeSlice
public int getTimeSlice() throws Exception(Code)
Return the current timeSlice setting for the running Network Server timeSlice setting
exception:
  Exception - throws an exception if an error occurs
See Also:   NetworkServerControl.setTimeSlice



logConnections
public void logConnections(boolean on) throws Exception(Code)
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.
Parameters:
  on - true to turn on, false to turn off
exception:
  Exception - throws an exception if an error occurs



main
public static void main(String args)(Code)
main routine for NetworkServerControl
Parameters:
  args - array of arguments indicating command to be executed.See class comments for more information



ping
public void ping() throws Exception(Code)
Check if Network Server is started Excecutes and returns without error if the server has started
exception:
  Exception - throws an exception if an error occurs



setClientLocale
protected void setClientLocale(String locale)(Code)
set the client locale. Used by servlet for localization
Parameters:
  locale - Locale to use



setMaxThreads
public void setMaxThreads(int max) throws Exception(Code)
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.
Parameters:
  max - maximum number of connection threads.If <= 0, connection threads will be created when there are no free connection threads.
exception:
  Exception - throws an exception if an error occurs
See Also:   NetworkServerControl.setTimeSlice



setTimeSlice
public void setTimeSlice(int timeslice) throws Exception(Code)
Set Network Server connection time slice parameter. This should be set and is only relevant if setMaxThreads > 0.
Parameters:
  timeslice - number of milliseconds given to each session before yielding to another session, if <=0, never yield.
exception:
  Exception - throws an exception if an error occurs
See Also:   NetworkServerControl.setMaxThreads



setTraceDirectory
public void setTraceDirectory(String traceDirectory) throws Exception(Code)
Set directory for trace files. The directory must be on the machine where the server is running.
Parameters:
  traceDirectory - directory for trace files on machine where server is running
exception:
  Exception - throws an exception if an error occurs



shutdown
public void shutdown() throws Exception(Code)
Shutdown a Network Server. Shuts down the Network Server listening on the port and InetAddress specified in the constructor for this NetworkServerControl object.
exception:
  Exception - throws an exception if an error occurs



start
public void start(PrintWriter consoleWriter) throws Exception(Code)
Start a Network Server This method will launch a separate thread and start 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 cloudscape.properties.
Parameters:
  consoleWriter - PrintWriter to which server console will be output. Null will disable console output.
exception:
  Exception - if there is an error starting the server.
See Also:   NetworkServerControl.shutdown




trace
public void trace(boolean on) throws Exception(Code)
Turn tracing on or off for the specified connection on the Network Server.
Parameters:
  on - true to turn tracing on, false to turn tracing off.
exception:
  Exception - throws an exception if an error occurs



trace
public void trace(int connNum, boolean on) throws Exception(Code)
Turn tracing on or off for all connections on the Network Server.
Parameters:
  connNum - connection number. Note: Connection numbers will printin the Derby error log if logConnections is on
Parameters:
  on - true to turn tracing on, false to turn tracing off.
exception:
  Exception - throws an exception if an error occurs



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.