Package nl.vpro.jmx
Class MBeans
java.lang.Object
nl.vpro.jmx.MBeans
Utilities to start jmx tasks in the background.
- Since:
- 1.75
- Author:
- Michiel Meeuwissen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
A String supplier of one line. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static ObjectName
getObjectName
(String prefix, Object object) static ObjectName
getObjectNameWithName
(Object object, String name) static boolean
A 'visualvm' oriented check whether a string is 'blank'.static boolean
A 'visualvm' oriented check whether a string is 'empty'.static boolean
static nl.vpro.logging.simple.StringSupplierSimpleLogger
static nl.vpro.logging.simple.StringSupplierSimpleLogger
multiLine
(org.slf4j.Logger log) static nl.vpro.logging.simple.StringSupplierSimpleLogger
static ObjectName
registerBean
(Object object, String name) static <T> void
registerBean
(ObjectName name, T object) static String
returnMultilineString
(@NonNull org.slf4j.Logger log, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) static String
returnString
(@NonNull String key, @NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) Defaulting version ofreturnString(String, StringSupplierSimpleLogger, Duration, Consumer)
, with a durationDEFAULT_DURATION
static String
returnString
(@NonNull Supplier<String> description, @NonNull Duration wait, @NonNull Callable<String> job) Deprecated.static String
returnString
(@NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Duration wait, @NonNull Callable<String> job) Deprecated.static String
returnString
(@NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Duration wait, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) Defaulting version of {@link #returnString(String, StringSupplierSimpleLogger, Duration, Consumer)), with no key (meaning that jobs can be started concurrently.static String
returnString
(@NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Callable<String> job) Deprecated.static String
returnString
(@NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) Defaulting version of {@link #returnString(String, StringSupplierSimpleLogger, Duration, Consumer)), with no key (meaning that jobs can be started concurrently.static String
returnString
(@Nullable String key, @NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Duration wait, @NonNull Callable<String> job) Deprecated.static String
returnString
(@Nullable String key, @NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @Nullable Duration wait, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) static nl.vpro.logging.simple.StringSupplierSimpleLogger
singleLine
(org.slf4j.Logger log, String message, Object... args) static void
unregister
(ObjectName name)
-
Field Details
-
DEFAULT_DURATION
-
-
Constructor Details
-
MBeans
public MBeans()
-
-
Method Details
-
isRunning
-
cancel
-
returnString
public static String returnString(@Nullable String key, @NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @Nullable Duration wait, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) - Parameters:
key
- A key on which the job can be 'locked'.description
- A supplier that before the job starts should describe the job. One can be created using e.g.multiLine(Logger, String, Object...)
orsingleLine(Logger, String, Object...)
wait
- How long to wait before returning with a message that the job is not yet finished, but still running. This may benull
, in which case this will run nothing in the backgroundlogger
- A job returning a String when ready. This string will be returned.- Returns:
- The string to be used as a return value for a JMX operation
-
returnString
public static String returnString(@NonNull String key, @NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) Defaulting version ofreturnString(String, StringSupplierSimpleLogger, Duration, Consumer)
, with a durationDEFAULT_DURATION
-
returnString
public static String returnString(@NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Duration wait, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) Defaulting version of {@link #returnString(String, StringSupplierSimpleLogger, Duration, Consumer)), with no key (meaning that jobs can be started concurrently. -
returnString
public static String returnString(@NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Consumer<nl.vpro.logging.simple.StringSupplierSimpleLogger> logger) Defaulting version of {@link #returnString(String, StringSupplierSimpleLogger, Duration, Consumer)), with no key (meaning that jobs can be started concurrently. -
returnMultilineString
-
returnString
@Deprecated public static String returnString(@Nullable String key, @NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Duration wait, @NonNull Callable<String> job) Deprecated. -
returnString
@Deprecated public static String returnString(@NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Duration wait, @NonNull Callable<String> job) Deprecated.Defaulting version of {@link #returnString(String, StringSupplierSimpleLogger, Duration, Callable)), with no key (meaning that jobs can be started concurrently. -
returnString
@Deprecated public static String returnString(@NonNull Supplier<String> description, @NonNull Duration wait, @NonNull Callable<String> job) Deprecated. -
returnString
@Deprecated public static String returnString(@NonNull nl.vpro.logging.simple.StringSupplierSimpleLogger description, @NonNull Callable<String> job) Deprecated.Defaulting version ofreturnString(StringSupplierSimpleLogger, Duration, Callable)
waiting for 5 seconds before time out. -
singleLine
public static nl.vpro.logging.simple.StringSupplierSimpleLogger singleLine(org.slf4j.Logger log, String message, Object... args) - Parameters:
log
- Logger instance to log toomessage
- Initial value of the stringargs
- The arguments of the initial value- Returns:
- a
StringBuilderSimpleLogger
representing a single line string (actually aMBeans.UpdatableString
-
multiLine
public static nl.vpro.logging.simple.StringSupplierSimpleLogger multiLine(org.slf4j.Logger log, String message, Object... args) - Parameters:
log
- Logger instance to log toomessage
- First line of the string (logged as info)args
- The arguments of the first line- Returns:
- a
StringBuilderSimpleLogger
representing multiple lines actually aStringBuilderSimpleLogger
-
multiLine
-
multiLine
public static nl.vpro.logging.simple.StringSupplierSimpleLogger multiLine(org.slf4j.Logger log) - Parameters:
log
- Logger instance to log too- Returns:
- a
StringBuilderSimpleLogger
representing multiple lines actually aStringBuilderSimpleLogger
-
isEmpty
A 'visualvm' oriented check whether a string is 'empty'. i.e. not filled.The point being that also the string 'String' is considered empty, because that is the default value in visualvm, so that's the value when untouched.
- Since:
- 2.7
-
isBlank
A 'visualvm' oriented check whether a string is 'blank'. i.e. not filled, or only filled with space.The point being that also the string 'String' is considered blank, because that is the default value in visualvm, so that's the value when untouched.
- Since:
- 2.7
-
asBoolean
- Since:
- 4.0
-
registerBean
- Since:
- 2.10
-
registerBean
-
unregister
- Since:
- 2.10
-
getObjectName
- Since:
- 2.10
-
getObjectNameWithName
-