All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.wavebeans.execution.ExecutionThreadPool.kt Maven / Gradle / Ivy
package io.wavebeans.execution
import java.util.concurrent.*
interface ExecutionThreadPool : ScheduledExecutorService {
}
abstract class AbstractExecutionThreadPool : ExecutionThreadPool {
protected abstract val workingPool: ScheduledExecutorService
override fun shutdown() {
workingPool.shutdown()
}
override fun submit(task: Callable): Future {
return workingPool.submit(task)
}
override fun submit(task: Runnable, result: T): Future {
return workingPool.submit(task, result)
}
override fun submit(task: Runnable): Future<*> {
return workingPool.submit(task)
}
override fun shutdownNow(): MutableList {
return workingPool.shutdownNow()
}
override fun isShutdown(): Boolean {
return workingPool.isShutdown
}
override fun awaitTermination(timeout: Long, unit: TimeUnit): Boolean {
return workingPool.awaitTermination(timeout, unit)
}
override fun invokeAny(tasks: MutableCollection>): T {
return workingPool.invokeAny(tasks)
}
override fun invokeAny(tasks: MutableCollection>, timeout: Long, unit: TimeUnit): T {
return workingPool.invokeAny(tasks, timeout, unit)
}
override fun isTerminated(): Boolean {
return workingPool.isTerminated
}
override fun invokeAll(tasks: MutableCollection>): MutableList> {
return workingPool.invokeAll(tasks)
}
override fun invokeAll(tasks: MutableCollection>, timeout: Long, unit: TimeUnit): MutableList> {
return workingPool.invokeAll(tasks, timeout, unit)
}
override fun execute(command: Runnable) {
workingPool.execute(command)
}
override fun schedule(command: Runnable, delay: Long, unit: TimeUnit): ScheduledFuture<*> {
return workingPool.schedule(command, delay, unit)
}
override fun schedule(callable: Callable, delay: Long, unit: TimeUnit): ScheduledFuture {
return workingPool.schedule(callable, delay, unit)
}
override fun scheduleAtFixedRate(command: Runnable, initialDelay: Long, period: Long, unit: TimeUnit): ScheduledFuture<*> {
return scheduleAtFixedRate(command, initialDelay, period, unit)
}
override fun scheduleWithFixedDelay(command: Runnable, initialDelay: Long, delay: Long, unit: TimeUnit): ScheduledFuture<*> {
return scheduleWithFixedDelay(command, initialDelay, delay, unit)
}
}
class MultiThreadedExecutionThreadPool(threadsNum: Int) : AbstractExecutionThreadPool() {
override val workingPool = Executors.newScheduledThreadPool(threadsNum, NamedThreadFactory("work"))
}