Merge "Close DirectoryStream in ActivityThread after use."
This commit is contained in:
@@ -238,6 +238,7 @@ import java.io.PrintWriter;
|
|||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.nio.file.DirectoryStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
@@ -4221,18 +4222,20 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
|
|
||||||
static void handleAttachStartupAgents(String dataDir) {
|
static void handleAttachStartupAgents(String dataDir) {
|
||||||
try {
|
try {
|
||||||
Path code_cache = ContextImpl.getCodeCacheDirBeforeBind(new File(dataDir)).toPath();
|
Path codeCache = ContextImpl.getCodeCacheDirBeforeBind(new File(dataDir)).toPath();
|
||||||
if (!Files.exists(code_cache)) {
|
if (!Files.exists(codeCache)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Path startup_path = code_cache.resolve("startup_agents");
|
Path startupPath = codeCache.resolve("startup_agents");
|
||||||
if (Files.exists(startup_path)) {
|
if (Files.exists(startupPath)) {
|
||||||
for (Path p : Files.newDirectoryStream(startup_path)) {
|
try (DirectoryStream<Path> startupFiles = Files.newDirectoryStream(startupPath)) {
|
||||||
handleAttachAgent(
|
for (Path p : startupFiles) {
|
||||||
p.toAbsolutePath().toString()
|
handleAttachAgent(
|
||||||
+ "="
|
p.toAbsolutePath().toString()
|
||||||
+ dataDir,
|
+ "="
|
||||||
null);
|
+ dataDir,
|
||||||
|
null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user