Operator JavaOp

Primitive operator image not displayed. Problem loading file: ../../image/tk$spl/op$spl.utility$JavaOp.svg

The JavaOp operator is used to call out to operators implemented in Java by using the Java Operator API.

In addition to the parameters listed, arbitrary constant parameters are allowed. These parameters are specific to the operator and can be read by the operator's class.

Checkpointed data

JavaOp is a wrapper operator, so the contents of its checkpoint depends on the implementation of the Java operator.

Behavior in a consistent region

JavaOp is a wrapper operator, so its behavior in a consistent region depends on the behavior that is defined by the used Java class.

Checkpointing behavior in an autonomous region

If the StateHandler interface is not implemented, setting config checkpoint clause has no effect at runtime and no data is checkpointed.

If the StateHandler interface is implemented and the operator is configured with config checkpoint : periodic(T), a background thread in SPL Runtime checkpoints the operator every T seconds, and such periodic checkpointing activity is asynchronous to tuple processing.

If the StateHandler interface is implemented and the operator is configured with config checkpoint : operatorDriven, at runtime a call to CheckpointContext::createCheckpoint() would cauase the state of the operator to be checkpointed.

Examples

This example uses the JavaOp operator.


// Invocation of Java operator using the the JavaOp operator                                 
// from the SPL toolkit.                                                                     
//                                                                                           
// Creates a stream containing the Java VM's system properties                               
stream<ustring name, ustring value, set<ustring> tags> SystemProperties                      
 = JavaOp()                                                                                  
{                                                                                            
  param                                                                                      
    // Class name of the Java Operator to be invoked.                                        
    // Set to a class that implements com.ibm.streams.operator.Operator                      
    //                                                                                       
    className : "com.ibm.streams.operator.samples.sources.SystemPropertySource";             
    // Where the class is located. A list of jar files or                                    
    // directories containing the required classes for the                                   
    // Operator instance.                                                                    
    // In this case the class is from the set of samples                                     
    // provided with the Java Operator API and thus is always                                
    // in the class path.                                                                    
                                                                                         
    classLibrary: "";                                                                        
                                                                                         
    // Arbitrary JVM arguments can be passed using vmArg.                                    
    // When multiple Java operators invocations are fused                                    
    // together or executed in standalone mode they must                                     
    // have identical vmArg values.                                                          
    // To avoid different vmArgs settings, it is                                             
    // recommended that system properties set in vmArg                                       
    // are limited to those that must be set during JVM startup.                             
    // Other properties may be set by initialization Java code                               
    // of the Operator instance.                                                             
                                                                                         
    vmArg: "-Xmx128m";                                                                       
                                                                                         
    // JavaOp allows additional arbitrary parameters that                                    
    // are made available to the Operator instance through                                   
    // methods on the OperatorContext api. A parameter may                                   
    // have one or more values                                                               
    //                                                                                       
    // SystemProperties class puts the value of the parameter                                
    // tags as the tags attribute for any system property that                               
    // starts with the value of the tagged parameter.                                        
                                                                                         
    tagged: "java.";                                                                         
    tags: "system", "vm";                                                                    
}                         

Summary

Ports
This operator has 0 or more input ports and 0 or more output ports.
Windowing
This operator optionally accepts a windowing configuration.
Parameters
This operator supports arbitrary parameters in addition to 4 specific parameters.

Required: classLibrary, className

Optional: generated, vmArg

Metrics
This operator can report metrics.

Properties

Implementation
C++
Threading
Never - Operator never provides a single threaded execution context.

Input Ports

Ports (0...)

The JavaOp operator is configurable with zero or more input ports, which ingest the input tuples.

Properties

Output Ports

Assignments
This operator does not allow assignments to output attributes.
Ports (0...)

The JavaOp operator is configurable with zero or more output ports, which produce the submitted tuples.

Properties

Parameters

This operator supports arbitrary parameters in addition to 4 specific parameters.

Required: classLibrary, className

Optional: generated, vmArg

classLibrary

Specifies an application-specific class path that is required by the operator's class. The expressions correspond to a JAR file or a directory that contains Java classes.

Properties

className

Specifies the full class name of the operator that is used to process and submit tuples.

Properties

generated

If this parameter value is true, the compilation generates classes and interfaces specific to the operator and its ports. By default, the parameter value is false.

Properties

vmArg

Specifies command-line arguments that are passed to the Java virtual machine that the operator runs within.

Properties

Metrics

JavaOp is a wrapper operator, so any metrics reported depend on the implementation of the Java operator.

Libraries

javaop-jni
Library Name: streams-stdtk-javaop
Include Path: ../../../impl/include
java-jni
Command: ../../../impl/bin/JavaOp_vmpath.sh
Include Path: @JAVA_HOME@/include
pthreads
Library Name: pthread
dl
Library Name: dl
spl-std-tk-lib
Library Name: streams-stdtk-runtime
Include Path: ../../../impl/include