Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface Service {
- CompletableFuture<ResponseCar> getResponseOfApple(String url, UUID id);
- CompletableFuture<ResponsePear> getResponseOfPear(String url, UUID id);
- }
- @RequiredArgsConstructor
- public class PrioritizedQueueElement extends Observable implements Comparable<PrioritizedQueueElement> {
- @NonNull
- @Getter
- private final Object argument;
- @Getter
- @Setter
- private Object returnValue;
- @NonNull
- @Getter
- private final QueueElementType priority;
- @Override
- public int compareTo(final PrioritizedQueueElement o) {
- if (o == null || this.priority == null || o.priority == null) {
- throw new NullPointerException("wrong value");
- }
- return this.priority.compareTo(o.priority);
- }
- public <T> T getValue() {
- return (T) this.returnValue;
- }
- public void setReturnValue(final Object value) {
- this.returnValue = value;
- this.setChanged();
- this.notifyObservers();
- }
- }
- public enum QueueElementType {
- ONE_TIME_HIGH_PRIORITY,
- ONE_TIME_LOW_PRIORITY,
- RECURRENT_HIGH_PRIORITY,
- RECURRENT_LOW_PRIORITY
- }
Add Comment
Please, Sign In to add comment