Skip to content

Commit

Permalink
Stand
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Schlimm committed Apr 25, 2012
1 parent a26a781 commit 635e594
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Expand Up @@ -30,18 +30,26 @@
*/

import java.io.File;
import static java.nio.file.StandardOpenOption.*;
import java.nio.ByteBuffer;
import java.nio.channels.*;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.CompletionHandler;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
import java.util.HashSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicReference;

public class CustomThreadPool {

public static void main(String[] args) throws Exception {
File blah = File.createTempFile("blah", null);
blah.deleteOnExit();
AsynchronousFileChannel ch =
AsynchronousFileChannel.open(blah.toPath(), READ, WRITE);
ExecutorService pool = Executors.newFixedThreadPool(50, new MyThreadFactory());
AsynchronousFileChannel ch =
AsynchronousFileChannel.open(blah.toPath(),
new HashSet<StandardOpenOption>(Arrays.asList(StandardOpenOption.READ, StandardOpenOption.WRITE,
StandardOpenOption.CREATE, StandardOpenOption.DELETE_ON_CLOSE)), pool );
ByteBuffer src = ByteBuffer.wrap("Scooby Snacks".getBytes());

final AtomicReference<Thread> invoker = new AtomicReference<Thread>();
Expand Down
Expand Up @@ -161,7 +161,7 @@ static LockSlaveMirror startLockSlave() throws Exception {
String testClasses = System.getProperty("test.classes");
if (testClasses != null)
command += " -cp " + testClasses;
command += " Lock -lockslave " + port;
command += " com.schlimm.java7.nio.openjdktests.Lock -lockslave " + port;

Process p = Runtime.getRuntime().exec(command);
IOHandler.handle(p.getInputStream());
Expand Down

0 comments on commit 635e594

Please sign in to comment.