equal
deleted
inserted
replaced
45 try { |
45 try { |
46 final ExecutorService es = Executors.newFixedThreadPool(nThreads); |
46 final ExecutorService es = Executors.newFixedThreadPool(nThreads); |
47 for (int i = 0; i < nThreads; i++) |
47 for (int i = 0; i < nThreads; i++) |
48 es.execute(new Runnable() { public void run() { |
48 es.execute(new Runnable() { public void run() { |
49 try { |
49 try { |
50 FileOutputStream s = new FileOutputStream(file, true); |
50 try (FileOutputStream s = new FileOutputStream(file, true)) { |
51 for (int j = 0; j < 1000; j++) { |
51 for (int j = 0; j < 1000; j++) { |
52 s.write((int) 'x'); |
52 s.write((int) 'x'); |
53 s.flush(); |
53 s.flush(); |
|
54 } |
54 } |
55 } |
55 s.close(); |
|
56 } catch (Throwable t) { unexpected(t); }}}); |
56 } catch (Throwable t) { unexpected(t); }}}); |
57 es.shutdown(); |
57 es.shutdown(); |
58 es.awaitTermination(10L, TimeUnit.MINUTES); |
58 es.awaitTermination(10L, TimeUnit.MINUTES); |
59 equal(file.length(), (long) (nThreads * writes)); |
59 equal(file.length(), (long) (nThreads * writes)); |
60 } finally { |
60 } finally { |