blob: 8a1fe95eaa5a7b8ce4aac3d400abd8eeb5801557 [file] [log] [blame]
Madan Jampania090a112016-01-18 16:38:17 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Madan Jampania090a112016-01-18 16:38:17 -08003 *
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 */
16package org.onosproject.store.service;
17
Madan Jampanifa242182016-01-22 13:42:54 -080018import java.util.concurrent.CompletableFuture;
19
Madan Jampania090a112016-01-18 16:38:17 -080020/**
21 * DistributedPrimitive that is a synchronous (blocking) version of
22 * another.
23 *
24 * @param <T> type of DistributedPrimitive
25 */
26public 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 Jampani39fff102016-02-14 13:17:28 -080040 public Type primitiveType() {
41 return primitive.primitiveType();
Madan Jampania090a112016-01-18 16:38:17 -080042 }
Madan Jampanifa242182016-01-22 13:42:54 -080043
44 @Override
45 public CompletableFuture<Void> destroy() {
46 return primitive.destroy();
47 }
Madan Jampania090a112016-01-18 16:38:17 -080048}