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() {
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 volatile boolean deathLock = false;
@ -68,15 +68,15 @@ public interface BãßBȍőnCoffinOpenʸᴰ<T extends BãßBȍőnCoffinStoreKey
@Override
public Object GET_OBJ(Y key) {
return initMap.get(key);
return corpseParts.get(key);
}
@Override
public Object PUT_OBJ(Y key, Object value) {
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
@ -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() {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Method localMethod = local.getClass().getMethod(method.getName(), method.getParameterTypes());
Object result = localMethod.invoke(local, args);
return result;
return localMethod.invoke(local, args);
}
});
*/

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注;
@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 static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª {
private static final String GHOST_KEY_JMX = "JMX";
@BãßBȍőnSpiderEgg注()
private static CounterGuageᴶᴹˣ buildGuageCounter(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
CounterGuageᴶᴹˣ result = new CounterGuageᴶᴹˣ(name, description);
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注()
private static CounterGuageᴶᴹˣ buildGuageCounter(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
return buildJmxGhost(boon, name, new CounterGuageᴶᴹˣ(name, description));
}
@BãßBȍőnSpiderEgg注()
private static AttributeStringᴶᴹˣ buildStringAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
AttributeStringᴶᴹˣ result = new AttributeStringᴶᴹˣ(name, description);
boon.toBBC().UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX).put(name, result);
return result;
return buildJmxGhost(boon, name, new AttributeStringᴶᴹˣ(name, description));
}
@BãßBȍőnSpiderEgg注()
private static AttributeBooleanᴶᴹˣ buildBooleanAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
AttributeBooleanᴶᴹˣ result = new AttributeBooleanᴶᴹˣ(name, description);
boon.toBBC().UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX).put(name, result);
return result;
return buildJmxGhost(boon, name, new AttributeBooleanᴶᴹˣ(name, description));
}
@BãßBȍőnSpiderEgg注()
private static AttributeIntegerᴶᴹˣ buildIntegerAttribute(DefaultEnumBaseᴶᴹˣ<?,?> boon, String name, String description) {
AttributeIntegerᴶᴹˣ result = new AttributeIntegerᴶᴹˣ(name, description);
boon.toBBC().UNHOLY(Ꝑŕḯṿª.class).GHOST_MAP_OBJ(Ꝑŕḯṿª.GHOST_KEY_JMX).put(name, result);
return result;
return buildJmxGhost(boon, name, new AttributeIntegerᴶᴹˣ(name, description));
}
@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);
if (result == null) {
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ꝐŕḯṿªḕInit注;
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ȍőnName注;
@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 static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª {
@ -33,7 +30,7 @@ public interface DefaultEnumInstanceᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreK
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
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) {
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ꝐŕḯṿªḕInit注;
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ȍőnName注;
@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 static class Ꝑŕḯṿª implements BãßBȍőnꝐŕḯṿª {
@ -37,7 +34,7 @@ public interface DefaultEnumSetᴶᴹˣ<T,K extends BãßBȍőnCoffinStoreKeyʸ
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
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) {
throw new RuntimeException(e);
}