kyo.scheduler.util
Members list
Type members
Classlikes
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LoomSupport.type
Self-test utility for verifying scheduler behavior under load.
Self-test utility for verifying scheduler behavior under load.
This utility creates controlled load conditions to verify scheduler performance, admission control, and concurrency regulation. It incrementally increases concurrency until reaching rejection thresholds, helping validate proper scheduler operation and capacity limits.
The testing process can be customized through several parameters. Task duration controls the length of individual test operations. The rejection threshold determines the maximum acceptable task rejection rate. Monitoring and step intervals control the pace of measurements and client count increases respectively.
The companion object provides a main method to run the self-check with default settings. For more precise testing, create an instance with custom parameters to control the exact test conditions. The test runs until either reaching steady state or determining the system's capacity limits.
Value parameters
- executor
-
Executor for running test clients
- monitorIntervalMs
-
Interval between measurements
- rejectionThreshold
-
Maximum acceptable rejection rate
- scheduler
-
Scheduler instance to test
- stepMs
-
Duration to maintain each client count
- taskDurationMs
-
Duration of each test task
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
JVM-wide singleton that works across multiple classloaders.
JVM-wide singleton that works across multiple classloaders.
Regular singleton objects in Scala/Java are only unique within a single classloader. When multiple classloaders are involved (e.g. in application servers or plugin systems), each classloader creates its own instance, breaking singleton semantics.
This class is designed to be extended by companion objects to provide true JVM-wide singleton semantics. For example:
object MyService extends Singleton[MyService] {
override protected def init() = new MyService()
}
This is particularly important for systems that make adaptive decisions based on global state. For example, Kyo's scheduler dynamically adjusts its behavior based on system-wide metrics like thread scheduling delays. Having multiple scheduler instances would lead to:
- Conflicting thread pool adjustments
- Inaccurate system load measurements
- Competing admission control decisions
- Overall degraded performance
This class ensures proper singleton semantics by:
- Using System.properties as JVM-wide storage
- Synchronizing on SystemClassLoader to ensure global atomic initialization
- Caching the instance locally for fast access
Type parameters
- A
-
The type of the singleton instance.
Value parameters
- init
-
A function that creates the singleton instance when needed. This will be called at most once per JVM, regardless of the number of classloaders.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Thread factory for creating consistently named daemon threads.
Thread factory for creating consistently named daemon threads.
Creates daemon threads with auto-incrementing IDs prefixed by the given name. Optionally accepts a custom thread creation function while maintaining naming.
Value parameters
- create
-
Optional custom thread creation function
- name
-
Base name for created threads
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Threads.type