diff options
author | Jean-Philippe Lesot <jplesot@google.com> | 2015-03-31 16:33:47 +0200 |
---|---|---|
committer | Jean-Philippe Lesot <jplesot@google.com> | 2015-03-31 16:33:47 +0200 |
commit | 9d912214d64dc06cd485bffd66fe6d3b0d6defbf (patch) | |
tree | c7353d946486253307fc35ee0a0e04fb4899057c /sched | |
parent | 2123d170c6ff3920d916de492a9fcf06caaf81a4 (diff) | |
download | toolchain_jack-9d912214d64dc06cd485bffd66fe6d3b0d6defbf.zip toolchain_jack-9d912214d64dc06cd485bffd66fe6d3b0d6defbf.tar.gz toolchain_jack-9d912214d64dc06cd485bffd66fe6d3b0d6defbf.tar.bz2 |
Add a support for opening file with timeout in Jack simple server
Change-Id: I560af413992a38711b5bd0053cf8fe0efddeceab
Diffstat (limited to 'sched')
-rw-r--r-- | sched/src/com/android/sched/util/file/InputStreamFile.java | 2 | ||||
-rw-r--r-- | sched/src/com/android/sched/util/file/OutputStreamFile.java | 12 |
2 files changed, 9 insertions, 5 deletions
diff --git a/sched/src/com/android/sched/util/file/InputStreamFile.java b/sched/src/com/android/sched/util/file/InputStreamFile.java index 60f493a..7c5ef27 100644 --- a/sched/src/com/android/sched/util/file/InputStreamFile.java +++ b/sched/src/com/android/sched/util/file/InputStreamFile.java @@ -75,7 +75,7 @@ public class InputStreamFile extends AbstractStreamFile implements InputStreamPr @Override @Nonnull - public InputStream getInputStream() { + public synchronized InputStream getInputStream() { if (stream == null) { clearRemover(); diff --git a/sched/src/com/android/sched/util/file/OutputStreamFile.java b/sched/src/com/android/sched/util/file/OutputStreamFile.java index 37907b2..07e0002 100644 --- a/sched/src/com/android/sched/util/file/OutputStreamFile.java +++ b/sched/src/com/android/sched/util/file/OutputStreamFile.java @@ -41,9 +41,9 @@ public class OutputStreamFile extends AbstractStreamFile implements OutputStream private final boolean append; @CheckForNull - private PrintStream printer; + protected PrintStream printer; @CheckForNull - private OutputStream stream; + protected OutputStream stream; public OutputStreamFile(@Nonnull String name, @CheckForNull RunnableHooks hooks, @@ -204,7 +204,7 @@ public class OutputStreamFile extends AbstractStreamFile implements OutputStream @Override @Nonnull - public OutputStream getOutputStream() { + public synchronized OutputStream getOutputStream() { if (stream == null) { clearRemover(); @@ -220,11 +220,15 @@ public class OutputStreamFile extends AbstractStreamFile implements OutputStream @Override @Nonnull - public PrintStream getPrintStream() { + public synchronized PrintStream getPrintStream() { if (printer == null) { printer = new PrintStream(getOutputStream()); } return printer; } + + public boolean isInAppendMode() { + return append; + } } |