Added TwoStateOwner labels

pull/207/head
M66B 2 years ago
parent 092b16a6dc
commit c459d3cf36

@ -65,6 +65,17 @@ public class CoalMine {
reporter.getLabels().add("started=" + label);
}
}
} else if (className.equals(TwoStateOwner.class.getName())) {
HeapField hfState = instance.get(className, "state");
if (hfState != null) {
String state = hfState.getValue().readAsJavaString();
reporter.getLabels().add("state=" + state);
}
HeapField hfOwned = instance.get(className, "owned");
if (hfOwned != null) {
Boolean owned = hfOwned.getValue().getAsBoolean();
reporter.getLabels().add("owned=" + owned);
}
}
return null;

@ -42,6 +42,7 @@ public class TwoStateOwner implements LifecycleOwner {
private LifecycleRegistry registry;
private long created;
private long changed;
private String state;
private static DateFormat DTF = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
@ -85,6 +86,7 @@ public class TwoStateOwner implements LifecycleOwner {
public void onAny() {
Log.i(TwoStateOwner.this + " " + registry);
changed = new Date().getTime();
state = registry.getCurrentState().name();
}
});

Loading…
Cancel
Save