1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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  }