Polish
This commit is contained in:
@@ -111,6 +111,12 @@ public class ProcessInfo {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T invokeMethod(Class<?> mxbeanClass, Object mxbean, String name) throws ReflectiveOperationException {
|
||||
Method method = mxbeanClass.getMethod(name);
|
||||
return (T) method.invoke(mxbean);
|
||||
}
|
||||
|
||||
public long getPid() {
|
||||
return this.pid;
|
||||
}
|
||||
@@ -123,12 +129,6 @@ public class ProcessInfo {
|
||||
return this.owner;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T invokeMethod(Class<?> mxbeanClass, Object mxbean, String name) throws ReflectiveOperationException {
|
||||
Method method = mxbeanClass.getMethod(name);
|
||||
return (T) method.invoke(mxbean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Virtual threads information.
|
||||
*
|
||||
|
||||
@@ -495,8 +495,7 @@ public class LogbackLoggingSystem extends AbstractLoggingSystem implements BeanF
|
||||
FilteringStatusListener listener = new FilteringStatusListener(new OnErrorConsoleStatusListener(),
|
||||
Status.ERROR);
|
||||
listener.setContext(context);
|
||||
boolean effectivelyAdded = context.getStatusManager().add(listener);
|
||||
if (effectivelyAdded) {
|
||||
if (context.getStatusManager().add(listener)) {
|
||||
listener.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,10 +678,12 @@ class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
||||
assertThat(statusListener).hasFieldOrPropertyWithValue("levelThreshold", Status.ERROR);
|
||||
assertThat(statusListener).extracting("delegate").isInstanceOf(OnErrorConsoleStatusListener.class);
|
||||
AppenderBase<ILoggingEvent> appender = new AppenderBase<>() {
|
||||
|
||||
@Override
|
||||
protected void append(ILoggingEvent eventObject) {
|
||||
throw new IllegalStateException("Fail to append");
|
||||
}
|
||||
|
||||
};
|
||||
this.logger.addAppender(appender);
|
||||
appender.setContext(loggerContext);
|
||||
|
||||
Reference in New Issue
Block a user