Hopefully fix a rare concurrency issue in buffer Builder
This commit is contained in:
+6
@@ -163,6 +163,12 @@ public class ColumnRenderBufferBuilder
|
||||
// get adjacent render data columns //
|
||||
//==================================//
|
||||
|
||||
// clear the old data so we can handle if one of the adjacent columns is missing/empty
|
||||
adjColumnViews[EDhDirection.NORTH.compassIndex].clear();
|
||||
adjColumnViews[EDhDirection.SOUTH.compassIndex].clear();
|
||||
adjColumnViews[EDhDirection.EAST.compassIndex].clear();
|
||||
adjColumnViews[EDhDirection.WEST.compassIndex].clear();
|
||||
|
||||
for (EDhDirection direction : EDhDirection.CARDINAL_COMPASS)
|
||||
{
|
||||
try
|
||||
|
||||
+9
-1
@@ -111,6 +111,14 @@ public final class ColumnRenderView implements AutoCloseable
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
this.data = null;
|
||||
this.size = 0;
|
||||
this.offset = 0;
|
||||
this.maxVerticalSliceCount = 0;
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
@@ -131,7 +139,7 @@ public final class ColumnRenderView implements AutoCloseable
|
||||
// we can fairly confidently say this is a concurrent exception over an actual
|
||||
// index out of bounds, since we're generally iterating over the whole
|
||||
// array any time we use this getter.
|
||||
throw new ConcurrentModificationException("Potential concurrent modification detected. Make sure the parent ColumnRenderSource isn't being closed before the ColumnArrayView processing is complete.", e);
|
||||
throw new ConcurrentModificationException("Potential concurrent modification detected. Make sure the parent ColumnRenderSource isn't being closed before the ColumnRenderView processing is complete.", e);
|
||||
}
|
||||
}
|
||||
public void set(int index, long value) { this.data.set(index + this.offset, value); }
|
||||
|
||||
+4
-2
@@ -325,9 +325,11 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
|
||||
{
|
||||
if (!this.bufferUploadFutureRef.compareAndSet(future, null)
|
||||
// if the old future is canceled then the future ref will be different and that's expected
|
||||
&& !future.isCancelled())
|
||||
&& !future.isCancelled()
|
||||
// if the old future is already done, then we don't care about the ref being swapped
|
||||
&& !future.isDone())
|
||||
{
|
||||
LOGGER.error("Buffer upload future ref changed for pos: ["+DhSectionPos.toString(this.pos)+"].");
|
||||
LOGGER.warn("Buffer upload future ref changed for pos: ["+DhSectionPos.toString(this.pos)+"].");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user