Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIG-5417:Replace guava's Files.createTempDir() #36

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
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
6 changes: 4 additions & 2 deletions src/org/apache/pig/data/SchemaTupleBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.util.Map;
import java.util.Set;

Expand All @@ -43,7 +44,6 @@

import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.io.Files;

public class SchemaTupleBackend {
private static final Log LOG = LogFactory.getLog(SchemaTupleBackend.class);
Expand Down Expand Up @@ -81,7 +81,9 @@ private SchemaTupleBackend(Configuration jConf, boolean isLocal) {
}
codeDir = new File(jConf.get(PigConstants.LOCAL_CODE_DIR));
} else {
codeDir = Files.createTempDir();
File tempDirBase = new File(System.getProperty("java.io.tmpdir"));
codeDir = Files.createTempDirectory(
tempDirBase.toPath(), System.currentTimeMillis() + "-").toFile();
codeDir.deleteOnExit();
}

Expand Down
6 changes: 4 additions & 2 deletions src/org/apache/pig/data/SchemaTupleFrontend.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
Expand All @@ -46,7 +47,6 @@

import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.io.Files;

/**
* This class is to be used at job creation time. It provides the API that lets code
Expand Down Expand Up @@ -94,7 +94,9 @@ private static class SchemaTupleFrontendGenHelper {
private Configuration conf;

public SchemaTupleFrontendGenHelper(PigContext pigContext, Configuration conf) {
codeDir = Files.createTempDir();
File tempDirBase = new File(System.getProperty("java.io.tmpdir"));
codeDir = Files.createTempDirectory(
tempDirBase.toPath(), System.currentTimeMillis() + "-").toFile();
codeDir.deleteOnExit();
LOG.debug("Temporary directory for generated code created: "
+ codeDir.getAbsolutePath());
Expand Down