public class ProxyServer
extends java.lang.Object
If there is already a proxy server active for the specified port, then a new proxy server will not be started. Instead, the existing proxy server's configuration will be updated.
A ProxyServer object can be created and run directly from a program. Alternately, the proxy server can be run as an application, as follows:
java com.ibm.as400.access.ProxyServer [ options ]
Options:
-balanceThreshold
balanceThreshold-bt
. The default is -1. This has no effect unless peer
proxy servers are specified.
-configuration
configurationbalanceThreshold=balanceThreshold jdbcDrivers=jdbcDriver1[;jdbcDriver2[;...]] maxConnections=maxConnections peers=hostname1[:port1][;hostname2[:port2][;...]] verbose=true|falseThis option may be abbreviated
-c
. The default is
to not load a configuration. If a property is loaded in
a configuration and specified in a command line argument,
then the command line argument takes precedence.
-jdbcDrivers
jdbcDriver1[;jdbcDriver2;...]-jd
. The default is to load only the IBM Toolbox
for Java JDBC driver.
-maxConnections
maxConnections-mc
. The default is
to allow an unlimited number of connections.
-peers
hostname1[:port1][;hostname2[:port2];...]-pe
. The default is not to do load balancing.
-port
port-po
. The default port is 3470.
This port is not used if the JVM property javax.net.ssl.keyStore has been set.
-securePort
portThis will be used only if the JVM property javax.net.ssl.keyStore has been set.
This used the SSL support provided by JSSE. To use this support the following JVM properties must be set.
-verbose
[true|false]-v
. The default is not to print status and
connection information.
-help
-h
or -?
. The default is not to print usage
information.
Example usage:
To start the proxy server from a program:
ProxyServer proxyServer = new ProxyServer (); proxyServer.setMaxConnections (25); proxyServer.run ();
Alternatively, the above action can be performed directly from the command line as follows:
java com.ibm.as400.access.ProxyServer -maxconnections 25
Constructor and Description |
---|
ProxyServer()
Constructs a ProxyServer object.
|
Modifier and Type | Method and Description |
---|---|
int |
getActiveConnections()
Returns the number of active connections.
|
int |
getBalanceThreshold()
Returns the balance threshold.
|
java.lang.String |
getConfiguration()
Returns the name of the configuration properties.
|
int |
getMaxConnections()
Returns the maximum number of connections which can be
active at any particular time.
|
java.lang.String[] |
getPeers()
Returns a list of peer proxy servers for use in load balancing.
|
int |
getPort()
Returns the port to use for accepting connections from clients.
|
int |
getSecurePort()
Returns the port to use for accepting Secure Sockets Layer (SSL)
connections from clients.
|
boolean |
isStarted()
Indicates if the proxy server has been started.
|
boolean |
isVerbose()
Indicates whether to print status and connection information
to System.out.
|
static void |
main(java.lang.String[] args)
Runs the proxy server as an application.
|
void |
setBalanceThreshold(int balanceThreshold)
Sets the number of connections that must be active before
the peer server starts load balancing by dispatching requests to
peer proxy servers.
|
void |
setConfiguration(java.lang.String configuration)
Sets and loads the properties file which lists
configuration properties.
|
void |
setMaxConnections(int maxConnections)
Sets the maximum number of connections which can be active
at any particular time.
|
void |
setPeers(java.lang.String[] peers)
Sets the list of peer proxy servers for use in load
balancing.
|
void |
setPort(int port)
Sets the port to use for accepting connections from
clients.
|
void |
setSecurePort(int securePort)
Sets the port to use for accepting Secure Sockets
Layer (SSL) connections from clients.
|
void |
setVerbose(boolean verbose)
Sets whether to print status and connection information
to System.out.
|
void |
start()
Starts the proxy server.
|
void |
stop()
Stops the proxy server.
|
public int getActiveConnections()
public int getBalanceThreshold()
public java.lang.String getConfiguration()
public int getMaxConnections()
public java.lang.String[] getPeers()
public int getPort()
public int getSecurePort()
public boolean isStarted()
public boolean isVerbose()
public static void main(java.lang.String[] args)
args
- The command line arguments.public void setBalanceThreshold(int balanceThreshold)
balanceThreshold
- The number of connections that must be
active before the peer server starts load
balancing by dispatching requests to peer
proxy servers. Specify 0 to start load
balancing immediately or -1 to never start
load balancing.public void setConfiguration(java.lang.String configuration) throws java.io.IOException
configuration
- The properties file which list
configuration properties.java.io.IOException
- If the configuration can not be loaded.public void setMaxConnections(int maxConnections)
Setting this to a number less than the number of active connections will not drop any active connections. It will simply prevent new connections from being accepted until the number of active connections is less than the limit.
maxConnections
- The maximum number of connections
which can be active at any particular
time. Specify 0 to not allow any
connections or -1 for unlimited
connections.public void setPeers(java.lang.String[] peers)
peers
- The list of peer proxy servers for
use in load balancing, or an empty
array to not do load balancing.public void setPort(int port)
port
- The port to use for accepting connections
from clients.public void setSecurePort(int securePort)
securePort
- The port to use for accepting Secure
Sockets Layer (SSL) connections from
clients.public void setVerbose(boolean verbose)
verbose
- true to print status and connection
information to System.out, false otherwise.public void start()
public void stop()