Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Eclipse Jobs Usage query(I am writing a plain java class which does the query from a database.)
Eclipse Jobs Usage query [message #649690] Thu, 20 January 2011 10:36 Go to next message
Saurabh Mising name is currently offline Saurabh Mising name
Messages: 21
Registered: October 2010
Junior Member
I am writing a PLAIN java class which has a Query() Method on it.

In the query method, i connect to the database and retrieve the Objects from the database.

My question is:
1. In the Query() method of this plain java class, I can write the code for connecting to the database in an eclipse non-UI job.

OR

2. Whoever calls this Query() method can call the Query() method in a non-UI job.

I am not sure if i should have an eclipse Job in the Query() method or is it expected that the caller of the Query() method should make the Query() call in a Job.

Please let me know your thoughts.
Thanks,
Saurabh
Re: Eclipse Jobs Usage query [message #649705 is a reply to message #649690] Thu, 20 January 2011 11:49 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 2011-01-20 11:36, Saurabh wrote:
> I am writing a PLAIN java class which has a Query() Method on it.
>
> In the query method, i connect to the database and retrieve the Objects
> from the database.
> My question is:
> 1. In the Query() method of this plain java class, I can write the code
> for connecting to the database in an eclipse non-UI job.
> OR
> 2. Whoever calls this Query() method can call the Query() method in a
> non-UI job.
>
> I am not sure if i should have an eclipse Job in the Query() method or
> is it expected that the caller of the Query() method should make the
> Query() call in a Job.

If your class type is just a value type, I don't see any good reason for
creating/starting a very framework-specific Eclipse Job within it's
methods. I would expect that the context of starting such a job is
already Eclipse dependent (e.g. within the run() method of an Action
object or similar). Within this Eclipse context exists a good
opportunity to run such dependent Eclipse job. This clearly points to
bullet 2.

A good litmus test is whether there are good reasons to introduce
specific dependencies into a general type. From what you describe so far
I see no such good reasons to make the general type context-dependent.
Given the recommended separation you can reuse your plain Java class in
a non-Eclipse context where you would use a Thread or any other form for
concurrent processing instead of an Eclipse Job.

HTH & Greetings from Bremen,

Daniel Krügler
Re: Eclipse Jobs Usage query [message #649706 is a reply to message #649690] Thu, 20 January 2011 11:55 Go to previous message
Saurabh Mising name is currently offline Saurabh Mising name
Messages: 21
Registered: October 2010
Junior Member
Daniel,
Thanks a lot for the input.
Regards,
Saurabh
Previous Topic:Workaround for Bug 139064 on Linux (JNI: UnsatisfiedLinkError)?
Next Topic:Help is not not launched
Goto Forum:
  


Current Time: Thu Oct 23 03:22:48 GMT 2014

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

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