Re: [mdr-users] MDR and Swing

Dimitrios Kolovos <[email protected]> Thu, 22 Sep 2005 14:16:54 +0100
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <[email protected]>
Hi Jarda,

Thanks for your response. Skipping transactions solved the threading 
problem (and I really thank you for that!). However, (as usually) every 
solution creates another problem :) Now my repository gets corrupted 
everly time so between two successive "runs" of my program, I have to 
delete the btd, btx files or else I get a lot of "DebugExceptions". If I 
turn transactions on again, everything (except for the threads of 
course) works fine. Any ideas on how to overcome this?

Cheers,
Dimitrios

Jaroslav Drazan wrote:

> Hi Dimitrios,
> the possible problem can be MDR transactions - if you start a 
> transaction from some threadXXX, you cannot access the repository from 
> another thread (if you do so, the another thread waits until the 
> threadXXX does not finish the transaction).
>
> We had the similar problem - we started a transaction from the main 
> thread and when we accessed the repository frm the AWT-thread - the 
> application freezed. The possible solution in our case were to access 
> the repository from just one thread or not to use MDR transaction.
>
> We have used Eclipse and swing as well and everything (after solving 
> the problem mentioned above) works fine.
>
> Regards
> Jarda
>
>>  Hi Martin,
>>  
>>  Thanks for your reply. Yes, the application freezes forever. I have 
>>  looked into it and managed to get somehow deeper into the problem. I 
>>  believe it has to do with threads and it is not limited to Swing only.
>>  
>>  For example when I populate a RefPackage (e.g. refPackage) in the 
>> main  method of my (Swing) program and try to access it on a button 
>> click  event - AbstractAction.perform() -, since the perform() 
>> function is run  by the dispatcher in a different thread, I get no 
>> response (the code  freezes at the statement I try to access e.g. 
>> refPackage.refAllClasses()  and the statement does not return!). 
>> However, if I populate refPackage  inside the perform() method (so 
>> that it is in the same thread with the  accessing code), everything 
>> works fine. Any ideas?
>>  
>>  Cheers,
>>  Dimitrios
>>  
>>  Martin Matula wrote:
>>  
>>  > Hi Dimitrios,
>>  > what kind of freezing do you mean? Does your application freeze 
>> forever?
>>  > Martin
>>  >
>>  > Dimitrios Kolovos wrote:
>>  >
>>  >> I am working on a small utility that displays and MDR model in a 
>>  >> JTree. In generally I face a lot of execution "freezing" issues 
>> and I  >> often have to call SwingUtilities.invokeLater() to prevent 
>> execution  >> from freezing where MDR is involved. Does anyone else 
>> have similar  >> (bad) experience (and hopefully come up with a 
>> solution) with MDR and  >> JTree (or Swing in general)?
>>  >>
>>  >> Cheers,
>>  >> Dimitrios
>>  >>
>>  >> P.S. I use Eclipse for Java development in case that makes a 
>> difference.
>>  >
>>  >
>>  >
>>  >
>>  
>>  
>>  
>
>