Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Threads
Threads [message #82669] Sun, 13 April 2008 23:30 Go to next message
Eclipse UserFriend
Hello,

I am trying to work with different threads, to use
DeferredTreeContentManager and other tasks which use Jobs API. I am
confronted by difficulties.

Classes extending SessionSingletonBase, resources
(RWT.NLS.getISO8859_1Encoded( BUNDLE_NAME, clazz )),
Dysplay.getCurrent() cannot be used from these threads and jobs.

I've created my own thread system, which sets all session data to thread
when it starting and it works correctly, but what I should do for
threads creating from not my code (e.g. DeferredTreeContentManager)? How
to work with resources form non-UI threads?

Thanks.

--
Boris Stepanov
Re: Threads [message #82696 is a reply to message #82669] Mon, 14 April 2008 04:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,

I took a short look at the DeferredTreeContentManager. From what I've
seen there, it could be a bug in startFetchingDeferredChildren how the
Job is beeing created (I think it should be created Session-Context
aware, which is not the case), but this still needs more investigation.
So feel free to file a bug on this to track the progress on this
problem.


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Boris Stepanov [mailto:freepriman@rambler.ru]
Bereitgestellt: Montag, 14. April 2008 05:30
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Threads
Betreff: Threads


Hello,

I am trying to work with different threads, to use
DeferredTreeContentManager and other tasks which use Jobs API. I am
confronted by difficulties.

Classes extending SessionSingletonBase, resources
(RWT.NLS.getISO8859_1Encoded( BUNDLE_NAME, clazz )),
Dysplay.getCurrent() cannot be used from these threads and jobs.

I've created my own thread system, which sets all session data to thread
when it starting and it works correctly, but what I should do for
threads creating from not my code (e.g. DeferredTreeContentManager)? How
to work with resources form non-UI threads?

Thanks.

--
Boris Stepanov
Re: Threads [message #82906 is a reply to message #82696] Mon, 14 April 2008 22:59 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, Frank.

Bug 227063 is created.

I want to understand in details how to use Threads and Jobs correctly in
RAP. How to get Display and work with SessionSingletonBase in them.
Maybe you can show small code example?

For example I am creating new thread:

Thread t = new Thread(new Runnable()
{

public void run()
{
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable()
{

public void run()
{
(new MyDialog()).open();
}

});
}

});

This code fall on line PlatformUI.getWorkbench() because Workbench
extends SessionSingletonBase and need session context to get instance.

What the general resolution for situations similar to current example?


> Hi,
>
> I took a short look at the DeferredTreeContentManager. From what I've
> seen there, it could be a bug in startFetchingDeferredChildren how the
> Job is beeing created (I think it should be created Session-Context
> aware, which is not the case), but this still needs more investigation.
> So feel free to file a bug on this to track the progress on this
> problem.
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Boris Stepanov [mailto:freepriman@rambler.ru]
> Bereitgestellt: Montag, 14. April 2008 05:30
> Bereitgestellt in: eclipse.technology.rap
> Unterhaltung: Threads
> Betreff: Threads
>
>
> Hello,
>
> I am trying to work with different threads, to use
> DeferredTreeContentManager and other tasks which use Jobs API. I am
> confronted by difficulties.
>
> Classes extending SessionSingletonBase, resources
> (RWT.NLS.getISO8859_1Encoded( BUNDLE_NAME, clazz )),
> Dysplay.getCurrent() cannot be used from these threads and jobs.
>
> I've created my own thread system, which sets all session data to thread
> when it starting and it works correctly, but what I should do for
> threads creating from not my code (e.g. DeferredTreeContentManager)? How
> to work with resources form non-UI threads?
>
> Thanks.
>
> --
> Boris Stepanov
>


--
Boris Stepanov
Re: Threads [message #82936 is a reply to message #82906] Tue, 15 April 2008 04:20 Go to previous message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hi,


note that you need to map the thread you are executing somehow to the
session to which the thread should belong. This is since you have n
sessions on a server and the single thread you are executing doesn't
know out of the box anything about those sessions. So here is your
modified example snippet that shows how this can be achieved:

final Display display
= PlatformUI.getWorkbench().getDisplay(); // <-- this assumes we are
in the UI Thread
Thread t = new Thread( new Runnable() {
public void run() {
UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() {
public void run() {
display.syncExec( new Runnable() {
public void run() {
( new MyDialog() ).open();
}
} );
}
} );
}
} );


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Boris Stepanov [mailto:freepriman@rambler.ru]
Bereitgestellt: Dienstag, 15. April 2008 04:59
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Threads
Betreff: Re: Threads



Thanks, Frank.

Bug 227063 is created.

I want to understand in details how to use Threads and Jobs correctly in
RAP. How to get Display and work with SessionSingletonBase in them.
Maybe you can show small code example?

For example I am creating new thread:

Thread t = new Thread(new Runnable()
{

public void run()
{
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {

public void run()
{
(new MyDialog()).open();
}

});
}

});

This code fall on line PlatformUI.getWorkbench() because Workbench
extends SessionSingletonBase and need session context to get instance.
What the general resolution for situations similar to current example?


> Hi,
>
> I took a short look at the DeferredTreeContentManager. From what I've
> seen there, it could be a bug in startFetchingDeferredChildren how the

> Job is beeing created (I think it should be created Session-Context
> aware, which is not the case), but this still needs more
investigation.
> So feel free to file a bug on this to track the progress on this
> problem.
>
>
> Ciao
> Frank
>
> -----Ursprüngliche Nachricht-----
> Von: Boris Stepanov [mailto:freepriman@rambler.ru]
> Bereitgestellt: Montag, 14. April 2008 05:30 Bereitgestellt in:
> eclipse.technology.rap
> Unterhaltung: Threads
> Betreff: Threads
>
>
> Hello,
>
> I am trying to work with different threads, to use
> DeferredTreeContentManager and other tasks which use Jobs API. I am
> confronted by difficulties.
>
> Classes extending SessionSingletonBase, resources
> (RWT.NLS.getISO8859_1Encoded( BUNDLE_NAME, clazz )),
> Dysplay.getCurrent() cannot be used from these threads and jobs.
>
> I've created my own thread system, which sets all session data to
> thread when it starting and it works correctly, but what I should do
> for threads creating from not my code (e.g.
> DeferredTreeContentManager)? How to work with resources form non-UI
threads?
>
> Thanks.
>
> --
> Boris Stepanov
>


--
Boris Stepanov
Previous Topic:Deployment of rapdemo.war fails on JBoss 4.2.2.GA
Next Topic:ViewPart issue
Goto Forum:
  


Current Time: Sat Aug 30 06:37:54 EDT 2025

Powered by FUDForum. Page generated in 0.04110 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top