File tree 4 files changed +37
-6
lines changed
openmessaging-api/src/main/java/io/openmessaging
4 files changed +37
-6
lines changed Original file line number Diff line number Diff line change 32
32
* @since OMS 1.0.0
33
33
*/
34
34
public interface Future <V > {
35
+ /**
36
+ * Attempts to cancel execution of this task. This attempt will
37
+ * fail if the task has already completed, has already been cancelled,
38
+ * or could not be cancelled for some other reason. If successful,
39
+ * and this task has not started when {@code cancel} is called,
40
+ * this task should never run. If the task has already started,
41
+ * then the {@code mayInterruptIfRunning} parameter determines
42
+ * whether the thread executing this task should be interrupted in
43
+ * an attempt to stop the task.
44
+ *
45
+ * <p>After this method returns, subsequent calls to {@link #isDone} will
46
+ * always return {@code true}. Subsequent calls to {@link #isCancelled}
47
+ * will always return {@code true} if this method returned {@code true}.
48
+ *
49
+ * @param mayInterruptIfRunning {@code true} if the thread executing this
50
+ * task should be interrupted; otherwise, in-progress tasks are allowed
51
+ * to complete
52
+ * @return {@code false} if the task could not be cancelled,
53
+ * typically because it has already completed normally;
54
+ * {@code true} otherwise
55
+ */
56
+ boolean cancel (boolean mayInterruptIfRunning );
57
+
35
58
/**
36
59
* Returns {@code true} if this task was cancelled before it completed normally.
37
60
*
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public interface KeyValue {
83
83
* @return the value in this {@code KeyValue} object with the specified key value
84
84
* @see #put(String, short)
85
85
*/
86
- int getShort (String key );
86
+ short getShort (String key );
87
87
88
88
/**
89
89
* Searches for the {@code short} property with the specified key in this {@code KeyValue} object. If the key is not
@@ -94,7 +94,7 @@ public interface KeyValue {
94
94
* @return the value in this {@code KeyValue} object with the specified key value
95
95
* @see #put(String, short)
96
96
*/
97
- int getShort (String key , short defaultValue );
97
+ short getShort (String key , short defaultValue );
98
98
99
99
/**
100
100
* Searches for the {@code int} property with the specified key in this {@code KeyValue} object. If the key is not
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ public interface OMSBuiltinKeys {
41
41
*/
42
42
String ACCOUNT_ID = "ACCOUNT_ID" ;
43
43
44
+ /**
45
+ * The {@code ACCOUNT_KEY} key shows the specified account key in OMS attribute.
46
+ */
47
+ String ACCOUNT_KEY = "ACCOUNT_KEY" ;
48
+
44
49
/**
45
50
* The {@code REGION} key shows the specified region in OMS driver schema.
46
51
*/
Original file line number Diff line number Diff line change @@ -32,13 +32,16 @@ public class DefaultKeyValue implements KeyValue {
32
32
private Map <String , String > properties ;
33
33
34
34
@ Override
35
- public int getShort (String key ) {
36
- return 0 ;
35
+ public short getShort (String key ) {
36
+ if (!properties .containsKey (key )) {
37
+ return 0 ;
38
+ }
39
+ return Short .valueOf (properties .get (key ));
37
40
}
38
41
39
42
@ Override
40
- public int getShort (String key , short defaultValue ) {
41
- return 0 ;
43
+ public short getShort (String key , short defaultValue ) {
44
+ return properties . containsKey ( key ) ? getShort ( key ) : defaultValue ;
42
45
}
43
46
44
47
@ Override
You can’t perform that action at this time.
0 commit comments