This page was last modified 5-Apr-2002.

prev | TOC | next

JTransit Tips & Tricks

If you have a tip you'd like to add to this page, please email us and let us know!

New Tag:

< @MINUS ARRAY1=arrayVarName1 ARRAY2=arrayVarName2 [COLS=compCol [compType]] [SCOPE1=scope1] [SCOPE2=scope2] >

@MINUS calculates the difference between 2 arrays. This is always ARRAY1 - ARRAY2. The tag follows the same syntax as the <@UNION> tag.

For example:

Array 1 contains:
    John
    Jack
    Harry
    Sally

Array 2 contains:
    John
    Harry

The resulting @MINUS will return:
    Jack
    Sally

Color coding in the Tango editor will not recognize this tag. Also note that if you use JTransit-specific tags, you may no longer test your code in the Tango Application Server, since it does not recognize them.

TIP 1:

Did you know that in JTransit, you can save even more processing time by using proper logic tags? For example:

Instead of this:
    < @IF EXPR="1 = 2">
        Do something here
    < @ELSE>
        Do something else
    < /@IF>

It will save processing time if you do this:
    < @IFEQUAL 1 2>
        Do something here
    < @ELSE>
        Do something else
    < /@IF>

The same goes for < @IFEMPTY>.

After you move your code over to JTransit and start working on the new version of your software, go over it and apply this tip for faster results.

Tip 2:

After using the parser and while debugging, during cleanup before compiling, try this.

In JTransit, unlike Tango, when you have a situation such as this:
    < @IF EXPR="LEN(< @VAR local$someVar>)">
        Stuff here
    < /@IF>

We first evaluate the < @VAR local$someVar>, then process the expression. If the value contains a space, your code will evaluate to false. The solution?

Always do this:
    < @IF EXPR="LEN('<@VAR local$someVar>')">
        Stuff here
    </ @IF>

Even if it's a number, it's best to quote the value you wish to evaluate to ensure the whole string is processed.

This is one of the more painless changes you have to deal with when cleaning up code. A simple find using regex should help you find the culprits. The regular expression that should help is:
    LEN\([^'")]*\)

Tip 3:

One of JTransit's pet peeves is improperly nested quotes, or staggered quotes. To look for and change nested double quotes into single quotes:

Find only:
    "[^"<>]*<@[^"<>]+"[^"<>]*"

Or find and replace:
    ("[^"<>]*<@[^"<>]+)"([^"<>]*)"

with:
    \1'\2'

Tip 4:

In JTransit 1.2 Build 5 a new PART parameter was added to the <@ERROR> tag.

To use it, follow the example below:
    < @ERRORS>
        <@ERROR PART="stack">
    </ @ERROR>

This will display the java stack dump in the error block of your code, in case JTransit throws an error.

This is JTransit specific; however, using it with the Tango App Server is not a problem. It just doesn't return anything. This should allow you to still test your code in the Tango Application Server if you wish.

Tip 5:

There is a param-name, in the JTransit.xml file, called logToFile which allows you to log the debugging to a file if you want, and just have the debugging show up in the browser and vice versa.

The parameter is:
    <parameter
        param-name = "logToFile"
        param-value = "false"
    />

This will set the file logging to false. In the Tango app server, this setting was always set to true.

Here are some tips on what happens with the logging parameter tags:

EXAMPLE 1:
    <parameter
        param-name = "loggingLevel"
        param-value = "1"
    />
    <parameter
        param-name = "logToResults"
        param-value = "true"
    />
    <parameter
        param-name = "logToFile"
        param-value = "false"
    />
Sets the logging level to one, displays the logging in the browser, but nothing is written to the file.

EXAMPLE 2:
    <parameter
        param-name = "loggingLevel"
        param-value = "2"
    />
    <parameter
        param-name = "logToResults"
        param-value = "false"
    />
    <parameter
        param-name = "logToFile"
        param-value = "true"
    />
Sets the logging to level 2, logs the debug to a file, but doesn't show anything in the browser.

EXAMPLE 3:
    <parameter
        param-name = "loggingLevel"
        param-value = "1"
    />
    <parameter
        param-name = "logToResults"
        param-value = "true"
    />
    <parameter
        param-name = "logToFile"
        param-value = "true"
    />
Sets the logging level to 1, shows the debug in the browser and writes the debug to a file.

EXAMPLES 4 & 5
    <parameter
        param-name = "loggingLevel"
        param-value = "1"
    />
    <parameter
        param-name = "logToResults"
        param-value = "false"
    />
    <parameter
        param-name = "logToFile"
        param-value = "false"
    />
Same as setting the loggingLevel to noLogging. Does not log anything.

    <parameter
        param-name = "loggingLevel"
        param-value = "noLogging"
    />
    <parameter
        param-name = "logToResults"
        param-value = "true"
    />
    <parameter
        param-name = "logToFile"
        param-value = "true"
    />
Same as setting the loggingLevel to noLogging. Does not log anything.

Tip 6:

How to start and stop Orion with JTRANSIT, and some initial settings which may help get better performance out of your server. This is for Solaris and Linux boxes only, but Windows users may extrapolate the information.

Starting Orion

$JAVA_HOME/bin/java -server -Xms320m -Xmx320m -XX:NewRatio=2 -jar orion.jar &

What all these switches mean:

-server: tells the java HotSpot server to startup in server mode, not the default client mode. This seems to provide faster performance, more threads to work with, lower latency, but higher memory usage (partly because of the other switches).

-Xms and -Xmx: Specifies the minimum and maximum amount of memory you want Orion to use. It is recommended that they both be set as high as you can afford. This will help get rid of excessive Java Garbage Collections.

-XX:NewRatio=2: Specifies the ration of new/old generation sizes. This helps decrease the time of old and new garbage collections in Java, providing you with a less hesitant browsing experience under heavier loads.

These settings are only recommendations, and may not work for everyone. You should work with your own server to see what best suits your environment. To help you find your best settings, you can look at the following 2 links:
Java VM Options: http://java.sun.com/docs/hotspot/VMOptions.html
Java VM Garbage Collection Tuning: http://java.sun.com/docs/hotspot/gc/index.html

You should also add the -verbose:gc switch before the -jar switch so you observe how many times your garbage collection occurs, and how fast it's being collected.

There is also a very slick way to start and stop the Orion server with the provided Orion tools.

Restarting orion:

java -jar admin.jar ormi://localhost:23791/ admin password -restart

This command uses Orion's RMI services to restart the Orion server. The admin and password are going to be different for you than for me. To find out what your admin/password is set to, go to Orion/config and look in principals.xml. The defaul ORMI port is 23791; you may have a different port setup. If so, change it appropriately.

To shutdown Orion use this:

java -jar admin.jar ormi://localhost:23791/ admin password -shutdown force

Notice the extra force keyword at the end. This seems to be a necessity when using JDK 1.3. For one reason or another (not sure where the blame lies here), if you don't use the force keyword, Orion shuts down, but the VM is not unloaded and stays in memory, causing the Orion PID to stick around, which in turn causes an error if you try to start Orion again. So use the force whenever possible, but do test without the force keyword first.

ADDENDUM:

It seems that JDK 1.3.1 on Windows installs with the HotSpot server (no wonder the install for the HotSpot server on the Sun site doesn't work).

There is a directory under C:\jdk1.3.1\jre\bin\server which contains the server JVM library.

So if anyone wants to run in server mode — and you should because it's very fast on windows — change the Orion startup script provided under the c:\jtransit directory to look like the following (I added the memory settings to this one, too):

cd c:\orion
java -server -Xms320m -Xmx320m -XX:NewRatio=2 -jar orion.jar

To find out if you have HotSpot installed, do this:

java -server -version

And you should see something like this:

java version "1.3.1" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24) Java HotSpot(TM) Server VM (build 1.3.1-b24, mixed mode)
prev | TOC | next
 Join the JTransit Talk List   |   Email JTransit Support   |   Visit http://jtransit.com/
Copyright ©2002 JTransit, Inc., All Rights Reserved
JTransit, JTransit Compiler, JTransit Runtime, FrontLine and RedLine are Trademarks of JTransit, Inc.
ColdFusion is a trademark of Allaire Corp. Tango is a trademark of Pervasive Software, Inc. WiTango is a trademark of With Enterprise Pty Ltd. Other trademarks are property of the respective trademark owners.