| CounterRegister.java |
1 /**
2 * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 */
14
15 package com.liferay.counter.model;
16
17 import com.liferay.portal.kernel.concurrent.CompeteLatch;
18
19 /**
20 * <a href="CounterRegister.java.html"><b><i>View Source</i></b></a>
21 *
22 * @author Harry Mark
23 * @author Shuyang Zhou
24 */
25 public class CounterRegister {
26
27 public CounterRegister(
28 String name, long rangeMin, long rangeMax, int rangeSize) {
29
30 _name = name;
31 _rangeSize = rangeSize;
32 _holder = new CounterHolder(rangeMin, rangeMax);
33 _latch = new CompeteLatch();
34 }
35
36 public CompeteLatch getCompeteLatch() {
37 return _latch;
38 }
39
40 public CounterHolder getCounterHolder() {
41 return _holder;
42 }
43
44 public String getName() {
45 return _name;
46 }
47
48 public int getRangeSize() {
49 return _rangeSize;
50 }
51
52 public void setCounterHolder(CounterHolder holder) {
53 _holder = holder;
54 }
55
56 public void setName(String name) {
57 _name = name;
58 }
59
60 private volatile CounterHolder _holder;
61 private final CompeteLatch _latch;
62 private String _name;
63 private final int _rangeSize;
64
65 }