From e41405f019c64c132d9bcbe135493f50ec4d3949 Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 17 Oct 2022 20:12:36 +0200 Subject: [PATCH] made grave yard private --- .../distributedrebirth/bassboonyd/Bãß.java | 31 ++++++++++++++++--- .../bassboonyd/BãßBȍőnCoffinNail.java | 2 +- .../bassboonyd/BãßBȍőnʸᴰ.java | 23 +------------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/Bãß.java b/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/Bãß.java index 2a248a57..c06c6add 100644 --- a/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/Bãß.java +++ b/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/Bãß.java @@ -14,18 +14,18 @@ import love.distributedrebirth.bassboonyd.sinit.BãßBȍőnꝐŕḯṿª₮ḕ; public interface Bãß { public static final class Ꝑŕḯṿª₮ḕ implements BãßBȍőnꝐŕḯṿª₮ḕ { - protected static final Map> GRAVE_YARD = new WeakHashMap<>(); // TODO: test bean gc - protected static final ReadWriteLock FUNERAL = new ReentrantReadWriteLock(); + private static final Map> GRAVE_YARD = new WeakHashMap<>(); // TODO: test bean gc + private static final ReadWriteLock FUNERAL = new ReentrantReadWriteLock(); private Ꝑŕḯṿª₮ḕ() { } @SafeVarargs - public static void 仙ᴵᴺᴵᵀ(BãßBȍőnʸᴰ boon, Consumer>...coffinFillers) { + public static final void 仙ᴵᴺᴵᵀ(BãßBȍőnʸᴰ boon, Consumer>...coffinFillers) { BãßBȍőnPhaseLoader.CAST_BONE_MAGIC(boon, coffinFillers); } - public static void 鎖ᴳᴿᴬⱽᴱ(BãßBȍőnʸᴰ boon) { + public static final void 鎖ᴳᴿᴬⱽᴱ(BãßBȍőnʸᴰ boon) { BãßBȍőnCoffin coffin = (BãßBȍőnCoffin)boon.toBBC(); if (!(coffin instanceof BãßBȍőnCoffinOpen)) { return; // already closed @@ -51,6 +51,29 @@ public interface Bãß { // throw new RuntimeException(e); // } // } + + @SuppressWarnings("unchecked") + protected static final BãßBȍőnCoffin 殭屍ᴼᶠ(BãßBȍőnʸᴰ boon) { + BãßBȍőnCoffin zombieCoffin = null; + Lock bibleReader = Bãß.Ꝑŕḯṿª₮ḕ.FUNERAL.readLock(); // Can't force enum only, thus no jvm safety + bibleReader.lock(); + try { + zombieCoffin = (BãßBȍőnCoffin) Bãß.Ꝑŕḯṿª₮ḕ.GRAVE_YARD.get(boon.toBBCHeadStoneʸᴰ()); + } finally { + bibleReader.unlock(); + } + if (zombieCoffin == null) { + Lock shemiraWriter = Bãß.Ꝑŕḯṿª₮ḕ.FUNERAL.writeLock(); + shemiraWriter.lock(); + try { + zombieCoffin = BãßBȍőnCoffinOpen.newInstance(); + Bãß.Ꝑŕḯṿª₮ḕ.GRAVE_YARD.put(boon.toBBCHeadStoneʸᴰ(), zombieCoffin); + } finally { + shemiraWriter.unlock(); + } + } + return zombieCoffin; + } } public static final class Cỗᶇṧⱦᶏꬼȶʂ { diff --git a/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/BãßBȍőnCoffinNail.java b/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/BãßBȍőnCoffinNail.java index 5cc522a1..b70ee0d5 100644 --- a/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/BãßBȍőnCoffinNail.java +++ b/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/BãßBȍőnCoffinNail.java @@ -7,7 +7,7 @@ public interface BãßBȍőnCoffinNail { String name(); - static final class None implements BãßBȍőnCoffinNail { + public static final class None implements BãßBȍőnCoffinNail { @Override public String name() { diff --git a/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/BãßBȍőnʸᴰ.java b/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/BãßBȍőnʸᴰ.java index 7b8fde59..5aaa142e 100644 --- a/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/BãßBȍőnʸᴰ.java +++ b/gdxapp4d-lib-bassboonyd/src/main/java/love/distributedrebirth/bassboonyd/BãßBȍőnʸᴰ.java @@ -1,7 +1,5 @@ package love.distributedrebirth.bassboonyd; -import java.util.concurrent.locks.Lock; - import love.distributedrebirth.bassboonyd.clazz.BãßBȍőnAuthor注; @BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @@ -12,26 +10,7 @@ public interface BãßBȍőnʸᴰ { return (T) this; } - @SuppressWarnings("unchecked") default BãßBȍőnCoffin toBBC() { - BãßBȍőnCoffin zombieCoffin = null; - Lock bibleReader = Bãß.Ꝑŕḯṿª₮ḕ.FUNERAL.readLock(); // Can't force enum only, thus no jvm safety - bibleReader.lock(); - try { - zombieCoffin = (BãßBȍőnCoffin) Bãß.Ꝑŕḯṿª₮ḕ.GRAVE_YARD.get(toBBCHeadStoneʸᴰ()); - } finally { - bibleReader.unlock(); - } - if (zombieCoffin == null) { - Lock shemiraWriter = Bãß.Ꝑŕḯṿª₮ḕ.FUNERAL.writeLock(); - shemiraWriter.lock(); - try { - zombieCoffin = BãßBȍőnCoffinOpen.newInstance(); - Bãß.Ꝑŕḯṿª₮ḕ.GRAVE_YARD.put(toBBCHeadStoneʸᴰ(), zombieCoffin); - } finally { - shemiraWriter.unlock(); - } - } - return zombieCoffin; + return Bãß.Ꝑŕḯṿª₮ḕ.殭屍ᴼᶠ(this); } }