Improved jmx

This commit is contained in:
Willem Cazander 2022-10-15 14:12:04 +02:00
parent 3109be3060
commit 5efc789b49
5 changed files with 48 additions and 28 deletions

View file

@ -53,7 +53,7 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
static <Y extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() { static <Y extends BãßBȍőnCoffinStoreKeyʸᴰ> BãßBȍőnCoffinOpenʸᴰ<Y> newInstance() {
return new BãßBȍőnCoffinOpenʸᴰ<Y>() { return new BãßBȍőnCoffinOpenʸᴰ<Y>() {
private final Map<Y,Object> initMap = new HashMap<>(); private final Map<Y,Object> corpseParts = new HashMap<>();
private final Map<Class<?>,BãßBȍőnFamilyGrave> familyGrave = new HashMap<>(); private final Map<Class<?>,BãßBȍőnFamilyGrave> familyGrave = new HashMap<>();
private volatile boolean deathLock = false; private volatile boolean deathLock = false;
@ -68,15 +68,15 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
@Override @Override
public Object GET_OBJ(Y key) { public Object GET_OBJ(Y key) {
return initMap.get(key); return corpseParts.get(key);
} }
@Override @Override
public Object PUT_OBJ(Y key, Object value) { public Object PUT_OBJ(Y key, Object value) {
if (deathLock) { if (deathLock) {
throw new IllegalStateException("Can't cheat death in closed coffin."); throw new IllegalStateException("Can't put body parts in closed coffin.");
} }
return initMap.put(key, value); return corpseParts.put(key, value);
} }
@Override @Override
@ -102,8 +102,7 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
return (BãßBȍőnCoffinʸᴰ<Y>) Proxy.newProxyInstance(cl, new Class[]{BãßBȍőnCoffinʸᴰ.class}, new InvocationHandler() { return (BãßBȍőnCoffinʸᴰ<Y>) Proxy.newProxyInstance(cl, new Class[]{BãßBȍőnCoffinʸᴰ.class}, new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Method localMethod = local.getClass().getMethod(method.getName(), method.getParameterTypes()); Method localMethod = local.getClass().getMethod(method.getName(), method.getParameterTypes());
Object result = localMethod.invoke(local, args); return localMethod.invoke(local, args);
return result;
} }
}); });
*/ */

View file

@ -0,0 +1,25 @@
package love.distributedrebirth.bassboonyd.jmx;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthor注;
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
@MBeanAttributeType注(Long.class)
public class AttributeLongᴶᴹˣ extends AbstractMBeanAttributeᴶᴹˣ {
private Long value;
public AttributeLongᴶᴹˣ(String name, String description) {
super(name, description);
}
public void setValueLong(Long value) {
this.value = value;
}
public Long getValueLong() {
return value;
}
public Object getValue() {
return value;
}
}

View file

@ -13,42 +13,44 @@ import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthor注;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnName注; import love.distributedrebirth.bassboonyd.info.BãßBȍőnName注;
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
@BãßBȍőnAnnotation注(required = {BãßBȍőnName注.class, BãßBȍőnAuthor注.class}) @BãßBȍőnAnnotation注(required = {BãßBȍőnName注.class})
public interface DefaultEnumBaseᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseʸᴰ<T,K> { public interface DefaultEnumBaseᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseʸᴰ<T,K> {
public static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª { public static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª {
private static final String GHOST_KEY_JMX = "JMX"; private static final String GHOST_KEY_JMX = "JMX";
private static <X> X buildJmxGhost(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, X result) {
boon.toBBC().UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX).put(name, result);
return result;
}
@BãßBȍőnSpiderEgg注() @BãßBȍőnSpiderEgg注()
private static CounterGuageᴶᴹˣ buildGuageCounter(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) { private static CounterGuageᴶᴹˣ buildGuageCounter(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
CounterGuageᴶᴹˣ result = new CounterGuageᴶᴹˣ(name, description); return buildJmxGhost(boon, name, new CounterGuageᴶᴹˣ(name, description));
boon.toBBC().UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX).put(name, result);
return result;
} }
@BãßBȍőnSpiderEgg注() @BãßBȍőnSpiderEgg注()
private static AttributeStringᴶᴹˣ buildStringAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) { private static AttributeStringᴶᴹˣ buildStringAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
AttributeStringᴶᴹˣ result = new AttributeStringᴶᴹˣ(name, description); return buildJmxGhost(boon, name, new AttributeStringᴶᴹˣ(name, description));
boon.toBBC().UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX).put(name, result);
return result;
} }
@BãßBȍőnSpiderEgg注() @BãßBȍőnSpiderEgg注()
private static AttributeBooleanᴶᴹˣ buildBooleanAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) { private static AttributeBooleanᴶᴹˣ buildBooleanAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
AttributeBooleanᴶᴹˣ result = new AttributeBooleanᴶᴹˣ(name, description); return buildJmxGhost(boon, name, new AttributeBooleanᴶᴹˣ(name, description));
boon.toBBC().UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX).put(name, result);
return result;
} }
@BãßBȍőnSpiderEgg注() @BãßBȍőnSpiderEgg注()
private static AttributeIntegerᴶᴹˣ buildIntegerAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) { private static AttributeIntegerᴶᴹˣ buildIntegerAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
AttributeIntegerᴶᴹˣ result = new AttributeIntegerᴶᴹˣ(name, description); return buildJmxGhost(boon, name, new AttributeIntegerᴶᴹˣ(name, description));
boon.toBBC().UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX).put(name, result); }
return result;
@BãßBȍőnSpiderEgg注()
private static AttributeLongᴶᴹˣ buildLongAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
return buildJmxGhost(boon, name, new AttributeLongᴶᴹˣ(name, description));
} }
} }
public static Map<String, Object> GHOST_MAP(BãßBȍőnCoffinʸᴰ<?> BBC) { public static Map<String, Object> jmxGhosts(BãßBȍőnCoffinʸᴰ<?> BBC) {
Map<String, Object> result = BBC.UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX); Map<String, Object> result = BBC.UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX);
if (result == null) { if (result == null) {
result = new HashMap<>(); result = new HashMap<>();

View file

@ -11,12 +11,9 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿª₮ḕ;
import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿªḕInitPhaseʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿªḕInitPhaseʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿªḕInit注; import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿªḕInit注;
import love.distributedrebirth.bassboonyd.DefaultEnumInstanceʸᴰ; import love.distributedrebirth.bassboonyd.DefaultEnumInstanceʸᴰ;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAnnotation注;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthor注; import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthor注;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnName注;
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
@BãßBȍőnAnnotation注(required = {BãßBȍőnName注.class, BãßBȍőnAuthor注.class})
public interface DefaultEnumInstanceᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseᴶᴹˣ<T,K>,DefaultEnumInstanceʸᴰ<T,K> { public interface DefaultEnumInstanceᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseᴶᴹˣ<T,K>,DefaultEnumInstanceʸᴰ<T,K> {
public static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª { public static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª {
@ -33,7 +30,7 @@ public interface DefaultEnumInstanceᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreK
MBeanServer server = ManagementFactory.getPlatformMBeanServer(); MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName objectName1 = new ObjectName(name.toString()); ObjectName objectName1 = new ObjectName(name.toString());
server.registerMBean(new MBeanDynamicᴶᴹˣ(boon.BãßClassPurpose(), DefaultEnumBaseᴶᴹˣ.GHOST_MAP(boon.toBBC())), objectName1); server.registerMBean(new MBeanDynamicᴶᴹˣ(boon.BãßClassPurpose(), DefaultEnumBaseᴶᴹˣ.jmxGhosts(boon.toBBC())), objectName1);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View file

@ -11,12 +11,9 @@ import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿª₮ḕ;
import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿªḕInitPhaseʸᴰ; import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿªḕInitPhaseʸᴰ;
import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿªḕInit注; import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿªḕInit注;
import love.distributedrebirth.bassboonyd.DefaultEnumSetʸᴰ; import love.distributedrebirth.bassboonyd.DefaultEnumSetʸᴰ;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAnnotation注;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthor注; import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthor注;
import love.distributedrebirth.bassboonyd.info.BãßBȍőnName注;
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
@BãßBȍőnAnnotation注(required = {BãßBȍőnName注.class, BãßBȍőnAuthor注.class})
public interface DefaultEnumSetᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseᴶᴹˣ<T,K>,DefaultEnumSetʸᴰ<T,K> { public interface DefaultEnumSetᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends DefaultEnumBaseᴶᴹˣ<T,K>,DefaultEnumSetʸᴰ<T,K> {
public static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª { public static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª {
@ -37,7 +34,7 @@ public interface DefaultEnumSetᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸ
MBeanServer server = ManagementFactory.getPlatformMBeanServer(); MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ObjectName objectName1 = new ObjectName(name.toString()); ObjectName objectName1 = new ObjectName(name.toString());
server.registerMBean(new MBeanDynamicᴶᴹˣ(boon.BãßClassPurpose(), DefaultEnumBaseᴶᴹˣ.GHOST_MAP(boon.toBBC())), objectName1); server.registerMBean(new MBeanDynamicᴶᴹˣ(boon.BãßClassPurpose(), DefaultEnumBaseᴶᴹˣ.jmxGhosts(boon.toBBC())), objectName1);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }