当前位置: 首页>>代码示例>>Java>>正文


Java Tuple1.of方法代码示例

本文整理汇总了Java中org.apache.flink.api.java.tuple.Tuple1.of方法的典型用法代码示例。如果您正苦于以下问题:Java Tuple1.of方法的具体用法?Java Tuple1.of怎么用?Java Tuple1.of使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.api.java.tuple.Tuple1的用法示例。


在下文中一共展示了Tuple1.of方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyFromLocal

import org.apache.flink.api.java.tuple.Tuple1; //导入方法依赖的package包/类
public static void copyFromLocal(final File localPath,
		final URI remotePath) throws Exception {
	// Do it in another Thread because HDFS can deadlock if being interrupted while copying
	String threadName = "HDFS Copy from " + localPath + " to " + remotePath;

	final Tuple1<Exception> asyncException = Tuple1.of(null);

	Thread copyThread = new Thread(threadName) {
		@Override
		public void run() {
			try {
				Configuration hadoopConf = HadoopFileSystem.getHadoopConfiguration();

				FileSystem fs = FileSystem.get(remotePath, hadoopConf);

				fs.copyFromLocalFile(new Path(localPath.getAbsolutePath()),
						new Path(remotePath));
			} catch (Exception t) {
				asyncException.f0 = t;
			}
		}
	};

	copyThread.setDaemon(true);
	copyThread.start();
	copyThread.join();

	if (asyncException.f0 != null) {
		throw asyncException.f0;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:32,代码来源:HDFSCopyFromLocal.java

示例2: copyToLocal

import org.apache.flink.api.java.tuple.Tuple1; //导入方法依赖的package包/类
public static void copyToLocal(final URI remotePath,
		final File localPath) throws Exception {
	// Do it in another Thread because HDFS can deadlock if being interrupted while copying
	String threadName = "HDFS Copy from " + remotePath + " to " + localPath;

	final Tuple1<Exception> asyncException = Tuple1.of(null);

	Thread copyThread = new Thread(threadName) {
		@Override
		public void run() {
			try {
				Configuration hadoopConf = HadoopFileSystem.getHadoopConfiguration();

				FileSystem fs = FileSystem.get(remotePath, hadoopConf);
				fs.copyToLocalFile(new Path(remotePath), new Path(localPath.getAbsolutePath()));
			} catch (Exception t) {
				asyncException.f0 = t;
			}
		}
	};

	copyThread.setDaemon(true);
	copyThread.start();
	copyThread.join();

	if (asyncException.f0 != null) {
		throw asyncException.f0;
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:30,代码来源:HDFSCopyToLocal.java

示例3: map

import org.apache.flink.api.java.tuple.Tuple1; //导入方法依赖的package包/类
@Override
public Tuple1<Long> map(Long value) throws Exception {
	return Tuple1.of(value);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:5,代码来源:StreamCheckpointNotifierITCase.java


注:本文中的org.apache.flink.api.java.tuple.Tuple1.of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。