From eaa8f6480370d05adcded349794ee4fbd2f69d90 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 4 Nov 2019 18:12:29 +0000 Subject: [PATCH] Changed synchronization method for getAi. --- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- .../org/l2jmobius/gameserver/model/actor/Creature.java | 10 ++++++++-- 18 files changed, 144 insertions(+), 36 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java index 7b3f8473a3..e4c365aa08 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java index 7b3f8473a3..e4c365aa08 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java index 4956b9f796..76f3957286 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java index 4956b9f796..76f3957286 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java index 4956b9f796..76f3957286 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java index 4956b9f796..76f3957286 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java index 4956b9f796..76f3957286 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java index 38af7c27b4..f842050266 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index 9581199f7b..48bd4e1ca5 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2243,12 +2243,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = new CreatureAI(new AIAccessor()); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = new CreatureAI(new AIAccessor()); + } + } } return ai; } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java index 8f0c1bdecb..0e17a28368 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2498,12 +2498,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java index 2555570268..8a5d5e9960 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2500,12 +2500,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java index ccb26ecf79..c0417c341a 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1741,12 +1741,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java index ccb26ecf79..c0417c341a 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1741,12 +1741,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java index ccb26ecf79..c0417c341a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1741,12 +1741,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java index f85455fe5b..2ddb69e672 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java index f85455fe5b..2ddb69e672 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java index f31b7318e8..7ebf2bb930 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1742,12 +1742,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index ccb26ecf79..c0417c341a 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1741,12 +1741,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe * Gets this creature's AI. * @return the AI */ - public synchronized CreatureAI getAI() + public CreatureAI getAI() { CreatureAI ai = _ai; if (ai == null) { - _ai = ai = initAI(); + synchronized (this) + { + if (_ai == null) + { + _ai = ai = initAI(); + } + } } return ai; }