Acquire lock when recalculate method starts.

This commit is contained in:
MobiusDevelopment
2020-06-20 21:13:26 +00:00
parent 4cf9b0de68
commit 0345ac05f6
15 changed files with 60 additions and 30 deletions

View File

@@ -891,7 +891,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -907,7 +907,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -891,7 +891,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -907,7 +907,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -891,7 +891,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -907,7 +907,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -891,7 +891,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -907,7 +907,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -891,7 +891,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -907,7 +907,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -891,7 +891,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -907,7 +907,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -891,7 +891,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -907,7 +907,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -891,7 +891,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -907,7 +907,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -881,7 +881,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -897,7 +897,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -881,7 +881,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -897,7 +897,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -881,7 +881,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -897,7 +897,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -881,7 +881,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -897,7 +897,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -881,7 +881,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -897,7 +897,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -881,7 +881,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -897,7 +897,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data

View File

@@ -881,7 +881,7 @@ public class CreatureStat
*/ */
public void recalculateStats(boolean broadcast) public void recalculateStats(boolean broadcast)
{ {
Set<Stat> changed = null; _lock.writeLock().lock();
// Copy old data before wiping it out // Copy old data before wiping it out
final Map<Stat, Double> adds; final Map<Stat, Double> adds;
@@ -897,7 +897,9 @@ public class CreatureStat
muls = null; muls = null;
} }
_lock.writeLock().lock(); // Set of Stat that changed.
Set<Stat> changed = null;
try try
{ {
// Wipe all the data // Wipe all the data