本文整理了Java中cascading.tap.Tap.commitResource()
方法的一些代码示例,展示了Tap.commitResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tap.commitResource()
方法的具体详情如下:
包路径:cascading.tap.Tap
类名称:Tap
方法名:commitResource
[英]Method commitResource allows the underlying resource to be notified when all write processing is successful so that any additional cleanup or processing may be completed.
See #rollbackResource(Object) to handle cleanup in the face of failures.
This method is invoked once client side and not in the cluster, if any.
If other sink Tap instance in a given Flow fail on commitResource after called on this instance, rollbackResource will not be called.
[中]方法commitResource允许在所有写入处理成功时通知底层资源,以便完成任何额外的清理或处理。
请参阅#rollbackResource(Object)以处理失败时的清理。
此方法只在客户端调用一次,而不在集群中调用(如果有的话)。
如果给定流中的其他sink-Tap实例在此实例上调用后在commitResource上失败,则不会调用rollbackResource。
代码示例来源:origin: cwensel/cascading
@Override
public boolean commitResource( Config conf ) throws IOException
{
return parent.commitResource( conf );
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean commitResource( Config conf ) throws IOException
{
return original.commitResource( conf );
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean commitResource( TConfig conf ) throws IOException
{
return original.commitResource( configProvider.apply( conf ) );
}
代码示例来源:origin: cwensel/cascading
@Override
public boolean commitResource( Config conf ) throws IOException
{
for( Tap tap : getTaps() )
{
if( !tap.commitResource( conf ) )
return false;
}
return true;
}
代码示例来源:origin: cwensel/cascading
private void commitTraps()
{
// commit all the traps, don't fail on an error
for( Tap tap : traps.values() )
{
try
{
if( !tap.commitResource( getConfig() ) )
logError( "unable to commit trap: " + tap.getFullIdentifier( getConfig() ) );
}
catch( IOException exception )
{
logError( "unable to commit trap: " + tap.getFullIdentifier( getConfig() ), exception );
}
}
}
代码示例来源:origin: com.hotels/plunger
private void writeToLocalTap(Tap<?, ?, ?> tap) throws IOException {
@SuppressWarnings("unchecked")
Tap<Properties, ?, ?> localTap = (Tap<Properties, ?, ?>) tap;
Properties conf = new Properties();
LocalFlowProcess flowProcess = new LocalFlowProcess(conf);
flowProcess.setStepStats(new LocalStepStats(new NullFlowStep(), NullClientState.INSTANCE));
localTap.sinkConfInit(flowProcess, conf);
TupleEntryCollector collector = localTap.openForWrite(flowProcess);
for (TupleEntry tuple : data.asTupleEntryList()) {
collector.add(tuple);
}
collector.close();
localTap.commitResource(conf);
}
代码示例来源:origin: cwensel/cascading
private Throwable commitResource( Tap tap )
{
Throwable throwable = null;
try
{
if( !tap.commitResource( getConfig() ) )
{
String message = "unable to commit sink: " + tap.getFullIdentifier( getConfig() );
logError( message );
throwable = new FlowException( message );
}
}
catch( Throwable exception )
{
String message = "unable to commit sink: " + tap.getFullIdentifier( getConfig() );
logError( message, exception );
throwable = new FlowException( message, exception );
}
return throwable;
}
内容来源于网络,如有侵权,请联系作者删除!