mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-12 03:24:14 +00:00
Updated Iris packaging
- Version is 4.1.2-26.2 across platform builds - Plugin builds use shared automatic jar selection - Native adapters remain bundled in selected artifacts - Plugin export tasks copy the selected artifact - The previous plugin packer is removed - The agent tracks primary storage closure during Spigot shutdown
This commit is contained in:
@@ -6,10 +6,28 @@ import java.io.IOException;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class Installer {
|
||||
private static volatile Instrumentation instrumentation;
|
||||
private static final Map<ClassLoader, Boolean> retainedClassLoaders = new IdentityHashMap<>();
|
||||
private static final Map<Object, AtomicBoolean> serverStorage = new IdentityHashMap<>();
|
||||
|
||||
public static synchronized AtomicBoolean trackServerStorage(Object storage) {
|
||||
return serverStorage.computeIfAbsent(Objects.requireNonNull(storage, "Server storage"),
|
||||
ignored -> new AtomicBoolean());
|
||||
}
|
||||
|
||||
public static synchronized void serverStorageClosed(Object storage) {
|
||||
AtomicBoolean closed = serverStorage.get(storage);
|
||||
if (closed != null) {
|
||||
closed.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void releaseServerStorage(Object storage) {
|
||||
serverStorage.remove(storage);
|
||||
}
|
||||
|
||||
public static synchronized void retainClassLoader(ClassLoader loader) {
|
||||
ClassLoader requiredLoader = Objects.requireNonNull(loader, "Plugin class loader");
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package art.arcane.iris.platform.agent;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class ServerStorageBoundaryTest {
|
||||
@Test
|
||||
public void closingEqualStorageDoesNotCompleteTrackedStorage() {
|
||||
Storage primary = new Storage(1);
|
||||
Storage other = new Storage(1);
|
||||
AtomicBoolean closed = Installer.trackServerStorage(primary);
|
||||
try {
|
||||
assertSame(closed, Installer.trackServerStorage(primary));
|
||||
Installer.serverStorageClosed(other);
|
||||
assertFalse(closed.get());
|
||||
Installer.serverStorageClosed(primary);
|
||||
assertTrue(closed.get());
|
||||
} finally {
|
||||
Installer.releaseServerStorage(primary);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void releasedStorageNoLongerReceivesCloseSignals() {
|
||||
Storage storage = new Storage(1);
|
||||
AtomicBoolean released = Installer.trackServerStorage(storage);
|
||||
Installer.releaseServerStorage(storage);
|
||||
Installer.serverStorageClosed(storage);
|
||||
assertFalse(released.get());
|
||||
AtomicBoolean current = Installer.trackServerStorage(storage);
|
||||
try {
|
||||
assertNotSame(released, current);
|
||||
Installer.serverStorageClosed(storage);
|
||||
assertTrue(current.get());
|
||||
assertFalse(released.get());
|
||||
} finally {
|
||||
Installer.releaseServerStorage(storage);
|
||||
}
|
||||
}
|
||||
|
||||
private record Storage(int value) {
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,9 @@ public class Agent {
|
||||
installer.getMethod("retainClassLoader", ClassLoader.class);
|
||||
installer.getMethod("deferClassLoaderClose", ClassLoader.class);
|
||||
installer.getMethod("releaseClassLoader", ClassLoader.class);
|
||||
installer.getMethod("trackServerStorage", Object.class);
|
||||
installer.getMethod("serverStorageClosed", Object.class);
|
||||
installer.getMethod("releaseServerStorage", Object.class);
|
||||
}
|
||||
|
||||
public static void retainClassLoader(ClassLoader loader) {
|
||||
|
||||
Reference in New Issue
Block a user