Configuring the Traffic Manager to Use Java
This section introduces the process of creating, configuring and running Java Extensions on the Traffic Manager. The Java Development Guide provides a much more complete description of this process.
Requirements
To use Java Extensions with the Traffic Manager, install the Java run-time environment (JRE) version 1.5 or later. Previous versions are not supported by the Traffic Manager.
Traffic Manager virtual/cloud/appliance instances include the necessary Java software to run Java Extensions.
Compiling a Java Extension
To compile Java Extensions for the Traffic Manager you will need the following resources:
•Java Development Kit (JDK), which contains the Java compiler. The compiler can be downloaded from http://www.oracle.com/technetwork/java/index.html.
•Java Servlet API library: This can be found in $ZEUSHOME/zxtm/lib/servlet.jar or downloaded from the link in the Java Extensions catalog.
•Traffic Manager Java Extensions API library: This can be found in $ZEUSHOME/zxtm/lib/zxtm-servlet.jar or downloaded from the link in the Java Extensions catalog.
To compile a Java Extension, run the command:
javac -cp servlet.jar:zxtm-servlet.jar MyServlet.java
This creates a class file called “MyServlet.class”. The above command assumes you have copied servlet.jar and zxtm-servlet.jar to the directory you are compiling from. If not, modify the command to specify the full path to each file.
You can also package up a Java extension along with any other needed classes in a single jar file. The Traffic Manager will automatically search jar files for Java extensions to use.
Loading Java Extensions onto the Traffic Manager
Java Extension class and jar files need to be added to the Traffic Manager’s Java Extensions catalog.
To upload the Extension, click Catalog > Java Extensions and specify your class or jar file in the “Upload” section. If your extension depends on other Java jar files that are not included in the Java distribution, you should upload those into the catalog too.
Configuring the Traffic Manager’s Java Extension Runner
The Traffic Manager includes a Java helper application called the Java Extension Runner (JRE) that hosts the Java extensions. You can control how the Traffic Manager initializes and runs this helper application using the settings in System->Global Settings->Java Extension Settings.
The following table lists the configuration settings available:
Setting |
Description |
java!enabled |
Enables or disables Java support in the Traffic Manager. By default, Java support is disabled for all new Traffic Manager instances. To use Java extensions in the Traffic Manager, set java!enabled to “Yes”. |
java!command |
The path to the Java executable, including any command-line arguments. |
java!classpath |
Colon-separated list of folders where the Java classes are located. |
java!lib |
Specifies a folder to search automatically for libraries used by your Java extensions. Note that the Traffic Manager will not load any Java extensions from this directory. |
java!max_conns |
Defines the maximum number of simultaneous Java requests allowed. Additional requests will be queued and will not be processed until the former ones have been completed. This setting is per CPU core; for multicore processors, multiply this setting by the number of available processor cores. |
java!session_age |
Value in seconds, defining a timeout to maintain a Java session. |
To specify a Java executable, set java!command to the name of the executable (include the full file path if it is not the default), along with any options the JRE should be run with.
To check your setup, click Diagnose > Cluster diagnosis and verify that the "Java extensions" section shows no errors or warnings. The Traffic Manager should now be ready to run Java extensions.