blob: 556774e03686d861fe8883439054f2b11def714c [file] [log] [blame]
Madan Jampani7e55c662016-02-15 21:13:53 -08001/*
2 * Copyright 2016 Open Networking Laboratory
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 */
16package org.onosproject.store.primitives.impl;
17
18import org.onosproject.store.primitives.DistributedPrimitiveCreator;
19import org.onosproject.store.service.AsyncAtomicCounter;
20import org.onosproject.store.service.AtomicCounterBuilder;
21
22/**
23 * Default implementation of AtomicCounterBuilder.
24 */
25public class NewDefaultAtomicCounterBuilder extends AtomicCounterBuilder {
26
Madan Jampani931e97d2016-02-26 12:20:44 -080027 private final DistributedPrimitiveCreator primitiveCreator;
Madan Jampani7e55c662016-02-15 21:13:53 -080028
Madan Jampani931e97d2016-02-26 12:20:44 -080029 public NewDefaultAtomicCounterBuilder(DistributedPrimitiveCreator primitiveCreator) {
30 this.primitiveCreator = primitiveCreator;
Madan Jampani7e55c662016-02-15 21:13:53 -080031 }
32
33 @Override
34 public AsyncAtomicCounter build() {
Madan Jampani931e97d2016-02-26 12:20:44 -080035 return primitiveCreator.newAsyncCounter(name());
Madan Jampani7e55c662016-02-15 21:13:53 -080036 }
37}