File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
core/src/main/java/network/aika Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -83,19 +83,25 @@ public long createNeuronId() {
8383 }
8484
8585 public Long getLowestDocumentId () {
86- try {
87- return documents .firstKey ();
88- } catch (NoSuchElementException e ) {
89- return null ;
86+ synchronized (documents ) {
87+ try {
88+ return documents .firstKey ();
89+ } catch (NoSuchElementException e ) {
90+ return null ;
91+ }
9092 }
9193 }
9294
9395 public void registerDocument (Document doc ) {
94- documents .put (doc .getId (), doc );
96+ synchronized (documents ) {
97+ documents .put (doc .getId (), doc );
98+ }
9599 }
96100
97101 public void deregisterDocument (Document doc ) {
98- documents .remove (doc .getId ());
102+ synchronized (documents ) {
103+ documents .remove (doc .getId ());
104+ }
99105
100106 lastProcessedDocument = Math .max (lastProcessedDocument , doc .getId ());
101107 }
You can’t perform that action at this time.
0 commit comments