Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Eclipse Jobs and Hibernate
Eclipse Jobs and Hibernate [message #324357] Wed, 23 January 2008 14:39 Go to next message
Piotr Górny is currently offline Piotr GórnyFriend
Messages: 72
Registered: July 2009
Member
Hi,
I've got strange problem with Hibernate used as database persistence system
when invoking a few database queries in separate jobs.

My screnario looks this way:
I have a class called LogonManager (extends Job) which calls about 10
job steps using:
protected IStatus run(final IProgressMonitor monitor)
{
final IWorkbench workbench = PlatformUI.getWorkbench();
final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
final Shell shell = window != null ? window.getShell() : null;

final IRunnableWithProgress runnableWithProgress = new
IRunnableWithProgress()
{
public void run(final IProgressMonitor monitor) throws
InvocationTargetException, InterruptedException
{
try
{
monitor.beginTask("my job", , IProgressMonitor.UNKNOWN);
for (ILogonStep step : steps)
{
monitor.subTask(step.getLogonStepName());
step.execLogonStep(new SubProgressMonitor(monitor, 1));
}
}
finally
{
monitor.done();
}
}
}
}

Each step does some database querying by opeing its own transaction,
sending query,
getting results and doing something with them.

Unfortunately lately my application hungs up at random steps, and I have
discovered
that it stop when calling:
session.createQuery(...)

Does anyone have any idea what problem can be here?
Is it connected to Eclipse's jobs?

I'll ask the same question on hibernate forum, but I wander if this
isn't connected
with jobs architecture of Eclipse - that's why I've asked here too.

--
Piotr
Re: Eclipse Jobs and Hibernate [message #324397 is a reply to message #324357] Wed, 23 January 2008 21:39 Go to previous messageGo to next message
Snjezana Peco is currently offline Snjezana PecoFriend
Messages: 789
Registered: July 2009
Senior Member
This problem isn't related to Eclipse's jobs.
Do you commit/rollback the transactions that you open in your steps?

Snjeza

Piotr Górny wrote:
> Hi,
> I've got strange problem with Hibernate used as database persistence system
> when invoking a few database queries in separate jobs.
>
> My screnario looks this way:
> I have a class called LogonManager (extends Job) which calls about 10
> job steps using:
> protected IStatus run(final IProgressMonitor monitor)
> {
> final IWorkbench workbench = PlatformUI.getWorkbench();
> final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
> final Shell shell = window != null ? window.getShell() : null;
>
> final IRunnableWithProgress runnableWithProgress = new
> IRunnableWithProgress()
> {
> public void run(final IProgressMonitor monitor) throws
> InvocationTargetException, InterruptedException
> {
> try
> {
> monitor.beginTask("my job", , IProgressMonitor.UNKNOWN);
> for (ILogonStep step : steps)
> {
> monitor.subTask(step.getLogonStepName());
> step.execLogonStep(new SubProgressMonitor(monitor, 1));
> }
> }
> finally
> {
> monitor.done();
> }
> }
> }
> }
>
> Each step does some database querying by opeing its own transaction,
> sending query,
> getting results and doing something with them.
>
> Unfortunately lately my application hungs up at random steps, and I have
> discovered
> that it stop when calling:
> session.createQuery(...)
>
> Does anyone have any idea what problem can be here?
> Is it connected to Eclipse's jobs?
>
> I'll ask the same question on hibernate forum, but I wander if this
> isn't connected
> with jobs architecture of Eclipse - that's why I've asked here too.
>
> --
> Piotr
Re: Eclipse Jobs and Hibernate [message #324408 is a reply to message #324397] Thu, 24 January 2008 06:04 Go to previous messageGo to next message
Piotr Górny is currently offline Piotr GórnyFriend
Messages: 72
Registered: July 2009
Member
Snjezana Peco pisze:
> This problem isn't related to Eclipse's jobs.
> Do you commit/rollback the transactions that you open in your steps?
>
> Snjeza
[cut]

Yes, I do... Each step has opens its own transaction and commits or
rollback it.

--
Piotr
Re: Eclipse Jobs and Hibernate [message #324468 is a reply to message #324408] Thu, 24 January 2008 19:42 Go to previous messageGo to next message
Snjezana Peco is currently offline Snjezana PecoFriend
Messages: 789
Registered: July 2009
Senior Member
Is your step.execLogonStep method executed in a separate job or thread?

Snjeza

Piotr Górny wrote:
> Snjezana Peco pisze:
>> This problem isn't related to Eclipse's jobs.
>> Do you commit/rollback the transactions that you open in your steps?
>>
>> Snjeza
> [cut]
>
> Yes, I do... Each step has opens its own transaction and commits or
> rollback it.
>
> --
> Piotr
Re: Eclipse Jobs and Hibernate [message #324495 is a reply to message #324468] Fri, 25 January 2008 07:36 Go to previous messageGo to next message
Piotr Górny is currently offline Piotr GórnyFriend
Messages: 72
Registered: July 2009
Member
Snjezana Peco pisze:
> Is your step.execLogonStep method executed in a separate job or thread?
>
> Snjeza
>
> Piotr Górny wrote:
>> Snjezana Peco pisze:
>>> This problem isn't related to Eclipse's jobs.
>>> Do you commit/rollback the transactions that you open in your steps?
>>>
>>> Snjeza
>> [cut]
>>
>> Yes, I do... Each step has opens its own transaction and commits or
>> rollback it.
>>
>> --
>> Piotr

It is a substep of the main job. One tick of the main job is the whole
time of this step.
It's like you call: new SubProgressMonitor(monitor, 1) on the main job.
Inside the step:

try
{
monitor.beginTask(STEP_NAME, IProgressMonitor.UNKNOWN);
...
}
finally
{
monitor.done();
}

--
Piotr
Re: Eclipse Jobs and Hibernate [message #324607 is a reply to message #324495] Tue, 29 January 2008 00:37 Go to previous message
Snjezana Peco is currently offline Snjezana PecoFriend
Messages: 789
Registered: July 2009
Senior Member
You probably have a deadlock in some of your steps. Try to execute the
steps sequentially (without Eclipse job)

Snjeza


Piotr Górny wrote:
> Snjezana Peco pisze:
>> Is your step.execLogonStep method executed in a separate job or thread?
>>
>> Snjeza
>>
>> Piotr Górny wrote:
>>> Snjezana Peco pisze:
>>>> This problem isn't related to Eclipse's jobs.
>>>> Do you commit/rollback the transactions that you open in your steps?
>>>>
>>>> Snjeza
>>> [cut]
>>>
>>> Yes, I do... Each step has opens its own transaction and commits or
>>> rollback it.
>>>
>>> --
>>> Piotr
>
> It is a substep of the main job. One tick of the main job is the whole
> time of this step.
> It's like you call: new SubProgressMonitor(monitor, 1) on the main job.
> Inside the step:
>
> try
> {
> monitor.beginTask(STEP_NAME, IProgressMonitor.UNKNOWN);
> ...
> }
> finally
> {
> monitor.done();
> }
>
> --
> Piotr
Previous Topic:TextCellEditor and double-click
Next Topic:detect if eclipse is ruinning on vista
Goto Forum:
  


Current Time: Fri Apr 26 04:58:48 GMT 2024

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

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

Back to the top