-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Async.java
64 lines (55 loc) · 1.37 KB
/
Async.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.codahale.metrics.health.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.concurrent.TimeUnit;
/**
* An annotation for marking asynchronous health check execution.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Async {
/**
* Enum representing the initial health states.
*/
enum InitialState {
HEALTHY, UNHEALTHY
}
/**
* Enum representing the possible schedule types.
*/
enum ScheduleType {
FIXED_RATE, FIXED_DELAY
}
/**
* Period between executions.
*
* @return period
*/
long period();
/**
* Scheduling type of asynchronous executions.
*
* @return schedule type
*/
ScheduleType scheduleType() default ScheduleType.FIXED_RATE;
/**
* Initial delay of first execution.
*
* @return initial delay
*/
long initialDelay() default 0;
/**
* Time unit of initial delay and period.
*
* @return time unit
*/
TimeUnit unit() default TimeUnit.SECONDS;
/**
* Initial health state until first asynchronous execution completes.
*
* @return initial health state
*/
InitialState initialState() default InitialState.HEALTHY;
}