Lines 602-614
public abstract class IndexWriter
Link Here
|
602 |
|
602 |
|
603 |
public int get(int index) |
603 |
public int get(int index) |
604 |
{ |
604 |
{ |
|
|
605 |
// writes should not happen concurrently with get, else values might not be read atomically |
605 |
ArrayIntCompressed array = getPage(index / pageSize); |
606 |
ArrayIntCompressed array = getPage(index / pageSize); |
606 |
|
607 |
return array.get(index % pageSize); |
607 |
// TODO unlock this by having ArrayIntCompressed use atomics |
|
|
608 |
// we currently lock a whole page, when we only need a single element |
609 |
synchronized(array) { |
610 |
return array.get(index % pageSize); |
611 |
} |
612 |
} |
608 |
} |
613 |
|
609 |
|
614 |
public void close() throws IOException |
610 |
public void close() throws IOException |