本文整理汇总了Java中org.pentaho.di.trans.SingleThreadedTransExecutor.init方法的典型用法代码示例。如果您正苦于以下问题:Java SingleThreadedTransExecutor.init方法的具体用法?Java SingleThreadedTransExecutor.init怎么用?Java SingleThreadedTransExecutor.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.trans.SingleThreadedTransExecutor
的用法示例。
在下文中一共展示了SingleThreadedTransExecutor.init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: failsWhenGivenNonSingleThreadSteps
import org.pentaho.di.trans.SingleThreadedTransExecutor; //导入方法依赖的package包/类
@Test( expected = KettleException.class )
public void failsWhenGivenNonSingleThreadSteps() throws Exception {
Meta metaInterface = createMeta();
PluginRegistry plugReg = PluginRegistry.getInstance();
String id = plugReg.getPluginId( StepPluginType.class, metaInterface );
assertNotNull( "pluginId", id );
StepMeta stepMeta = new StepMeta( id, "stepMetrics", metaInterface );
stepMeta.setDraw( true );
TransMeta transMeta = new TransMeta();
transMeta.setName( "failsWhenGivenNonSingleThreadSteps" );
transMeta.addStep( stepMeta );
Trans trans = new Trans( transMeta );
trans.prepareExecution( null );
SingleThreadedTransExecutor executor = new SingleThreadedTransExecutor( trans );
executor.init();
}
示例2: start
import org.pentaho.di.trans.SingleThreadedTransExecutor; //导入方法依赖的package包/类
@Override
public void start() {
try {
// Initialize the sink transformation
TransMeta transMeta = new TransMeta(this.sinkTransPath, (Repository) null);
// If running in blocking mode, make sure the transformation type is single threaded
if (sinkExecutionType == TransExecutionType.BLOCKING) {
transMeta.setTransformationType(TransMeta.TransformationType.SingleThreaded);
transMeta.setUsingThreadPriorityManagment(false);
}
sinkTrans = new Trans(transMeta);
sinkTrans.prepareExecution(null);
sinkTrans.setLogLevel(LogLevel.valueOf(this.sinkLogLevel));
// Find the injector step and set it to consume rows from the row producer
StepInterface injector = sinkTrans.findRunThread(this.sinkInjectorName);
Preconditions.checkNotNull(injector, "Couldn't find Injector step with name: " + this.sinkInjectorName);
injectorRowMeta = transMeta.getStepFields(injector.getStepMeta());
sinkRowProducer = sinkTrans.addRowProducer(injector.getStepname(), 0);
// Initialize the transformation and wait for rows to be injected
sinkTrans.startThreads();
if (sinkExecutionType == TransExecutionType.BLOCKING) {
singleThreadedTransExecutor = new SingleThreadedTransExecutor(sinkTrans);
singleThreadedTransExecutor.init();
}
super.start();
logger.debug("Loaded sink transformation from: " + this.sinkTransPath);
} catch (KettleException e) {
e.printStackTrace();
}
}
示例3: reduce
import org.pentaho.di.trans.SingleThreadedTransExecutor; //导入方法依赖的package包/类
public void reduce( final K key, final Iterator<V> values, final OutputCollector<K2, V2> output, final Reporter reporter ) throws IOException {
try {
if ( debug ) {
reporter.setStatus( "Begin processing record" );
}
// Just to make sure the configuration is not broken...
if ( trans == null ) {
throw new RuntimeException( "Error initializing transformation. See error log." ); //$NON-NLS-1$
}
// The transformation needs to be prepared and started...
// Only ever initialize once!
if ( !trans.isRunning() ) {
shareVariableSpaceWithTrans( reporter );
setTransLogLevel( reporter );
prepareExecution( reporter );
addInjectorAndProducerToTrans( key, values, output, reporter, getInputStepName(), getOutputStepName() );
// If we're using the single threading engine we're going to keep pushing rows into our construct.
// If not, we're going to re-create the Trans engine every time.
if ( isSingleThreaded() ) {
executor = new SingleThreadedTransExecutor( trans );
// This validates whether or not a step is capable of running in Single Threaded mode.
boolean ok = executor.init();
if ( !ok ) {
throw new KettleException( "Unable to initialize the single threaded transformation, check the log for details." );
}
// The transformation is considered in a "running" state now.
}
}
// The following 2 statements are the only things left to do for one set of data coming from Hadoop...
// Inject the values, including the one we probed...
injectValues( key, values, output, reporter );
if ( isSingleThreaded() ) {
// Signal to the executor that we have enough data in the pipeline to do one iteration.
// All steps are executed in a loop once in sequence, one after the other.
executor.oneIteration();
}
} catch ( Exception e ) {
printException( reporter, e );
setDebugStatus( reporter, "An exception was raised" );
throw new IOException( e );
}
}