Lines 43-48
Link Here
|
43 |
|
43 |
|
44 |
import java.io.IOException; |
44 |
import java.io.IOException; |
45 |
import java.lang.management.ManagementFactory; |
45 |
import java.lang.management.ManagementFactory; |
|
|
46 |
import java.lang.management.MemoryPoolMXBean; |
47 |
import java.lang.management.MemoryType; |
48 |
import java.util.List; |
46 |
import java.util.logging.Logger; |
49 |
import java.util.logging.Logger; |
47 |
import java.util.logging.Level; |
50 |
import java.util.logging.Level; |
48 |
import javax.management.InstanceAlreadyExistsException; |
51 |
import javax.management.InstanceAlreadyExistsException; |
Lines 60-65
Link Here
|
60 |
import org.openide.ErrorManager; |
63 |
import org.openide.ErrorManager; |
61 |
import org.openide.modules.ModuleInstall; |
64 |
import org.openide.modules.ModuleInstall; |
62 |
import org.openide.util.Exceptions; |
65 |
import org.openide.util.Exceptions; |
|
|
66 |
import org.openide.util.NbBundle; |
63 |
|
67 |
|
64 |
/** |
68 |
/** |
65 |
* |
69 |
* |
Lines 75-80
Link Here
|
75 |
public JBrowseModule() { |
79 |
public JBrowseModule() { |
76 |
} |
80 |
} |
77 |
|
81 |
|
|
|
82 |
@Override |
83 |
public void validate() throws IllegalStateException { |
84 |
super.validate(); |
85 |
|
86 |
long s = System.currentTimeMillis(); |
87 |
try { |
88 |
List<MemoryPoolMXBean> pools = null; |
89 |
pools = ManagementFactory.getMemoryPoolMXBeans(); |
90 |
for (MemoryPoolMXBean pool : pools) { |
91 |
if (pool.getType() == MemoryType.HEAP && pool.isUsageThresholdSupported()) { //NOI18N |
92 |
return ; |
93 |
} |
94 |
} |
95 |
|
96 |
IllegalStateException e = new IllegalStateException("Cannot listen on usage threshold"); |
97 |
|
98 |
throw Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(JBrowseModule.class, "ERR_NoUsageThreashold")); |
99 |
} finally { |
100 |
System.err.println("threshold check took: " + (System.currentTimeMillis() - s)); |
101 |
} |
102 |
} |
103 |
|
78 |
public @Override void restored() { |
104 |
public @Override void restored() { |
79 |
super.restored(); |
105 |
super.restored(); |
80 |
JavaSourceTaskFactoryManager.register(); |
106 |
JavaSourceTaskFactoryManager.register(); |