fixed a thread problem

This commit is contained in:
Leonardo
2021-09-21 16:30:53 +02:00
parent e3df6c99da
commit 8228a3b7a6
3 changed files with 19 additions and 8 deletions
@@ -13,6 +13,7 @@ public class ThreadMapUtil
public static final ConcurrentMap<String, short[]> projectionShortMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, short[]> heightAndDepthMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[]> singleDataToMergeMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[][]> verticalUpdate = new ConcurrentHashMap<>();
public static long[] getSingleUpdateArray()
{
@@ -85,6 +86,19 @@ public class ThreadMapUtil
return saveContainer.get(Thread.currentThread().getName());
}
public static long[] getVerticalUpdateArray(byte detailLevel,int size){
if(!verticalUpdate.containsKey(Thread.currentThread().getName()) || (verticalUpdate.get(Thread.currentThread().getName()) == null) || (verticalUpdate.get(Thread.currentThread().getName())[detailLevel].length != size))
{
long[][] array = new long[10][];
for(int i = 0; i < array.length; i++)
{
array[i] = new long[4 * size];
}
verticalUpdate.put(Thread.currentThread().getName(), array);
}
return verticalUpdate.get(Thread.currentThread().getName())[detailLevel];
}
public static long[] getSingleAddDataToMerge(int size){
if(!singleDataToMergeMap.containsKey(Thread.currentThread().getName()) || (singleDataToMergeMap.get(Thread.currentThread().getName()) == null) || (singleDataToMergeMap.get(Thread.currentThread().getName()).length != size))
{