public final class NetworkServerControlImpl
extends java.lang.Object
for description
Modifier and Type | Field and Description |
---|---|
private int |
allowOnlySecurityMechanism |
private java.util.Hashtable<java.lang.String,AppRequester> |
appRequesterTable |
private static java.lang.String |
att_extnam |
private static java.lang.String |
att_srvclsnm |
protected static java.lang.String |
ATT_SRVNAM |
private static java.lang.String |
att_srvrlslv |
private java.lang.String |
bootPasswordArg |
private static java.lang.String |
buildNumber |
private java.io.ByteArrayOutputStream |
byteArrayOs |
protected static int |
CCSIDMBC |
protected static int |
CCSIDSBC |
private boolean |
cleanupOnStart |
private java.io.InputStream |
clientIs |
private java.lang.String |
clientLocale |
private java.io.OutputStream |
clientOs |
private java.net.Socket |
clientSocket |
private static java.lang.String |
CLOUDSCAPE_DRIVER |
private static java.sql.Driver |
cloudscapeDriver |
private java.io.PrintWriter |
cloudscapeLogWriter |
private static int[] |
COMMAND_ARGS |
private static java.lang.String |
COMMAND_HEADER |
static int |
COMMAND_LOGCONNECTIONS |
static int |
COMMAND_MAXTHREADS |
static int |
COMMAND_PROPERTIES |
static int |
COMMAND_RUNTIME_INFO |
static int |
COMMAND_SHUTDOWN |
static int |
COMMAND_START |
static int |
COMMAND_SYSINFO |
static int |
COMMAND_TESTCONNECTION |
static int |
COMMAND_TIMESLICE |
static int |
COMMAND_TRACE |
static int |
COMMAND_TRACEDIRECTORY |
static int |
COMMAND_UNKNOWN |
private java.util.Vector<java.lang.String> |
commandArgs |
private java.io.DataOutputStream |
commandOs |
private static java.lang.String[] |
COMMANDS |
private int |
connNum |
private Session |
currentSession |
static int |
DASHARG_BOOTPASSWORD |
static int |
DASHARG_DATABASE |
static int |
DASHARG_ENCALG |
static int |
DASHARG_ENCPRV |
static int |
DASHARG_HOST |
static int |
DASHARG_LOADSYSIBM |
static int |
DASHARG_PASSWORD |
static int |
DASHARG_PORT |
static int |
DASHARG_SESSION |
private static int |
DASHARG_SSL |
static int |
DASHARG_UNSECURE |
static int |
DASHARG_USER |
private static java.lang.String[] |
DASHARGS |
private java.lang.String |
databaseArg |
private boolean |
debugOutput |
protected static int |
DEFAULT_CCSID |
(package private) static java.nio.charset.Charset |
DEFAULT_CHARSET |
protected static java.lang.String |
DEFAULT_ENCODING |
private static java.lang.String |
DEFAULT_HOST |
private static java.lang.String |
DEFAULT_LOCALE |
private static java.lang.String |
DEFAULT_LOCALE_COUNTRY |
private static int |
DEFAULT_MAXTHREADS |
private static int |
DEFAULT_PROTOCOL_VERSION |
private static int |
DEFAULT_TIMESLICE |
private static java.lang.String |
DRDA_MSG_PREFIX |
private static java.lang.String |
DRDA_PROP_DEBUG |
private static java.lang.String |
DRDA_PROP_MESSAGES |
private java.lang.String |
encAlgArg |
private java.lang.String |
encPrvArg |
private static int |
ERROR |
private static int |
ERRTYPE_INFO |
private static int |
ERRTYPE_SEVERE |
private static int |
ERRTYPE_UNKNOWN |
private static int |
ERRTYPE_USER |
private int |
freeThreads |
private java.net.InetAddress |
hostAddress |
private java.lang.String |
hostArg |
protected static int |
INVALID_OR_NOTSET_SECURITYMECHANISM |
private boolean |
keepAlive |
private LocalizedResource |
langUtil |
(package private) java.util.ArrayList<java.net.InetAddress> |
localAddresses
List of local addresses for checking admin commands.
|
private boolean |
logConnections |
private java.lang.Object |
logConnectionsSync |
private java.io.PrintWriter |
logWriter |
private static int |
MAX_ALLOWED_PROTOCOL_VERSION |
private int |
maxPoolSize |
private static int |
MAXREPLY
Maximum reply size.
|
private int |
maxThreads |
private memCheck |
mc |
private static int[] |
MGR_LEVELS |
private static int |
MIN_MAXTHREADS |
private static int |
MIN_TIMESLICE |
private int |
minPoolSize |
private int |
minThreads |
private static java.util.concurrent.atomic.AtomicInteger |
nextThreadNumber
Holds the sequence number to be assigned to the next thread that
calls
getUniqueThreadName(String) . |
private static int |
NO_USAGE_MSGS |
private static int |
OK |
private java.lang.String |
passwordArg |
private java.lang.Object |
poolSync |
private int |
portNumber |
private static java.lang.String |
prdId |
private static byte[] |
prdIdBytes_ |
private java.lang.String |
propertyFileName |
private static java.lang.String |
REPLY_HEADER |
private static int |
REPLY_HEADER_LENGTH |
private byte[] |
replyBuffer |
private int |
replyBufferCount |
private int |
replyBufferPos |
private boolean |
restartFlag |
private java.util.Vector<Session> |
runQueue |
private NetworkServerControlImpl |
serverInstance |
private java.net.ServerSocket |
serverSocket |
private java.lang.Object |
serverStartSync |
private int |
sessionArg |
private java.util.Hashtable<java.lang.Integer,Session> |
sessionTable |
private boolean |
shutdown |
private static int |
SHUTDOWN_CHECK_ATTEMPTS |
private static int |
SHUTDOWN_CHECK_INTERVAL |
private static int |
SHUTDOWN_WITH_CREDENTIAL_PROTOCOL_VERSION |
private boolean |
shutdownDatabasesOnShutdown |
private java.lang.Object |
shutdownSync |
protected static byte |
SPACE_CHAR |
private static int |
SQLERROR |
private static int |
SQLWARNING |
private static int |
SSL_BASIC |
private static int |
SSL_OFF |
private static int |
SSL_PEER_AUTHENTICATION |
private int |
sslMode |
private static boolean |
SUPPORTS_EUSRIDPWD
Can EUSRIDPWD security mechanism be used with
the current JVM
|
private NetworkServerControlImpl |
thisControl |
private java.util.Vector<DRDAConnThread> |
threadList |
private java.lang.Object |
threadsSync |
private int |
timeSlice |
private java.lang.Object |
timeSliceSync |
private boolean |
traceAll |
private java.lang.Object |
traceAllSync |
private java.lang.String |
traceDirectory |
private java.lang.Object |
traceDirectorySync |
static java.lang.String |
UNEXPECTED_ERR |
private boolean |
unsecureArg |
private static int |
USE_DEFAULT |
private java.lang.String |
userArg |
private static java.lang.String |
versionString |
private static int |
WARNING |
Constructor and Description |
---|
NetworkServerControlImpl() |
NetworkServerControlImpl(java.net.InetAddress address,
int portNumber)
Internal constructor for NetworkServerControl API.
|
NetworkServerControlImpl(java.net.InetAddress address,
int portNumber,
java.lang.String userName,
java.lang.String password)
Internal constructor for NetworkServerControl API.
|
NetworkServerControlImpl(java.lang.String userName,
java.lang.String password)
Internal constructor for NetworkServerControl API.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
addSession(java.net.Socket clientSocket)
Add a session - for use by
ClientThread . |
static java.lang.String |
att_extnam()
Return the att_extnam server attribute
|
static java.lang.String |
att_srvclsnm()
Return the att_srvclsnm server attribute
|
static java.lang.String |
att_srvrlslv()
Return the att_srvrlslv server attribute
|
void |
blockingStart(java.io.PrintWriter consoleWriter)
Start a network server
|
private void |
buildLocalAddressList(java.net.InetAddress bindAddr)
Build local address list to allow admin commands.
|
java.lang.String |
buildRuntimeInfo(LocalizedResource locallangUtil) |
private void |
checkAddressIsLocal(java.net.InetAddress inetAddr) |
void |
checkShutdownPrivileges() |
private void |
clientSocketError(java.io.IOException e)
Stream error writing to client socket
|
private void |
closeSocket()
Close the resources associated with the opened socket.
|
private void |
connectToDatabase(DDMWriter writer,
java.lang.String database,
java.lang.String user,
java.lang.String password)
Connect to a database to test whether a connection can be made
|
void |
consoleError(java.lang.String msg)
Write an error message to console output stream
and throw an exception for this error
|
void |
consoleExceptionPrint(java.lang.Exception e)
Write an exception to console output stream,
but only if debugOutput is true.
|
void |
consoleExceptionPrintTrace(java.lang.Throwable e)
Write an exception (with trace) to console
output stream.
|
void |
consoleMessage(java.lang.String msg,
boolean printTimeStamp)
Write a message to console output stream
|
private void |
consolePrintAndIgnore(java.lang.String msgProp,
java.lang.Exception e,
boolean printTimeStamp) |
protected void |
consolePropertyMessage(java.lang.String msgProp,
boolean printTimeStamp)
Put property message on console
|
protected void |
consolePropertyMessage(java.lang.String msgProp,
java.lang.String arg)
Put property message on console
|
protected void |
consolePropertyMessage(java.lang.String msgProp,
java.lang.String[] args)
Put property message on console
|
private void |
consolePropertyMessageWork(java.lang.String messageKey,
java.lang.String[] args,
boolean printTimeStamp)
Handle console error message
- display on console and if it is a user error, display usage
- if user error or severe error, throw exception with message key and message
|
private void |
consoleTraceMessage(int connNum,
boolean on)
Print trace change message to console
|
private java.net.ServerSocket |
createServerSocket()
Create the right kind of server socket
|
boolean |
debugOutput()
Return the debug state
|
void |
directShutdown() |
(package private) void |
directShutdownInternal() |
private void |
ensureDataInBuffer(int minimumBytesNeeded,
boolean failOnEOS)
Ensure the reply buffer is large enough to hold all the data;
don't just rely on OS level defaults
|
void |
executeWork(int command)
Execute the command given on the command line
|
private void |
fillReplyBuffer()
Fill the reply buffer with the reply allocates a reply buffer if one doesn't
exist
|
private int |
findCommand(java.lang.String[] args)
Go through the arguments and find the command and save the dash arguments
and arguments to the command.
|
private static java.lang.Object |
findService(java.lang.String factoryInterface,
java.lang.String serviceName)
Privileged service lookup.
|
(package private) int |
getActiveSessions() |
protected AppRequester |
getAppRequester(AppRequester appRequester)
Get the stored application requester or store if we haven't seen it yet
|
(package private) long |
getBytesRead() |
(package private) long |
getBytesWritten() |
private java.lang.String |
getCLSSysInfo()
Get Derby information
|
(package private) int |
getConnectionNumber() |
java.util.Properties |
getCurrentProperties()
Get current properties
|
protected static java.sql.Driver |
getDriver() |
private java.lang.String |
getEnabledProtocols(javax.net.ssl.SSLServerSocket sslServerSocket) |
java.lang.String |
getHost()
Get the host where we listen for connections.
|
private int |
getIntPropVal(java.lang.String propName,
java.lang.String propVal)
Get integer property values
|
protected boolean |
getKeepAlive()
Get the current value of keepAlive to configure how long the server
should keep the socket alive for a disconnected client
|
boolean |
getLogConnections()
Get the current value of logging connections
|
protected int |
getManagerLevel(int manager)
Get the server manager level for a given manager
|
private int |
getMaxThreads()
Get the current value of maximum number of threads to create
|
private int |
getMessageType(java.lang.String msg)
Determine type of message
|
private int |
getMinThreads()
Get the current value of minimum number of threads to create at start
|
private ProductVersionHolder |
getNetProductVersionHolder()
Retrieve product version information
We need to make sure that this method gets the stream and passes it to
ProductVersionHolder, because it lives in the Network Server jar
and won't be readily available to ProductVersionHolder when running
under security manager.
|
private java.lang.String |
getNetSysInfo()
Get Net Server information
|
protected Session |
getNextSession(Session currentSession)
Get the next session for the thread to work on
Called from DRDAConnThread after session completes or timeslice
exceeded.
|
int |
getPort()
Get the port where we listen for connections.
|
private void |
getPropertyInfo()
Initialize fields from system properties
|
(package private) java.util.Properties |
getPropertyValues()
Constructs an object containing network server related properties
and their values.
|
(package private) int |
getRunQueueSize() |
private java.lang.String |
getRuntimeInfo() |
private int |
getSecMecValue(java.lang.String s)
Retrieve the SECMEC integer value from the
user friendly security mechanism name
|
protected int |
getSecurityMechanism()
get the security mechanism (secmec value) that the server
will accept connections from.
|
protected boolean |
getShutdown() |
protected java.lang.Object |
getShutdownSync() |
protected int |
getSSLMode() |
private java.lang.String |
getSSLModeString(int i)
Get the string value of the SSL-mode.
|
private int |
getSSLModeValue(java.lang.String s)
Get the SSL-mode from a string.
|
private java.lang.String |
getStringValueForSecMec(int secmecVal)
Retrieve the string name for the integer
secmec value
|
private static java.lang.Object |
getSystemModule(java.lang.String factoryInterface)
Privileged module lookup.
|
(package private) int |
getThreadListSize() |
protected int |
getTimeSlice()
Get the current value of the time slice
|
protected boolean |
getTraceAll()
Get the current value of whether to trace all the sessions
|
protected java.lang.String |
getTraceDirectory()
Get the current value of trace directory
|
(package private) static java.lang.String |
getUniqueThreadName(java.lang.String base)
Get a thread name that is both meaningful and unique (primarily for
debugging purposes).
|
private void |
init() |
protected static boolean |
isCmd(java.lang.String val)
Is this the command protocol
|
private boolean |
isMsgProperty(java.lang.String msg)
Determine whether string is a property key or not
property keys start with DRDA_MSG_PREFIX
|
private boolean |
isOn(java.lang.String arg)
Is string "on" or "off"
|
boolean |
isServerStarted() |
private java.lang.String |
localizeMessage(java.lang.String msgProp,
LocalizedResource localLangUtil,
java.lang.String[] args)
Localize a message given a particular AppUI
|
java.lang.String |
localizeMessage(java.lang.String msgProp,
java.lang.String[] args)
Convenience routine so that NetworkServerControl can localize messages.
|
void |
logConnections(boolean on)
Turn logging connections on or off.
|
private void |
logConnectionsChange(boolean on)
Record a change to the connection logging mode
|
java.io.PrintWriter |
logWriter()
Get the log writer we're using
|
private java.io.PrintWriter |
makePrintWriter(java.io.OutputStream out) |
void |
netSetMaxThreads(int max)
Connect to network server and set connection maxthread parameter
|
void |
netSetTimeSlice(int timeslice)
Set network server connection timeslice parameter
|
int |
parseArgs(java.lang.String[] args)
Parse the command-line arguments.
|
void |
ping()
Ping opening an new socket and close it.
|
private void |
pingWithNoOpen()
Ping the server using the client socket that is already open.
|
static java.lang.String |
prdId()
Return the product id
|
static byte[] |
prdIdBytes()
Return the bytes of the product id
|
protected void |
processCommands(DDMReader reader,
DDMWriter writer,
Session session)
processCommands reads and processes NetworkServerControlImpl commands sent
to the network server over the socket.
|
private int |
processDashArg(int pos,
java.lang.String[] args)
Get the dash argument.
|
private byte[] |
readBytesReply(java.lang.String msgKey)
Read Bytes reply
|
private void |
readCommandReplyHeader()
Read the command reply header from the server
|
private int |
readInt()
Read int from buffer
|
private byte[] |
readLDBytes()
Read length delimited bytes from a buffer
|
private java.lang.String |
readLDString()
Read length delimited string from a buffer
|
private void |
readResult()
Read result from sending client message to server
|
private int |
readShort()
Read short from buffer
|
private java.lang.String |
readStringReply(java.lang.String msgKey)
Read String reply
|
protected void |
removeFromSessionTable(int sessionid)
Remove session from session table
|
private java.lang.String[] |
removeSSLv3andSSLv2Hello(java.lang.String[] enabledProtocols) |
(package private) void |
removeThread(DRDAConnThread thread)
Remove a thread from the thread list.
|
boolean |
runningUnsecure()
Return true if the customer forcibly overrode our decision to install a
default SecurityManager.
|
private void |
runQueueAdd(Session clientSession)
Add session to the run queue
|
java.lang.String |
runtimeInfo() |
private void |
send()
Send client message to server
|
private void |
sendMessage(DDMWriter writer,
int messageType,
java.lang.String message)
Send Error or Warning from server to client after processing a command
|
private void |
sendOK(DDMWriter writer)
Send OK from server to client after processing a command
|
private void |
sendOKInt(DDMWriter writer,
int val)
Send OK and int value
|
private void |
sendPropInfo(DDMWriter writer)
Send property information from server to client
|
private void |
sendRuntimeInfo(DDMWriter writer)
Send RuntimeInfo information from server to client
|
void |
sendSetTraceDirectory(java.lang.String traceDirectory) |
private void |
sendSQLMessage(DDMWriter writer,
java.sql.SQLException se,
int type)
Send SQL Exception from server to client after processing a command
|
private void |
sendSysInfo(DDMWriter writer)
Send SysInfo information from server to client
|
void |
setClientLocale(java.lang.String locale) |
private void |
setLogConnections(boolean value)
Set the current value of logging connections
|
void |
setLogWriter(java.io.PrintWriter outWriter)
Set the output stream for console messages
If this is set to null, no messages will be written to the console
|
private void |
setMaxThreads(int value)
Set the current value of maximum number of threads to create
|
private void |
setMinThreads(int value)
Set the current value of minimum number of threads to create at start
|
private void |
setSecurityMechanism(java.lang.String s)
Set the security mechanism for derby.drda.securityMechanism
If this property is set, server will only allow connections
from client with this security mechanism.
|
protected void |
setSSLMode(int mode) |
private void |
setTimeSlice(int value)
Set the current value of time slice
|
private boolean |
setTrace(boolean on)
Set the trace on/off for all sessions, or one session, depending on
whether we got -s argument.
|
private void |
setTraceAll(boolean value)
Set the current value of whether to trace all the sessions
|
private void |
setTraceDirectory(java.lang.String value)
Set the current value of trace directory
|
private void |
setUpSocket()
Set up client socket to send a command to the network server
|
void |
shutdown()
Shutdown a network server
|
void |
start(java.io.PrintWriter consoleWriter)
Start a network server.
|
protected void |
startNetworkServer()
Load Derby and save driver for future use.
|
protected boolean |
supportsCCSID(int ccsid)
Check whether a CCSID code page is supported
|
(package private) boolean |
supportsEUSRIDPWD()
This method returns whether EUSRIDPWD security mechanism
is supported or not.
|
java.lang.String |
sysinfo() |
private void |
throwSQLException(java.lang.String msg)
Throw a SQL Exception which was sent over by a server
Format of the msg is SQLSTATE:localized message\nSQLSTATE:next localized message
|
private void |
throwSQLWarning(java.lang.String msg)
Throw a SQL Warning which was sent over by a server
Format of the msg is SQLSTATE:localized message\nSQLSTATE:next localized message
|
private void |
throwUnexpectedException(java.lang.Exception e)
Print a trace for the (unexpected) exception received, then
throw a generic exception indicating that 1) an unexpected
exception was thrown, and 2) we've already printed the trace
(so don't do it again).
|
void |
trace(boolean on)
Turn tracing on or off for all sessions
|
void |
trace(int connNum,
boolean on)
Turn tracing on or off for one session or all sessions
|
private void |
unknownHostException(java.lang.Throwable t) |
void |
usage()
Display usage information
|
private void |
wrapSQLError(java.lang.String messageKey)
Wrap SQL Error - display to console and raise exception
|
private void |
wrapSQLWarning(java.lang.String messageKey)
Wrap SQL Warning - display to console and raise exception
|
private void |
writeByte(int value)
Write byte
|
private void |
writeCommandHeader(int command)
Write command header consisting of command header string and default
protocol version and command.
|
private void |
writeCommandHeader(int command,
int protocol_version_for_command)
Write command header consisting of command header string and passed
protocol version and command.
|
private void |
writeCommandReplyHeader(DDMWriter writer)
Write Command reply
|
private void |
writeLDString(java.lang.String msg)
Write length delimited string string
|
private void |
writeShort(int value)
Write short
|
protected void |
writeString(java.lang.String msg)
Write string
|
private static final int NO_USAGE_MSGS
private static final java.lang.String[] COMMANDS
private static final int[] COMMAND_ARGS
public static final int COMMAND_START
public static final int COMMAND_SHUTDOWN
public static final int COMMAND_TRACE
public static final int COMMAND_TRACEDIRECTORY
public static final int COMMAND_TESTCONNECTION
public static final int COMMAND_LOGCONNECTIONS
public static final int COMMAND_SYSINFO
public static final int COMMAND_RUNTIME_INFO
public static final int COMMAND_MAXTHREADS
public static final int COMMAND_TIMESLICE
public static final int COMMAND_PROPERTIES
public static final int COMMAND_UNKNOWN
private static final java.lang.String[] DASHARGS
public static final int DASHARG_PORT
public static final int DASHARG_DATABASE
public static final int DASHARG_USER
public static final int DASHARG_PASSWORD
public static final int DASHARG_LOADSYSIBM
public static final int DASHARG_ENCALG
public static final int DASHARG_ENCPRV
public static final int DASHARG_BOOTPASSWORD
public static final int DASHARG_HOST
public static final int DASHARG_SESSION
public static final int DASHARG_UNSECURE
private static final int DASHARG_SSL
private static final int DEFAULT_PROTOCOL_VERSION
private static final int SHUTDOWN_WITH_CREDENTIAL_PROTOCOL_VERSION
private static final int MAX_ALLOWED_PROTOCOL_VERSION
private static final java.lang.String COMMAND_HEADER
private static final java.lang.String REPLY_HEADER
private static final int REPLY_HEADER_LENGTH
private static final int OK
private static final int WARNING
private static final int ERROR
private static final int SQLERROR
private static final int SQLWARNING
private static final java.lang.String DRDA_PROP_MESSAGES
private static final java.lang.String DRDA_PROP_DEBUG
private static final java.lang.String CLOUDSCAPE_DRIVER
public static final java.lang.String UNEXPECTED_ERR
private static final int MIN_MAXTHREADS
private static final int MIN_TIMESLICE
private static final int USE_DEFAULT
private static final int DEFAULT_MAXTHREADS
private static final int DEFAULT_TIMESLICE
private static final java.lang.String DEFAULT_HOST
private static final java.lang.String DRDA_MSG_PREFIX
private static final java.lang.String DEFAULT_LOCALE
private static final java.lang.String DEFAULT_LOCALE_COUNTRY
private static final int SHUTDOWN_CHECK_ATTEMPTS
private static final int SHUTDOWN_CHECK_INTERVAL
private static final int MAXREPLY
readBytesReply(String)
and
readStringReply(String)
can receive. That is, a reply header
(4 bytes), a status byte (1 byte), a length field (2 bytes) and the
longest value (in bytes) that could be written by
DDMWriter.writeLDBytes(byte[])
or
DDMWriter.writeLDString(String)
.private static java.lang.String att_srvclsnm
protected static final java.lang.String ATT_SRVNAM
private static java.lang.String att_extnam
private static java.lang.String att_srvrlslv
private static java.lang.String prdId
private static byte[] prdIdBytes_
private static java.lang.String buildNumber
private static java.lang.String versionString
protected static final int CCSIDSBC
protected static final int CCSIDMBC
protected static final java.lang.String DEFAULT_ENCODING
static final java.nio.charset.Charset DEFAULT_CHARSET
protected static final int DEFAULT_CCSID
protected static final byte SPACE_CHAR
private static final int[] MGR_LEVELS
private java.io.PrintWriter logWriter
private java.io.PrintWriter cloudscapeLogWriter
private static java.sql.Driver cloudscapeDriver
private static final int ERRTYPE_SEVERE
private static final int ERRTYPE_USER
private static final int ERRTYPE_INFO
private static final int ERRTYPE_UNKNOWN
private java.util.Vector<java.lang.String> commandArgs
private java.lang.String databaseArg
private java.lang.String userArg
private java.lang.String passwordArg
private java.lang.String bootPasswordArg
private java.lang.String encAlgArg
private java.lang.String encPrvArg
private java.lang.String hostArg
private java.net.InetAddress hostAddress
private int sessionArg
private boolean unsecureArg
private memCheck mc
private byte[] replyBuffer
private int replyBufferCount
private int replyBufferPos
private int portNumber
private java.lang.String traceDirectory
private java.lang.Object traceDirectorySync
private boolean traceAll
private java.lang.Object traceAllSync
private java.lang.Object serverStartSync
private boolean logConnections
private java.lang.Object logConnectionsSync
private int minThreads
private int maxThreads
private java.lang.Object threadsSync
private int timeSlice
private java.lang.Object timeSliceSync
private boolean keepAlive
private int minPoolSize
private int maxPoolSize
private java.lang.Object poolSync
private boolean debugOutput
private boolean cleanupOnStart
private boolean restartFlag
protected static final int INVALID_OR_NOTSET_SECURITYMECHANISM
private int allowOnlySecurityMechanism
private java.net.Socket clientSocket
private java.io.InputStream clientIs
private java.io.OutputStream clientOs
private java.io.ByteArrayOutputStream byteArrayOs
private java.io.DataOutputStream commandOs
private java.lang.Object shutdownSync
private boolean shutdown
private int connNum
private java.net.ServerSocket serverSocket
private NetworkServerControlImpl serverInstance
private LocalizedResource langUtil
private java.lang.String clientLocale
java.util.ArrayList<java.net.InetAddress> localAddresses
private java.util.Hashtable<java.lang.Integer,Session> sessionTable
private Session currentSession
private java.util.Vector<DRDAConnThread> threadList
private java.util.Vector<Session> runQueue
private int freeThreads
private java.util.Hashtable<java.lang.String,AppRequester> appRequesterTable
private java.lang.String propertyFileName
private NetworkServerControlImpl thisControl
private boolean shutdownDatabasesOnShutdown
private static final int SSL_OFF
private static final int SSL_BASIC
private static final int SSL_PEER_AUTHENTICATION
private int sslMode
private static boolean SUPPORTS_EUSRIDPWD
private static final java.util.concurrent.atomic.AtomicInteger nextThreadNumber
getUniqueThreadName(String)
.public NetworkServerControlImpl() throws java.lang.Exception
java.lang.Exception
public NetworkServerControlImpl(java.net.InetAddress address, int portNumber) throws java.lang.Exception
address
- InetAddress to listen on, throws NPE if nullportNumber
- portNumber to listen on, -1 use property or defaultjava.lang.Exception
- on errorNetworkServerControl
public NetworkServerControlImpl(java.lang.String userName, java.lang.String password) throws java.lang.Exception
userName
- the user name for actions requiring authorizationpassword
- the password for actions requiring authorizationjava.lang.Exception
- on errorNetworkServerControl
public NetworkServerControlImpl(java.net.InetAddress address, int portNumber, java.lang.String userName, java.lang.String password) throws java.lang.Exception
address
- InetAddress to listen on, throws NPE if nullportNumber
- portNumber to listen on, -1 use property or defaultuserName
- the user name for actions requiring authorizationpassword
- the password for actions requiring authorizationjava.lang.Exception
- on errorNetworkServerControl
public java.io.PrintWriter logWriter()
public java.lang.String getHost()
public int getPort()
public boolean runningUnsecure()
private void init() throws java.lang.Exception
java.lang.Exception
private java.io.PrintWriter makePrintWriter(java.io.OutputStream out)
protected static java.sql.Driver getDriver()
public void setLogWriter(java.io.PrintWriter outWriter)
outWriter
- output stream for console messagespublic void consoleError(java.lang.String msg) throws java.lang.Exception
msg
- error messagejava.lang.Exception
public boolean debugOutput()
public static java.lang.String att_extnam()
public static java.lang.String att_srvclsnm()
public static java.lang.String att_srvrlslv()
public static java.lang.String prdId()
public static byte[] prdIdBytes()
public void consoleExceptionPrint(java.lang.Exception e)
e
- exceptionpublic void consoleExceptionPrintTrace(java.lang.Throwable e)
e
- exceptionpublic void consoleMessage(java.lang.String msg, boolean printTimeStamp)
msg
- messageprintTimeStamp
- Whether to prepend a timestamp to the message or notpublic void start(java.io.PrintWriter consoleWriter) throws java.lang.Exception
consoleWriter
- PrintWriter to which server console will be
output. Null will disable console output.java.lang.Exception
- throws an exception if an error occursprivate java.net.ServerSocket createServerSocket() throws java.io.IOException
java.io.IOException
private java.lang.String getEnabledProtocols(javax.net.ssl.SSLServerSocket sslServerSocket)
public void blockingStart(java.io.PrintWriter consoleWriter) throws java.lang.Exception
consoleWriter
- PrintWriter to which server console will be
output. Null will disable console output.java.lang.Exception
- throws an exception if an error occursprivate void consolePrintAndIgnore(java.lang.String msgProp, java.lang.Exception e, boolean printTimeStamp)
protected void startNetworkServer() throws java.lang.Exception
java.lang.Exception
public void shutdown() throws java.lang.Exception
java.lang.Exception
- throws an exception if an error occurspublic void checkShutdownPrivileges() throws java.sql.SQLException
java.sql.SQLException
- if authentication or privileges check failspublic void directShutdown() throws java.sql.SQLException
java.sql.SQLException
void directShutdownInternal()
public boolean isServerStarted() throws java.lang.Exception
java.lang.Exception
public void ping() throws java.lang.Exception
java.lang.Exception
private void pingWithNoOpen() throws java.lang.Exception
java.lang.Exception
public void trace(boolean on) throws java.lang.Exception
on
- true to turn tracing on, false to turn tracing offjava.lang.Exception
- throws an exception if an error occurspublic void trace(int connNum, boolean on) throws java.lang.Exception
connNum
- the connNum of the session, 0 if all sessionson
- true to turn tracing on, false to turn tracing offjava.lang.Exception
- throws an exception if an error occursprivate void consoleTraceMessage(int connNum, boolean on) throws java.lang.Exception
on
- true to print tracing on, false to print tracing offjava.lang.Exception
- throws an exception if an error occurspublic void logConnections(boolean on) throws java.lang.Exception
on
- true to turn on, false to turn offjava.lang.Exception
- throws an exception if an error occurspublic void sendSetTraceDirectory(java.lang.String traceDirectory) throws java.lang.Exception
java.lang.Exception
NetworkServerControl.setTraceDirectory(java.lang.String)
public java.lang.String sysinfo() throws java.lang.Exception
java.lang.Exception
NetworkServerControl.getSysinfo()
public java.lang.String runtimeInfo() throws java.lang.Exception
java.lang.Exception
NetworkServerControl.getRuntimeInfo()
public void usage()
public void netSetMaxThreads(int max) throws java.lang.Exception
max
- maximum number of connections, if 0, connections
created when no free connection available
if -1, use defaultjava.lang.Exception
- throws an exception if an error occurspublic void netSetTimeSlice(int timeslice) throws java.lang.Exception
timeslice
- amount of time given to each session before yielding to
another session, if 0, never yield. if -1, use default.java.lang.Exception
- throws an exception if an error occurspublic java.util.Properties getCurrentProperties() throws java.lang.Exception
java.lang.Exception
- throws an exception if an error occursstatic java.lang.String getUniqueThreadName(java.lang.String base)
base
- the first part of the thread name (the meaningful part)base
and is
followed by an underscore and a unique sequence numberprotected void removeFromSessionTable(int sessionid)
sessionid
- id of session to be removedprotected void processCommands(DDMReader reader, DDMWriter writer, Session session) throws java.lang.Throwable
reader
- input reader for commandwriter
- output writer for commandsession
- session informationjava.lang.Throwable
- throws an exception if an error occursprivate void logConnectionsChange(boolean on) throws java.lang.Exception
java.lang.Exception
protected Session getNextSession(Session currentSession)
currentSession
- session thread is currently working onprotected AppRequester getAppRequester(AppRequester appRequester)
appRequester
- Application Requester to look forprotected int getManagerLevel(int manager)
manager
- codepoint for managerprotected boolean supportsCCSID(int ccsid)
ccsid
- CCSID to checkprotected void consolePropertyMessage(java.lang.String msgProp, boolean printTimeStamp) throws java.lang.Exception
msgProp
- message property keyprintTimeStamp
- whether to prepend a timestamp to the messagejava.lang.Exception
- if an error occursprotected void consolePropertyMessage(java.lang.String msgProp, java.lang.String arg) throws java.lang.Exception
msgProp
- message property keyarg
- argument for messagejava.lang.Exception
- if an error occursprotected void consolePropertyMessage(java.lang.String msgProp, java.lang.String[] args) throws java.lang.Exception
msgProp
- message property keyargs
- argument array for messagejava.lang.Exception
- if an error occursprotected static boolean isCmd(java.lang.String val)
val
- private void writeCommandReplyHeader(DDMWriter writer) throws java.lang.Exception
writer
- writer to usejava.lang.Exception
- if a problem occurs sending OKprivate void sendOK(DDMWriter writer) throws java.lang.Exception
writer
- writer to use for sending OKjava.lang.Exception
- if a problem occurs sending OKprivate void sendOKInt(DDMWriter writer, int val) throws java.lang.Exception
writer
- writer to use for sendingval
- int val to sendjava.lang.Exception
- if a problem occursprivate void sendMessage(DDMWriter writer, int messageType, java.lang.String message) throws java.lang.Exception
writer
- writer to use for sending messagemessageType
- 1 for Warning, 2 for Error 3 for SQLErrormessage
- messagejava.lang.Exception
- if a problem occurs sending messageprivate void sendSQLMessage(DDMWriter writer, java.sql.SQLException se, int type) throws java.lang.Exception
writer
- writer to use for sending messagese
- Derby exceptiontype
- type of exception, SQLERROR or SQLWARNINGjava.lang.Exception
- if a problem occurs sending messageprivate void sendSysInfo(DDMWriter writer) throws java.lang.Exception
writer
- writer to use for sending sysinfojava.lang.Exception
- if a problem occurs sending valueprivate void sendRuntimeInfo(DDMWriter writer) throws java.lang.Exception
writer
- writer to use for sending sysinfojava.lang.Exception
- if a problem occurs sending valueprivate void sendPropInfo(DDMWriter writer) throws java.lang.Exception
writer
- writer to use for sending sysinfojava.lang.Exception
- if a problem occurs sending valueprivate java.lang.String getNetSysInfo()
private java.lang.String getRuntimeInfo()
NetworkServerControl.getRuntimeInfo()
private java.lang.String getCLSSysInfo() throws java.io.IOException
java.io.IOException
- if a problem occurs encoding stringpublic int parseArgs(java.lang.String[] args) throws java.lang.Exception
args
- array of arguments indicating command to be executedjava.lang.Exception
public void executeWork(int command) throws java.lang.Exception
command
- The command to execute. The command itself was determined by an earlier call to parseArgs().java.lang.Exception
- throws an exception if an error occurs
see class comments for more informationprivate void runQueueAdd(Session clientSession)
clientSession
- session needing workprivate int findCommand(java.lang.String[] args) throws java.lang.Exception
args
- arguments to searchjava.lang.Exception
private int processDashArg(int pos, java.lang.String[] args) throws java.lang.Exception
pos
- starting pointargs
- arguments to searchjava.lang.Exception
- thrown if an error occursprivate boolean isOn(java.lang.String arg) throws java.lang.Exception
arg
- string to checkjava.lang.Exception
- thrown if string is not one of "on" or "off"private void closeSocket() throws java.io.IOException
java.io.IOException
private void setUpSocket() throws java.lang.Exception
java.lang.Exception
- thrown if exception encounteredprivate java.lang.String[] removeSSLv3andSSLv2Hello(java.lang.String[] enabledProtocols)
private void checkAddressIsLocal(java.net.InetAddress inetAddr) throws java.net.UnknownHostException, java.lang.Exception
java.net.UnknownHostException
java.lang.Exception
private void buildLocalAddressList(java.net.InetAddress bindAddr)
bindAddr
- Address on which server was started
Note: Some systems may not support localhost.
In that case a console message will print for the localhost entries,
but the server will continue to start.private void unknownHostException(java.lang.Throwable t)
private void writeCommandHeader(int command) throws java.lang.Exception
command
- command to be writtenjava.lang.Exception
- throws an exception if an error occursprivate void writeCommandHeader(int command, int protocol_version_for_command) throws java.lang.Exception
command
- command to be writtenprotocol_version_for_command
- protocol version to be used
for the given commandjava.lang.Exception
- throws an exception if an error occursprivate void writeLDString(java.lang.String msg) throws java.lang.Exception
msg
- string to be writtenjava.lang.Exception
- throws an exception if an error occursprotected void writeString(java.lang.String msg) throws java.lang.Exception
msg
- String to writejava.lang.Exception
private void writeShort(int value) throws java.lang.Exception
value
- value to be writtenjava.lang.Exception
- throws an exception if an error occursprivate void writeByte(int value) throws java.lang.Exception
value
- value to be writtenjava.lang.Exception
- throws an exception if an error occursprivate void send() throws java.lang.Exception
java.lang.Exception
- throws an exception if an error occursprivate void clientSocketError(java.io.IOException e) throws java.io.IOException
java.io.IOException
private void readResult() throws java.lang.Exception
java.lang.Exception
- throws an exception if an error occursprivate void ensureDataInBuffer(int minimumBytesNeeded, boolean failOnEOS) throws java.lang.Exception
minimumBytesNeeded
- size of buffer requiredfailOnEOS
- tells whether or not an error should be raised if
end-of-stream is reached before the requested amount of bytes could
be readjava.lang.Exception
- throws an exception if a problem reading the replyprivate void fillReplyBuffer() throws java.lang.Exception
java.lang.Exception
- throws an exception if a problem reading the replyprivate void readCommandReplyHeader() throws java.lang.Exception
java.lang.Exception
- throws an exception if an error occursprivate int readShort() throws java.lang.Exception
java.lang.Exception
- throws an exception if an error occursprivate int readInt() throws java.lang.Exception
java.lang.Exception
- throws an exception if an error occursprivate java.lang.String readStringReply(java.lang.String msgKey) throws java.lang.Exception
msgKey
- error message keyjava.lang.Exception
- throws an error if problems reading replyprivate java.lang.String readLDString() throws java.lang.Exception
java.lang.Exception
- throws an error if problems reading replyprivate byte[] readBytesReply(java.lang.String msgKey) throws java.lang.Exception
msgKey
- error message keyjava.lang.Exception
- throws an error if problems reading replyprivate byte[] readLDBytes() throws java.lang.Exception
java.lang.Exception
- throws an error if problems reading replyprivate void getPropertyInfo() throws java.lang.Exception
java.lang.Exception
private int getSecMecValue(java.lang.String s)
s
- security mechanism nameprivate java.lang.String getStringValueForSecMec(int secmecVal)
secmecVal
- secmec valueboolean supportsEUSRIDPWD()
private int getSSLModeValue(java.lang.String s) throws java.lang.Exception
s
- the SSL-mode string ("off"/"false", "on"/"true" or
"authenticate"/"auth"java.lang.Exception
private java.lang.String getSSLModeString(int i)
i
- The SSL-mode value (SSL_OFF, SSL_BASIC or
SSL_PEER_AUTHENTICATION)private int getIntPropVal(java.lang.String propName, java.lang.String propVal) throws java.lang.Exception
propName
- property namepropVal
- string property valuejava.lang.Exception
- if not a valid integerprivate void consolePropertyMessageWork(java.lang.String messageKey, java.lang.String[] args, boolean printTimeStamp) throws java.lang.Exception
messageKey
- message keyargs
- arguments to messageprintTimeStamp
- whether to prepend a timestamp to the messagejava.lang.Exception
- if an error occursprivate void throwSQLException(java.lang.String msg) throws java.sql.SQLException
msg
- msg containing SQL Exceptionjava.sql.SQLException
private void throwSQLWarning(java.lang.String msg) throws java.sql.SQLWarning
msg
- msg containing SQL Warningjava.sql.SQLWarning
private void throwUnexpectedException(java.lang.Exception e) throws java.lang.Exception
e
- An unexpected exception.java.lang.Exception
- with message UNEXPECTED_ERR.public java.lang.String localizeMessage(java.lang.String msgProp, java.lang.String[] args)
msgProp
- message keyargs
- arguments to messageprivate java.lang.String localizeMessage(java.lang.String msgProp, LocalizedResource localLangUtil, java.lang.String[] args)
msgProp
- message keylocalLangUtil
- LocalizedResource to use to localize messageargs
- arguments to messageprivate int getMessageType(java.lang.String msg)
msg
- messageprivate boolean isMsgProperty(java.lang.String msg)
msg
- messagepublic boolean getLogConnections()
private void setLogConnections(boolean value)
value
- true to turn logging connections on; false to turn it offprivate void setSecurityMechanism(java.lang.String s) throws java.lang.Exception
s
- security mechanism string valuejava.lang.Exception
- if value to set is invalidProperty.DRDA_PROP_SECURITYMECHANISM
protected int getSecurityMechanism()
Property.DRDA_PROP_SECURITYMECHANISM
private boolean setTrace(boolean on)
on
- true to turn trace on; false to turn it offprotected int getTimeSlice()
private void setTimeSlice(int value) throws java.lang.Exception
value
- time slice valuejava.lang.Exception
- if value is < 0protected boolean getKeepAlive()
private int getMinThreads()
private void setMinThreads(int value)
value
- value of minimum number of threadsprivate int getMaxThreads()
private void setMaxThreads(int value) throws java.lang.Exception
value
- value of maximum number of threadsjava.lang.Exception
- if value is less than 0protected void setSSLMode(int mode)
protected int getSSLMode()
protected boolean getTraceAll()
private void setTraceAll(boolean value)
value
- true if tracing is on for all sessions; false otherwiseprotected java.lang.String getTraceDirectory()
private void setTraceDirectory(java.lang.String value)
value
- trace directoryprivate void connectToDatabase(DDMWriter writer, java.lang.String database, java.lang.String user, java.lang.String password) throws java.lang.Exception
writer
- connection to send message todatabase
- database directory to connect touser
- user to usepassword
- password to usejava.lang.Exception
private void wrapSQLError(java.lang.String messageKey) throws java.lang.Exception
messageKey
- Derby SQL Exception message idjava.lang.Exception
- raises exception for messageprivate void wrapSQLWarning(java.lang.String messageKey) throws java.lang.Exception
messageKey
- Derby SQL Exception message idjava.lang.Exception
- raises exception for messagejava.util.Properties getPropertyValues()
Constructs an object containing network server related properties and their values. Some properties are only included if set. Some other properties are included with a default value if not set.
This method is accessing the local JVM in which the network server instance is actually running (i.e. no networking).
This method is package private to allow access from relevant MBean implementations in the same package.
void addSession(java.net.Socket clientSocket) throws java.lang.Exception
ClientThread
. Put the session
into the session table and the run queue. Start a new
DRDAConnThread
if there are more sessions waiting than
there are free threads, and the maximum number of threads is not
exceeded.
addSession()
should only be called from one thread at a
time.
clientSocket
- the socket to read from and write tojava.lang.Exception
void removeThread(DRDAConnThread thread)
DRDAConnThread
has been closed.thread
- the closed threadprotected java.lang.Object getShutdownSync()
protected boolean getShutdown()
public java.lang.String buildRuntimeInfo(LocalizedResource locallangUtil)
long getBytesRead()
long getBytesWritten()
int getActiveSessions()
int getRunQueueSize()
int getThreadListSize()
int getConnectionNumber()
public void setClientLocale(java.lang.String locale)
private ProductVersionHolder getNetProductVersionHolder() throws java.lang.Exception
java.lang.Exception
private static java.lang.Object getSystemModule(java.lang.String factoryInterface)
private static java.lang.Object findService(java.lang.String factoryInterface, java.lang.String serviceName)
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.