Developers: Java Operators

Home
Documentation
Library
Sample Code and Applications
FAQs
Articles
Community
Training
Download Center
Contact DevZone

Printer Friendly

Frequently Asked Questions

Java Operators

Note: Differences between the Developer and Enterprise Editions are listed here.

How do I configure JAR files so I can run the server from the command line?

When you add a Java Operator to an application in StreamBase Studio, the JAR that includes the operator code is included in the project's Custom Libraries directory. Therefore, you can run the application in StreamBase Studio without any changes to the project's sbd.sbconf configuration file.

However, when you run the application from the command line, the operator code is not under StreamBase Studio management, and the StreamBase server cannot automatically find the JAR file. Therefore, you must edit the <java-wm> configuration settings in the sbd.sbconf configuration file, and identify the absolute or relative path of the JAR file used by your operator.

Note that setting a CLASSPATH entry in the <dir> section does not allow the application to find the JAR file.

Applicable To: StreamBase 3.5, 3.7
July 14, 2006


 

What does the error, java.io.IOException: End of Stream mean?

This error indicates that the client is no longer receiving data from the server. Therefore, it does not necessarily indicate an end of stream condition; it could also indicate a server problem.

Applicable To: StreamBase 3.5, 3.7
July 14, 2006


 

How does the StreamBase Java API handle garbage collection?

StreamBase avoids garbage collection in two ways: Not using objects, and only using the minimum set of objects we need.

First, we avoid using objects by using Java primitive types (Boolean, byte, int, double, and long) to represent our data for processing. Each StreamBase data type is represented by one or more primitive type. By only manipulating the primitive types, we can store data efficiently in stack or array allocated regions of memory. We can then use techniques like parallel arrays or method calling to pass data around efficiently.

Second, when we do use objects, we are careful about their creation and destruction. We tend to pool objects rather than releasing them for garbage collection. We try to manage object lifecycle such that objects are either caught by the garbage collector in the young generation, or kept around forever.

Finally, we test this internally using a benchmarking harness that measures per-tuple garbage collection. In order to achieve our high speeds, we try to eliminate all per-tuple garbage collection, generally with good success.

Applicable To: StreamBase 3.5, 3.7
July 14, 2006


 

How are JAR manifests handled?

The manifest format for JAR is format sensitive: it requires blank lines without non-printing characters. One way to minimize the occurrence of such problems is to use Ant to create the manifest.

Applicable To: StreamBase 3.5, 3.7
May 23, 2006


 

How do I force Java operator execution?

The Java operator is triggered only when a tuple arrives. To force the Java operator to execute without a data tuple, you could use a Metronome operator to generate an asynchronous input to the Java operator.

Applicable To: StreamBase 3.5, 3.7
May 23, 2006


 

When can I call sendOutput()?

When running versions of StreamBase earlier than 3.5, the function call sendOutput() must only be called from within processTuple(). If it is called from other places the application will hang.

Applicable To: StreamBase 3.5, 3.7
May 23, 2006


 

Can my Java Operator call the client API?

No, StreamBase does not support using the StreamBase Client API from within a Java operator.

Applicable To: StreamBase 3.5, 3.7
May 23, 2006


 

How can Java assertions help me debug?

Enabling Java assertions, by using the java-vm element -ea flag in the sbd.sbconf file (during development only), is useful for debugging. The section of sbd.sbconf that handles java-vm looks like this:

 <java-vm>
         <param name="java-home" value="/usr/java/j2sdk1.4.2_08"/>
         <param name="jvm-args" value="-Xms128m -Xmx512m"/>
         <jar file="operator.jar"/>
         <dir path="/opt/apache/classes"/>
         <library file="native-lib"/>
      </java-vm>

Applicable To: StreamBase 3.5, 3.7
May 23, 2006