在Swing应用程序中,一些UI操作事件在执行时滞后 和UI,并冻结几秒钟。当试图使用
检查ThreadInfo MonitorInfo[] monitors = threadInfo.getLockedMonitors();
和
StackTraceElement[] stackElements = threadInfo.getStackTrace();
显示和连续..到组件的行。
仅在webstart
中发生例如:
**HOLDS MONITORS:** [java.util.zip.ZStreamRef@a4f0208,
com.sun.deploy.cache.CacheEntry@2788c4ea,
com.sun.deploy.cache.CachedJarFile@294f3e6b,
com.sun.jnlp.JNLPClassLoader@5ce11cce,
javax.swing.plaf.basic.DefaultMenuLayout@d096bf8,
java.awt.Component$AWTTreeLock@285a2772]
STACK TRACE:
java.util.zip.Inflater.inflateBytes(Native Method)
java.util.zip.Inflater.inflate(Unknown Source)
java.util.zip.InflaterInputStream.read(Unknown Source)
java.util.jar.JarVerifier$VerifierStream.read(Unknown Source)
com.sun.deploy.security.JarVerifier.readAndMaybeSaveStreamTo(Unknown
Source)
com.sun.deploy.security.JarVerifier.authenticateJarEntry(Unknown Source)
com.sun.deploy.security.EnhancedJarVerifier.validate(Unknown Source)
com.sun.deploy.cache.CacheEntry$3.run(Unknown Source)
com.sun.deploy.cache.CacheEntry$3.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
com.sun.deploy.cache.CacheEntry.getJarSigningData(Unknown Source)
com.sun.deploy.cache.CachedJarFile.getSigningData(Unknown Source)
com.sun.deploy.cache.CachedJarFile$JarFileEntry.getCodeSigners(Unknown
Source)
com.sun.deploy.security.DeployURLClassPath$JarLoader$2.getCodeSigners(
Unknown Source)
java.net.URLClassLoader.defineClass(Unknown Source)
java.net.URLClassLoader.access$100(Unknown Source)
java.net.URLClassLoader$1.run(Unknown Source)
java.net.URLClassLoader$1.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(Unknown Source)
com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
java.lang.ClassLoader.loadClass(Unknown Source)
com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
java.lang.ClassLoader.loadClass(Unknown Source)
答案 0 :(得分:0)
您是否尝试过在不同的线程中调用这些方法?因为你使用Swing,它主要是线程安全的。整个显示器是冻结还是只是窗口?
线程很简单,如果你一直在避免它们:
Thread thread = new Thread(() -> intensiveMethod());
thread.start();
intensiveMethod
是您调用的冻结监视器的方法。如果不是你调用它,请尝试安装最新的JRE和JDK。