LauncherMBeanHelper.java
1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.granite.startup.impl;
import java.lang.management.ManagementFactory;
import javax.management.MBeanInfo;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
public class LauncherMBeanHelper {
private static final String NAME_LAUNCHER = "com.adobe.granite.quickstart:type=Launcher";
private final MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
private final ObjectName launcherName = new ObjectName("com.adobe.granite.quickstart:type=Launcher");
private boolean available;
public LauncherMBeanHelper() throws MalformedObjectNameException {
try {
this.jmxServer.getMBeanInfo(this.launcherName);
this.available = true;
}
catch (Exception ignore) {
this.available = false;
}
}
public void startupFinished() {
if (this.available) {
try {
this.jmxServer.invoke(this.launcherName, "startupFinished", null, null);
}
catch (Exception e) {
// empty catch block
}
}
}
public void startupProgress(float ratio) {
if (this.available) {
try {
this.jmxServer.invoke(this.launcherName, "startupProgress", new Object[]{Float.valueOf(ratio)}, new String[]{Float.class.getName()});
}
catch (Exception e) {
// empty catch block
}
}
}
}