本文整理匯總了Java中org.springframework.data.hadoop.store.strategy.rollover.RolloverStrategy類的典型用法代碼示例。如果您正苦於以下問題:Java RolloverStrategy類的具體用法?Java RolloverStrategy怎麽用?Java RolloverStrategy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RolloverStrategy類屬於org.springframework.data.hadoop.store.strategy.rollover包,在下文中一共展示了RolloverStrategy類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dataStoreWriter
import org.springframework.data.hadoop.store.strategy.rollover.RolloverStrategy; //導入依賴的package包/類
@Bean
DataStoreWriter<String> dataStoreWriter(org.apache.hadoop.conf.Configuration hadoopConfiguration) {
TextFileWriter writer = new TextFileWriter(hadoopConfiguration,
new Path(properties.getDirectory()), null);
ChainedFileNamingStrategy namingStrategy = new ChainedFileNamingStrategy(
Arrays.asList(new FileNamingStrategy[]{
new StaticFileNamingStrategy(properties.getFileName()),
new UuidFileNamingStrategy(),
new RollingFileNamingStrategy(),
new StaticFileNamingStrategy(properties.getFileExtension(), ".")}));
writer.setFileNamingStrategy(namingStrategy);
RolloverStrategy rolloverStrategy = new SizeRolloverStrategy(properties.getRollover());
writer.setRolloverStrategy(rolloverStrategy);
return writer;
}