Display#asynExec since 1.3.0-M7 [message #659262] |
Fri, 11 March 2011 16:35 |
|
Hi RAP Team,
Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
however this seems to break my unit test. Currently we have code
similliar below:
Button button = ....
SelectionAdapter adapter = new SelectionAdapter()
{
public void widgetSelected(SelectionEvent event)
{
doSomething();
}
};
button.addSelectionListener(adapter);
void doSomething()
{
Display.getCurrent().asynExec
(
new Runnable()
{
public void run()
{
}
}
)
}
I can run my application as usual just fine, but in unit tests in which
I call method 'doSomething' directly the Runnable's run won't get
invoked at all.
Any help would be greatly appreciated.
Thanks & Regards,
Setya
|
|
|
Re: Display#asynExec since 1.3.0-M7 [message #659334 is a reply to message #659262] |
Sat, 12 March 2011 12:46 |
|
Hi all,
After debugging I found that the following code :
while( UICallBackManager.getInstance().processNextRunnableInUIThrea d()) {
}
had been removed from RWTLifeCycle#afterPhaseExecution.
And there was a comment stating that by removing the code
asyncExec-runnables that are added in an after-PROCESS_ACTION-listener
would not be processed in the same request.
Any workaround on this ?
Thanks & Regards,
Setya
> Hi RAP Team,
>
> Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
> however this seems to break my unit test. Currently we have code
> similliar below:
>
> Button button = ....
>
> SelectionAdapter adapter = new SelectionAdapter()
> {
> public void widgetSelected(SelectionEvent event)
> {
> doSomething();
> }
> };
> button.addSelectionListener(adapter);
>
> void doSomething()
> {
> Display.getCurrent().asynExec
> (
> new Runnable()
> {
> public void run()
> {
> }
> }
> )
> }
>
> I can run my application as usual just fine, but in unit tests in which
> I call method 'doSomething' directly the Runnable's run won't get
> invoked at all.
>
>
> Any help would be greatly appreciated.
>
> Thanks & Regards,
>
> Setya
>
>
|
|
|
Re: Display#asynExec since 1.3.0-M7 [message #659342 is a reply to message #659334] |
Sat, 12 March 2011 13:53 |
|
Hi all,
My workaround so far is:
while (Display.getCurrent().readAndDispatch()){}
Any better workarounds are welcome.
Thanks & Regards,
Setya
> Hi all,
>
> After debugging I found that the following code :
>
> while( UICallBackManager.getInstance().processNextRunnableInUIThrea d()) {
> }
>
> had been removed from RWTLifeCycle#afterPhaseExecution.
>
> And there was a comment stating that by removing the code
> asyncExec-runnables that are added in an after-PROCESS_ACTION-listener
> would not be processed in the same request.
>
> Any workaround on this ?
>
> Thanks & Regards,
>
> Setya
>
>> Hi RAP Team,
>>
>> Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
>> however this seems to break my unit test. Currently we have code
>> similliar below:
>>
>> Button button = ....
>>
>> SelectionAdapter adapter = new SelectionAdapter()
>> {
>> public void widgetSelected(SelectionEvent event)
>> {
>> doSomething();
>> }
>> };
>> button.addSelectionListener(adapter);
>>
>> void doSomething()
>> {
>> Display.getCurrent().asynExec
>> (
>> new Runnable()
>> {
>> public void run()
>> {
>> }
>> }
>> )
>> }
>>
>> I can run my application as usual just fine, but in unit tests in which
>> I call method 'doSomething' directly the Runnable's run won't get
>> invoked at all.
>>
>>
>> Any help would be greatly appreciated.
>>
>> Thanks & Regards,
>>
>> Setya
>>
>>
>
|
|
|
Re: Display#asynExec since 1.3.0-M7 [message #659617 is a reply to message #659342] |
Mon, 14 March 2011 19:00 |
Rüdiger Herrmann Messages: 335 Registered: July 2009 |
Senior Member |
|
|
Setya,
your 'workaround' is actually the proper solution to the problem. You
need to spin the event loop to get messages processed. This includes
(a)sync runnables. This behavior now also aligns with how SWT processes
runnables.
Sorry for the late response and the inconvenience.
Regards,
Rüdiger
On 12.03.2011 14:53, Setya wrote:
> Hi all,
>
> My workaround so far is:
>
> while (Display.getCurrent().readAndDispatch()){}
>
> Any better workarounds are welcome.
>
>
> Thanks & Regards,
>
> Setya
>
>> Hi all,
>>
>> After debugging I found that the following code :
>>
>> while( UICallBackManager.getInstance().processNextRunnableInUIThrea d()) {
>> }
>>
>> had been removed from RWTLifeCycle#afterPhaseExecution.
>>
>> And there was a comment stating that by removing the code
>> asyncExec-runnables that are added in an after-PROCESS_ACTION-listener
>> would not be processed in the same request.
>>
>> Any workaround on this ?
>>
>> Thanks & Regards,
>>
>> Setya
>>
>>> Hi RAP Team,
>>>
>>> Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
>>> however this seems to break my unit test. Currently we have code
>>> similliar below:
>>>
>>> Button button = ....
>>>
>>> SelectionAdapter adapter = new SelectionAdapter()
>>> {
>>> public void widgetSelected(SelectionEvent event)
>>> {
>>> doSomething();
>>> }
>>> };
>>> button.addSelectionListener(adapter);
>>>
>>> void doSomething()
>>> {
>>> Display.getCurrent().asynExec
>>> (
>>> new Runnable()
>>> {
>>> public void run()
>>> {
>>> }
>>> }
>>> )
>>> }
>>>
>>> I can run my application as usual just fine, but in unit tests in which
>>> I call method 'doSomething' directly the Runnable's run won't get
>>> invoked at all.
>>>
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Thanks & Regards,
>>>
>>> Setya
>>>
>>>
>>
>
|
|
|
Re: Display#asynExec since 1.3.0-M7 [message #659894 is a reply to message #659617] |
Tue, 15 March 2011 22:39 |
|
Rudiger,
Thank you for your clarification. Glad to know that I don't have to hack
anything.
Thanks & Regards,
Setya
> Setya,
>
> your 'workaround' is actually the proper solution to the problem. You
> need to spin the event loop to get messages processed. This includes
> (a)sync runnables. This behavior now also aligns with how SWT processes
> runnables.
> Sorry for the late response and the inconvenience.
>
> Regards,
> Rüdiger
>
> On 12.03.2011 14:53, Setya wrote:
>> Hi all,
>>
>> My workaround so far is:
>>
>> while (Display.getCurrent().readAndDispatch()){}
>>
>> Any better workarounds are welcome.
>>
>>
>> Thanks & Regards,
>>
>> Setya
>>
>>> Hi all,
>>>
>>> After debugging I found that the following code :
>>>
>>> while(
>>> UICallBackManager.getInstance().processNextRunnableInUIThrea d()) {
>>> }
>>>
>>> had been removed from RWTLifeCycle#afterPhaseExecution.
>>>
>>> And there was a comment stating that by removing the code
>>> asyncExec-runnables that are added in an after-PROCESS_ACTION-listener
>>> would not be processed in the same request.
>>>
>>> Any workaround on this ?
>>>
>>> Thanks & Regards,
>>>
>>> Setya
>>>
>>>> Hi RAP Team,
>>>>
>>>> Since 1.3.0-M7 Display#asyncExec implementation uses synchronizer,
>>>> however this seems to break my unit test. Currently we have code
>>>> similliar below:
>>>>
>>>> Button button = ....
>>>>
>>>> SelectionAdapter adapter = new SelectionAdapter()
>>>> {
>>>> public void widgetSelected(SelectionEvent event)
>>>> {
>>>> doSomething();
>>>> }
>>>> };
>>>> button.addSelectionListener(adapter);
>>>>
>>>> void doSomething()
>>>> {
>>>> Display.getCurrent().asynExec
>>>> (
>>>> new Runnable()
>>>> {
>>>> public void run()
>>>> {
>>>> }
>>>> }
>>>> )
>>>> }
>>>>
>>>> I can run my application as usual just fine, but in unit tests in which
>>>> I call method 'doSomething' directly the Runnable's run won't get
>>>> invoked at all.
>>>>
>>>>
>>>> Any help would be greatly appreciated.
>>>>
>>>> Thanks & Regards,
>>>>
>>>> Setya
>>>>
>>>>
>>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04500 seconds