All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.guiabolso.tracing.wrapper.ScheduledExecutorServiceWrapper.kt Maven / Gradle / Ivy

The newest version!
package br.com.guiabolso.tracing.wrapper

import br.com.guiabolso.tracing.context.ThreadContextManager
import java.util.concurrent.Callable
import java.util.concurrent.ScheduledExecutorService
import java.util.concurrent.ScheduledFuture
import java.util.concurrent.TimeUnit

class ScheduledExecutorServiceWrapper(
    private val contextManagers: List>,
    private val delegate: ScheduledExecutorService
) : ExecutorServiceWrapper(contextManagers, delegate), ScheduledExecutorService {

    override fun schedule(command: Runnable, delay: Long, unit: TimeUnit): ScheduledFuture<*> {
        return delegate.schedule(RunnableWrapper(contextManagers, command), delay, unit)
    }

    override fun  schedule(callable: Callable, delay: Long, unit: TimeUnit): ScheduledFuture {
        return delegate.schedule(CallableWrapper(contextManagers, callable), delay, unit)
    }

    override fun scheduleAtFixedRate(command: Runnable, initialDelay: Long, period: Long, unit: TimeUnit): ScheduledFuture<*> {
        return delegate.scheduleAtFixedRate(RunnableWrapper(contextManagers, command), initialDelay, period, unit)
    }

    override fun scheduleWithFixedDelay(command: Runnable, initialDelay: Long, delay: Long, unit: TimeUnit): ScheduledFuture<*> {
        return delegate.scheduleWithFixedDelay(RunnableWrapper(contextManagers, command), initialDelay, delay, unit)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy