0

Infinite Clients.showBusy("")

asked 2016-07-12 09:13:13 +0800

Dgray gravatar image Dgray
3 1

Hello, on project I migrated from ZK5 to ZK8 and I found strange behaviour of Executions.deactivate(desktop) method.

I am using:

zul - 8.0.11
zkplus - 8.0.11
zkbind - 8.0.111
zk - 8.0.11

How my functionality works:

  1. I am pushing button
  2. In separate Thread there are going some calculations.
  3. At same time there are notifications ( how many calculations done, you should wait, ... )
  4. After all calculations done, there will be a window with message n reassigns done.

My problem is, that after all calculations are done showBusy window still active. I cannot clear it. Why my suggestion that something wrong with ZK, because I have not change anything in my code. And with ZK5 it still works perfect.

Please refer to classes where I am using it.

ReassignCommand.java raw.githubusercontent.com/LibrePlan/libreplan/6498e85928a8709d451a0d51e760a4d937c56af1/libreplan-webapp/src/main/java/org/libreplan/web/planner/reassign/ReassignCommand.java

LongOperationFeedback.java raw.githubusercontent.com/LibrePlan/libreplan/0600192f1261d5ebdde35a585329d7bcff5ebf4f/ganttzk/src/main/java/org/zkoss/ganttz/util/LongOperationFeedback.java

Note:

As I said, I cannot clear this showBusy method.

private IDesktopUpdate busyEnd() {
    return new IDesktopUpdate() {

        @Override
        public void doUpdate() {
            Clients.showBusy("");
        }
    };
}

"Infinite showBusy" will appear after deactivate method:

@Override
    public void run() {
        List<T> batch = new ArrayList<T>();
        while (true) {
            batch.clear();
            EndOrValue<T> current = null;
            try {
                current = queue.take();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            if (current.isEnd()) {
                return;
            }
            if (!desktop.isAlive() || !desktop.isServerPushEnabled()) {
                return;
            }
            try {
                Executions.activate(desktop);
            } catch (Exception e) {
                LOG.error("unable to access desktop", e);
                throw new RuntimeException(e);
            }
            try {
                original.doUpdate(current.getValue());
                while ((current = queue.poll()) != null) {
                    if (current.isEnd()) {
                        break;
                    }
                    batch.add(current.getValue());
                    original.doUpdate(current.getValue());
                }
            } finally {
                Executions.deactivate(desktop);
            }
            if (current != null && current.isEnd()) {
                return;
            }
        }
    }

Image: s32.postimg.org/617fpuwqd/20160712_120520.jpg

delete flag offensive retag edit

Comments

here some common guidelines on how to provide verifyable code examples http://stackoverflow.com/help/mcve

cor3000 ( 2016-07-27 08:15:51 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-07-27 08:10:37 +0800

cor3000 gravatar image cor3000
6280 2 7

Hi Dgray,

Since I can't run your example it's hard to tell what is wrong. Can you share a simple case showing the same problem?

My blind guess would be that Clients.clearBusy() is not called. I'd put a breakpoint into the method that's supposed to call it to check if it is ever reached. If it is called then check the ajax response if it contains the clear busy command.

Other problems could be unrelated JS errors stopping the serverpush or the client engine. Please verify your browser console for any error.

Robert

link publish delete flag offensive edit
0

answered 2016-07-27 12:05:18 +0800

Dgray gravatar image Dgray
3 1

Thanks for the feedback, your thoughts pushed me to check everything from scratch.

And I found a problem:

Let`s back in time and see what ZK5 offers:

Clients.java

public static final void showBusy(String msg, boolean open) {
    if (open) showBusy(msg);
    else clearBusy();
}

App code was:

Clients.showBusy(null, false);

Now let`s look at ZK8 Clients.java:

public static final void showBusy(String msg) {
    response(new AuShowBusy(msg));
}

So, you deleted built-in clerBusy() method. So it was my bad, that I had not read source code more accurate.

In the end, how it was:

private IDesktopUpdate busyEnd() {
    return new IDesktopUpdate() {
        @Override
        public void doUpdate() {
            Clients.showBusy("");
        }
    };
}

correct code:

private IDesktopUpdate busyEnd() {
    return new IDesktopUpdate() {
        @Override
        public void doUpdate() {
            Clients.clearBusy();
        }
    };
}
link publish delete flag offensive edit

Comments

thanks for updating with your results, I wasn't aware of the API change... luckily it helped to find the issue.

cor3000 ( 2016-07-28 03:18:54 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2016-07-12 09:13:13 +0800

Seen: 44 times

Last updated: Jul 27 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More