Lines 4-11
Link Here
|
4 |
*/ |
4 |
*/ |
5 |
package org.netbeans.modules.parsing.impl; |
5 |
package org.netbeans.modules.parsing.impl; |
6 |
|
6 |
|
|
|
7 |
import java.lang.management.ManagementFactory; |
8 |
import java.lang.management.MemoryPoolMXBean; |
9 |
import java.lang.management.MemoryType; |
10 |
import java.util.List; |
11 |
import java.util.logging.Level; |
12 |
import java.util.logging.Logger; |
7 |
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; |
13 |
import org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater; |
8 |
import org.openide.modules.ModuleInstall; |
14 |
import org.openide.modules.ModuleInstall; |
|
|
15 |
import org.openide.util.Exceptions; |
16 |
import org.openide.util.NbBundle; |
9 |
import org.openide.util.RequestProcessor; |
17 |
import org.openide.util.RequestProcessor; |
10 |
import org.openide.windows.WindowManager; |
18 |
import org.openide.windows.WindowManager; |
11 |
|
19 |
|
Lines 37-40
Link Here
|
37 |
RepositoryUpdater.getDefault().stop(); |
45 |
RepositoryUpdater.getDefault().stop(); |
38 |
return ret; |
46 |
return ret; |
39 |
} |
47 |
} |
|
|
48 |
|
49 |
@Override |
50 |
public void validate() throws IllegalStateException { |
51 |
super.validate(); |
52 |
|
53 |
long s = System.currentTimeMillis(); |
54 |
try { |
55 |
List<MemoryPoolMXBean> pools = null; |
56 |
pools = ManagementFactory.getMemoryPoolMXBeans(); |
57 |
for (MemoryPoolMXBean pool : pools) { |
58 |
if (pool.getType() == MemoryType.HEAP && pool.isUsageThresholdSupported()) { //NOI18N |
59 |
return ; |
60 |
} |
61 |
} |
62 |
|
63 |
IllegalStateException e = new IllegalStateException("Cannot listen on usage threshold"); |
64 |
|
65 |
throw Exceptions.attachLocalizedMessage(e, NbBundle.getMessage(Installer.class, "ERR_NoUsageThreshold")); |
66 |
} finally { |
67 |
Logger log = Logger.getLogger(Installer.class.getName()); |
68 |
|
69 |
if (log.isLoggable(Level.FINE)) { |
70 |
log.log(Level.FINE, "threshold supported check took: {0}", System.currentTimeMillis() - s); |
71 |
} |
72 |
} |
73 |
} |
74 |
|
40 |
} |
75 |
} |