org.chromium.sdk/src/org/chromium/sdk/internal/tools/v8/request/SeqGenerator.java
equal
deleted
inserted
replaced
|
1 // Copyright 2009 Google Inc. All Rights Reserved. |
|
2 |
|
3 package org.chromium.sdk.internal.tools.v8.request; |
|
4 |
|
5 import java.util.concurrent.atomic.AtomicInteger; |
|
6 |
|
7 /** |
|
8 * A singleton that keeps track of the "seq" values for them to be unique across |
|
9 * the plugin lifecycle. |
|
10 */ |
|
11 public class SeqGenerator { |
|
12 |
|
13 private static SeqGenerator INSTANCE = new SeqGenerator(); |
|
14 |
|
15 private final AtomicInteger count = new AtomicInteger(1); |
|
16 |
|
17 public static SeqGenerator getInstance() { |
|
18 return INSTANCE; |
|
19 } |
|
20 |
|
21 public int next() { |
|
22 return count.getAndIncrement(); |
|
23 } |
|
24 |
|
25 private SeqGenerator() { |
|
26 // not instantiable outside |
|
27 } |
|
28 } |