AnonymousAccount4SE / React

Smart Server Performance

Home Page:https://volmit.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React 8

Make an API-less sampler

Make sure you create an annotation XReactSampler

// The name must be XReactSampler
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface XReactSampler {
    // These are required for sampler registration
    String id();
    int interval() default 50;
    String suffix() default "";
}

This can be re-used for any samplers you choose to create.

Define the sampler

@XReactSampler(
    // The id of the sampler is used in configurations for server owners
    id = "some-sampler-id",
    // The interval is in milliseconds. This is how often the sampler will run
    interval = 50,
    // The suffix is used to display the value of the sampler
    suffix = "/s")
public class ExampleSampler {
    // React will call this at the interval you specify if the sampler is used
    // This method must be parallel capable & thread safe, as it will be called
    // from a different thread than the main thread
    public double sample() {
        return 0;
    }
}

React will automatically find your samplers and register / unregister them.

About

Smart Server Performance

https://volmit.com

License:GNU General Public License v3.0


Languages

Language:Java 97.3%Language:C++ 1.2%Language:CMake 1.0%Language:HTML 0.1%Language:GLSL 0.1%Language:C 0.1%Language:Swift 0.1%Language:Shell 0.0%Language:Dart 0.0%Language:Batchfile 0.0%Language:Kotlin 0.0%Language:Objective-C 0.0%