本文整理汇总了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;
}
}
示例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;
}
}
示例3: map
import org.apache.flink.api.java.tuple.Tuple1; //导入方法依赖的package包/类
@Override
public Tuple1<Long> map(Long value) throws Exception {
return Tuple1.of(value);
}