-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HWKMETRICS-648] add supporting for modifying and persisting job para…
…meters
- Loading branch information
John Sanda
committed
Apr 20, 2017
1 parent
149f49d
commit 8abb44c
Showing
15 changed files
with
587 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
job-scheduler/src/main/java/org/hawkular/metrics/scheduler/api/JobParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright 2014-2017 Red Hat, Inc. and/or its affiliates | ||
* and other contributors as indicated by the @author tags. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.hawkular.metrics.scheduler.api; | ||
|
||
import java.util.Map; | ||
|
||
import rx.Completable; | ||
|
||
/** | ||
* Provides a map-like key/value API for job parameters. The parameters are mutable. Changes will be persisted after | ||
* job execution completes (for repeating jobs). Changes can also be persisted during execution using the | ||
* {@link #save() save} method. | ||
* | ||
* @author jsanda | ||
*/ | ||
public interface JobParameters { | ||
|
||
/** | ||
* Return the value associated with the key or null if there is no such parameter | ||
*/ | ||
String get(String key); | ||
|
||
/** | ||
* Associates the value with the key and returns the old value if there previously was a mapping for the key | ||
*/ | ||
String put(String key, String value); | ||
|
||
/** | ||
* Removes the value associated with the key or null if there is no such parameter | ||
*/ | ||
String remove(String key); | ||
|
||
/** | ||
* Return true if the parameters contain a value for the key | ||
*/ | ||
boolean containsKey(String key); | ||
|
||
/** | ||
* Return an immutable map of the parameters. Note that this map is a copy. Any changes made to the parameters | ||
* through methods like {@link #get(String) get} or {@link #put(String, String) put} will not be reflected in | ||
* this map. | ||
*/ | ||
Map<String, String> getMap(); | ||
|
||
/** | ||
* Asynchronously save the parameters back to Cassandra. For reoccurring jobs any changes to parameters will | ||
* automatically be persisted when the job finishes and is rescheduled for its next run. This method can be useful | ||
* for long running jobs that perform a lot of work. It can be used to create checkpoints so that if a job is | ||
* abruptly stopped and restarted it can resume its work from that checkpoint rather than starting all over. | ||
*/ | ||
Completable save(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.