Skip to content

Commit

Permalink
Fixed phragmite markup.
Browse files Browse the repository at this point in the history
  • Loading branch information
larsgeorge committed Jun 8, 2015
1 parent 4dc96bf commit d01d49c
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public class SequentialIdGeneratorObserver extends BaseRegionObserver {
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
Configuration conf = env.getConfiguration(); // co-SequentialIdGeneratorObserver-1-Conf Get environment and configuration instances.
Configuration conf = env.getConfiguration(); // co SequentialIdGeneratorObserver-1-Conf Get environment and configuration instances.
this.regionName = env.getRegionInfo().getEncodedName();
String family = conf.get("com.larsgeorge.copro.seqidgen.family", "cf1");
this.family = Bytes.toBytes(family);
String qualifier = conf.get("com.larsgeorge.copro.seqidgen.qualifier", // co-SequentialIdGeneratorObserver-2-Settings Retrieve the settings passed into the configuration.
String qualifier = conf.get("com.larsgeorge.copro.seqidgen.qualifier", // co SequentialIdGeneratorObserver-2-Settings Retrieve the settings passed into the configuration.
"GENID");
this.qualifier = Bytes.toBytes(qualifier);
int startId = conf.getInt("com.larsgeorge.copro.seqidgen.startId", 1);
this.delay = conf.getInt("com.larsgeorge.copro.seqidgen.delay", 100);
env.getSharedData().putIfAbsent(KEY_ID, new AtomicInteger(startId)); // co-SequentialIdGeneratorObserver-3-Gen Set up generator if this has not been done yet on this region server.
env.getSharedData().putIfAbsent(KEY_ID, new AtomicInteger(startId)); // co SequentialIdGeneratorObserver-3-Gen Set up generator if this has not been done yet on this region server.
} else {
LOG.warn("Received wrong context.");
}
Expand All @@ -54,7 +54,7 @@ public void stop(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
AtomicInteger id = (AtomicInteger) env.getSharedData().get(KEY_ID);
LOG.info("Final ID issued: " + regionName + "-" + id.get()); // co-SequentialIdGeneratorObserver-4-Log Log the final number generated by this coprocessor.
LOG.info("Final ID issued: " + regionName + "-" + id.get()); // co SequentialIdGeneratorObserver-4-Log Log the final number generated by this coprocessor.
} else {
LOG.warn("Received wrong context.");
}
Expand All @@ -65,11 +65,11 @@ public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put put,
WALEdit edit, Durability durability) throws IOException {
RegionCoprocessorEnvironment env = e.getEnvironment();
AtomicInteger id = (AtomicInteger) env.getSharedData().get(KEY_ID);
put.addColumn(family, qualifier, Bytes.toBytes(regionName + "-" + // co-SequentialIdGeneratorObserver-5-SetId Set the shared ID for this instance of put.
put.addColumn(family, qualifier, Bytes.toBytes(regionName + "-" + // co SequentialIdGeneratorObserver-5-SetId Set the shared ID for this instance of put.
id.incrementAndGet()));

try {
Thread.sleep(rnd.nextInt(delay)); // co-SequentialIdGeneratorObserver-6-Sleep Sleep for 0 to "delay" milliseconds.
Thread.sleep(rnd.nextInt(delay)); // co SequentialIdGeneratorObserver-6-Sleep Sleep for 0 to "delay" milliseconds.
} catch (InterruptedException e1) {
e1.printStackTrace();
}
Expand Down

0 comments on commit d01d49c

Please sign in to comment.