Skip to content

Commit

Permalink
#109: fixed. (#110)
Browse files Browse the repository at this point in the history
* #109: fixed.

* #109: White space
  • Loading branch information
PaulRambags authored and kalaspuffar committed Aug 23, 2019
1 parent ec0fb17 commit cc5077c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/org/daisy/dotify/formatter/impl/search/BlockAddress.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.daisy.dotify.formatter.impl.search;

public final class BlockAddress {
private final static Object NEXT_GROUP_NUMBER_SYNCHRONIZER = new Object();

private static long nextGroupNumber = 0;
private final long groupNumber;
private final int blockNumber;
Expand All @@ -10,9 +12,13 @@ public BlockAddress(long groupNumber, int blockNumber) {
this.blockNumber = blockNumber;
}

public static synchronized long getNextGroupNumber() {
nextGroupNumber++;
return nextGroupNumber;
public static long getNextGroupNumber() {
long ngs;
synchronized (NEXT_GROUP_NUMBER_SYNCHRONIZER) {
nextGroupNumber++;
ngs = nextGroupNumber;
}
return ngs;
}

public long getGroupNumber() {
Expand Down

0 comments on commit cc5077c

Please sign in to comment.