SingleInstanceListener Not working with OpenJDK 1.8 and IcedTea webstart

202 Views Asked by At


I have my JNLP application which work perfectly fine with Oracle JDK. But when I tried running it with openJDK 1.8.0.252 and IcedTea WS (provided by default with openJDK).
I see My application can be launched with multiple instances although there is implementation of SingleInstanceListener .
I never got the logger "Start newActivation method" printed in console. Also I wanted (tried) to Launch the application with parameter. Can anyone help me with this

Code ::

// Code from Main class


private void startSingleInstance() {
        log.info("Initializing single instance Web Start");
        boolean didAddListener = false;
        final SingleInstanceListener singleInstanceListener = new SingleInstanceListener() {
            @Override
            public void newActivation(String[] args) {
                log.info("Start newActivation method");
                log.info("newActivation(args:{}) in env {} Frame visible? {}", 
                         new Object[] {args, System.getProperty("app.environment"), frame != null ? frame.isVisible() : false});
                if (args.length > 1) {
                    // some logic                    
                }                
                SwingHelper.frameToFront(frame);
            }
        };

        try {
            SingleInstanceService singleInstanceService = 
                    (SingleInstanceService) ServiceManager.lookup("javax.jnlp.SingleInstanceService");
            log.info("singleInstanceService {} ",singleInstanceService);
            // add the listener to this application!
            log.info("Add singleInstanceListener");
            singleInstanceService.addSingleInstanceListener(singleInstanceListener);
            didAddListener = true;
        } catch (UnavailableServiceException e) {
            log.info("Unable to register single WebStart instance (Not Web Start environment?).");
        }
1

There are 1 best solutions below

1
On

At the OpenWebStart Repo you can find an issue that current discuss how the SingleInstanceListener should work. Since the people that Maintain OpenWebStart are the same people that maintain IcedTeaWeb it would be good if you can add your input to that issue :)