Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.samza.SamzaException;
import org.apache.samza.checkpoint.CheckpointId;
import org.apache.samza.checkpoint.CheckpointV2;
Expand Down Expand Up @@ -379,11 +380,13 @@ public List<File> getTaskStoreCheckpointDirs(File storeBaseDir, String storeName
String taskStoreName = getTaskStoreDir(storeBaseDir, storeName, taskName, taskMode).getName();

if (storeDir.exists()) { // new store or no local state
List<File> checkpointDirs = Files.list(storeDir.toPath())
try (Stream<Path> stream = Files.list(storeDir.toPath())) {
List<File> checkpointDirs = stream
.map(Path::toFile)
.filter(file -> file.getName().contains(taskStoreName + "-"))
.collect(Collectors.toList());
return checkpointDirs;
return checkpointDirs;
}
} else {
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;


/**
Expand Down Expand Up @@ -203,8 +204,8 @@ public List<String[]> consumeQueryResult(ExecutionContext context, int startRow,
public NonQueryResult executeNonQuery(ExecutionContext context, File sqlFile) throws ExecutorException {
LOG.info("Sql file path: " + sqlFile.getPath());
List<String> executedStmts;
try {
executedStmts = Files.lines(Paths.get(sqlFile.getPath())).collect(Collectors.toList());
try (Stream<String> stream = Files.lines(Paths.get(sqlFile.getPath()))) {
executedStmts = stream.collect(Collectors.toList());
} catch (IOException e) {
throw new ExecutorException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
Expand Down Expand Up @@ -73,8 +74,8 @@ private SqlFileParser() {
public static List<String> parseSqlFile(String fileName) {
Validate.notEmpty(fileName, "fileName cannot be empty.");
List<String> sqlLines;
try {
sqlLines = Files.lines(Paths.get(fileName)).collect(Collectors.toList());
try (Stream<String> stream = Files.lines(Paths.get(fileName))) {
sqlLines = stream.collect(Collectors.toList());
} catch (IOException e) {
String msg = String.format("Unable to parse the sql file %s", fileName);
LOG.error(msg, e);
Expand Down