More formatting
This commit is contained in:
parent
fd1d0ce121
commit
b45305a61e
1 changed files with 8 additions and 18 deletions
|
|
@ -29,30 +29,20 @@ object ThreadPoolConfig {
|
|||
val defaultTimeout: Duration = Duration(60000L, TimeUnit.MILLISECONDS)
|
||||
val defaultRejectionPolicy: RejectedExecutionHandler = new SaneRejectedExecutionHandler()
|
||||
|
||||
def scaledPoolSize(floor: Int, multiplier: Double, ceiling: Int): Int = {
|
||||
import scala.math.{ min, max }
|
||||
min(max((Runtime.getRuntime.availableProcessors * multiplier).ceil.toInt, floor), ceiling)
|
||||
}
|
||||
def scaledPoolSize(floor: Int, multiplier: Double, ceiling: Int): Int =
|
||||
math.min(math.max((Runtime.getRuntime.availableProcessors * multiplier).ceil.toInt, floor), ceiling)
|
||||
|
||||
def arrayBlockingQueue(capacity: Int, fair: Boolean): QueueFactory =
|
||||
() ⇒ new ArrayBlockingQueue[Runnable](capacity, fair)
|
||||
def arrayBlockingQueue(capacity: Int, fair: Boolean): QueueFactory = () ⇒ new ArrayBlockingQueue[Runnable](capacity, fair)
|
||||
|
||||
def synchronousQueue(fair: Boolean): QueueFactory =
|
||||
() ⇒ new SynchronousQueue[Runnable](fair)
|
||||
def synchronousQueue(fair: Boolean): QueueFactory = () ⇒ new SynchronousQueue[Runnable](fair)
|
||||
|
||||
def linkedBlockingQueue(): QueueFactory =
|
||||
() ⇒ new LinkedBlockingQueue[Runnable]()
|
||||
def linkedBlockingQueue(): QueueFactory = () ⇒ new LinkedBlockingQueue[Runnable]()
|
||||
|
||||
def linkedBlockingQueue(capacity: Int): QueueFactory =
|
||||
() ⇒ new LinkedBlockingQueue[Runnable](capacity)
|
||||
def linkedBlockingQueue(capacity: Int): QueueFactory = () ⇒ new LinkedBlockingQueue[Runnable](capacity)
|
||||
|
||||
def reusableQueue(queue: BlockingQueue[Runnable]): QueueFactory =
|
||||
() ⇒ queue
|
||||
def reusableQueue(queue: BlockingQueue[Runnable]): QueueFactory = () ⇒ queue
|
||||
|
||||
def reusableQueue(queueFactory: QueueFactory): QueueFactory = {
|
||||
val queue = queueFactory()
|
||||
() ⇒ queue
|
||||
}
|
||||
def reusableQueue(queueFactory: QueueFactory): QueueFactory = reusableQueue(queueFactory())
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue