Madan Jampani | a090a11 | 2016-01-18 16:38:17 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Madan Jampani | a090a11 | 2016-01-18 16:38:17 -0800 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.store.service; |
| 17 | |
Madan Jampani | fa24218 | 2016-01-22 13:42:54 -0800 | [diff] [blame] | 18 | import java.util.concurrent.CompletableFuture; |
| 19 | |
Madan Jampani | a090a11 | 2016-01-18 16:38:17 -0800 | [diff] [blame] | 20 | /** |
| 21 | * DistributedPrimitive that is a synchronous (blocking) version of |
| 22 | * another. |
| 23 | * |
| 24 | * @param <T> type of DistributedPrimitive |
| 25 | */ |
| 26 | public abstract class Synchronous<T extends DistributedPrimitive> implements DistributedPrimitive { |
| 27 | |
| 28 | private final T primitive; |
| 29 | |
| 30 | public Synchronous(T primitive) { |
| 31 | this.primitive = primitive; |
| 32 | } |
| 33 | |
| 34 | @Override |
| 35 | public String name() { |
| 36 | return primitive.name(); |
| 37 | } |
| 38 | |
| 39 | @Override |
Madan Jampani | 39fff10 | 2016-02-14 13:17:28 -0800 | [diff] [blame] | 40 | public Type primitiveType() { |
| 41 | return primitive.primitiveType(); |
Madan Jampani | a090a11 | 2016-01-18 16:38:17 -0800 | [diff] [blame] | 42 | } |
Madan Jampani | fa24218 | 2016-01-22 13:42:54 -0800 | [diff] [blame] | 43 | |
| 44 | @Override |
| 45 | public CompletableFuture<Void> destroy() { |
| 46 | return primitive.destroy(); |
| 47 | } |
Madan Jampani | a090a11 | 2016-01-18 16:38:17 -0800 | [diff] [blame] | 48 | } |