File tree Expand file tree Collapse file tree 4 files changed +37
-6
lines changed
openmessaging-api/src/main/java/io/openmessaging Expand file tree Collapse file tree 4 files changed +37
-6
lines changed Original file line number Diff line number Diff line change 3232 * @since OMS 1.0.0
3333 */
3434public 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+
3558 /**
3659 * Returns {@code true} if this task was cancelled before it completed normally.
3760 *
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ public interface KeyValue {
8383 * @return the value in this {@code KeyValue} object with the specified key value
8484 * @see #put(String, short)
8585 */
86- int getShort (String key );
86+ short getShort (String key );
8787
8888 /**
8989 * 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 {
9494 * @return the value in this {@code KeyValue} object with the specified key value
9595 * @see #put(String, short)
9696 */
97- int getShort (String key , short defaultValue );
97+ short getShort (String key , short defaultValue );
9898
9999 /**
100100 * 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 {
4141 */
4242 String ACCOUNT_ID = "ACCOUNT_ID" ;
4343
44+ /**
45+ * The {@code ACCOUNT_KEY} key shows the specified account key in OMS attribute.
46+ */
47+ String ACCOUNT_KEY = "ACCOUNT_KEY" ;
48+
4449 /**
4550 * The {@code REGION} key shows the specified region in OMS driver schema.
4651 */
Original file line number Diff line number Diff line change @@ -32,13 +32,16 @@ public class DefaultKeyValue implements KeyValue {
3232 private Map <String , String > properties ;
3333
3434 @ 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 ));
3740 }
3841
3942 @ 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 ;
4245 }
4346
4447 @ Override
You can’t perform that action at this time.
0 commit comments