JXMapKit/-Viewer的启动速度非常慢-从哪里开始挖掘? [英] JXMapKit/-Viewer extremely slow as webstartable - where to start digging?

查看:46
本文介绍了JXMapKit/-Viewer的启动速度非常慢-从哪里开始挖掘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是尝试在整个swinglabs演示中添加一些swingx-ws组件-并注意到,简单的JXMapKit/-Viewer在将

Just tried to add some swingx-ws components to the overall swinglabs demos - and noticed that a simple JXMapKit/-Viewer is orders of magnitude slower to load the tiles in the webstartable compared to loading locally.

在应该开始寻找的位置上不知所措(ui更新似乎在EDT上,尽管可能需要仔细观察):

Rather lost on where I should start looking (ui updates seem to be on the EDT, though might need a closer look):

  • 还有其他人在经历不同的加载时间吗?
  • 可能会是什么原因的任何猜测?
  • 如何调试webstartable?

代码相当简单(要在本地运行,您需要

The code is rather straightforward (to run locally, you'll need swingx and swingx-ws:

public class WSDemo {

    private JComponent createContent() {
        JComponent content = new JPanel();
        content.setLayout(new BorderLayout());

        content.add(createMapKit()); 
        return content;
    }

    protected JComponent createMapKit() {
        final int max = 17;
        TileFactoryInfo info = new TileFactoryInfo(1, max - 2, max, 256, true,
                true, // tile size is 256 and x/y orientation is normal
                "http://tile.openstreetmap.org",// 5/15/10.png",
                "x", "y", "z") {
            public String getTileUrl(int x, int y, int zoom) {
                zoom = max - zoom;
                String url = this.baseURL + "/" + zoom + "/" + x + "/" + y
                        + ".png";
                return url;
            }

        };
        DefaultTileFactory tf = new DefaultTileFactory(info);
        tf.setThreadPoolSize(1);
        final JXMapKit kit = new JXMapKit();
        kit.setTileFactory(tf);
        kit.setZoom(10);
        kit.setAddressLocation(new GeoPosition(51.5, 0));
        kit.getMainMap().setDrawTileBorders(true);
        return kit;
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JFrame frame = new JFrame("");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.add(new WSDemo().createContent());
                frame.setLocationByPlatform(true);
                frame.setSize(400, 400);
                frame.setVisible(true);
            }
        });
    }

}

修改:

似乎与Web上下文中的权限检查有某种关系:分析表明整个连接调用堆栈是不同的(并不奇怪),并且需要花费很多时间.暂时放弃..

seems like it's somehow related to permission checking in the web context: profiling shows that the whole connection call stack is different (not overly surprising) and takes ages. Giving up for now ..

编辑2 :

似乎有两个独立的问题

  • 在受安全限制的上下文中打开用于加载切片的连接所花费的时间更长,这是JavaWebStartSecurity.checkConnect(String,int)中的热点,如@Howard所指出的.
  • 对EDT的一种相当奇怪的阻止,似乎只有在(BSAF的SingleFrameApplication)中使用mapKit时才会发生

要重现阻止,请运行 SimpleWSDemoApp ,直到地图是可见的(需要一些时间,这是第一个问题),然后使用鼠标快速上下移动缩放拇指:用户界面已完全被阻止.在普通框架(顶部的参考)上执行相同操作会产生初始加载等待,但无法重现该阻塞.

To reproduce the blocking, run the SimpleWSDemoApp, wait until the map is visible (takes some time, that's the first issue) then use the mouse to move the zoom thumb quickly up and down: the ui is completely blocked. Doing the same on the plain frame (the reference on top) has the initial loading wait, but couldn't ever reproduce the blocking.

(对我而言)奇怪的事情是从VisualVM的线程转储中阻止了EDT:

The weird thingy (to me) is what blocks the EDT, from the thread dump of VisualVM:

"AWT-EventQueue-0" prio=6 tid=0x063d3000 nid=0x1468 waiting for monitor entry [0x05efe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at java.security.Permissions.implies(Unknown Source)
    - waiting to lock <0x29f7b118> (a java.security.Permissions)
    at sun.security.provider.PolicyFile.implies(Unknown Source)
    at java.security.ProtectionDomain.implies(Unknown Source)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkSystemClipboardAccess(Unknown Source)
    at java.awt.event.InputEvent.canAccessSystemClipboard(Unknown Source)
    at java.awt.event.InputEvent.<init>(Unknown Source)
    at java.awt.event.MouseEvent.<init>(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)

正在拖动鼠标来检查剪贴板访问权限...

that is dragging the mouse kicks in checking permission for clipboard access ...

推荐答案

Web Start应用程序也是JVM进程,因此您可以尝试使用

A Web Start app is also a JVM process so you can try to profile it with VisualVM (this entry describes how to do that). It's also worth to profile both applications with VisualVM and compare JVM settings like heap size, JIT compiler differences. I think that a Web Start application runs with client compiler, which is slower by means of produced native code than a server compiler.

这篇关于JXMapKit/-Viewer的启动速度非常慢-从哪里开始挖掘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆