Skip to content

Instantly share code, notes, and snippets.

@nschlimm
Created March 22, 2012 10:14
Show Gist options
  • Save nschlimm/2157558 to your computer and use it in GitHub Desktop.
Save nschlimm/2157558 to your computer and use it in GitHub Desktop.
Use PoolSizeCalculator
public class MyPoolSizeCalculator extends PoolSizeCalculator {
public static void main(String[] args) throws InterruptedException,
InstantiationException,
IllegalAccessException,
ClassNotFoundException {
MyThreadSizeCalculator calculator = new MyThreadSizeCalculator();
calculator.calculateBoundaries(new BigDecimal(1.0),
new BigDecimal(100000));
}
protected long getCurrentThreadCPUTime() {
return ManagementFactory.getThreadMXBean().getCurrentThreadCpuTime();
}
protected Runnable creatTask() {
return new AsynchronousTask(0, "IO", 1000000);
}
protected BlockingQueue<Runnable> createWorkQueue() {
return new LinkedBlockingQueue<>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment