Re: [mdr-users] Corrupted repository (was [mdr-users] MDR and Swing)

Dimitrios Kolovos <[email protected]> Wed, 05 Oct 2005 13:17:32 +0100
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <[email protected]>
Hi Jaroslav,

I have overcome this issue. In fact it was a place in my code where I 
was not shutting down my repository :( Thanks for your help!

Cheers,
Dimitrios

Jaroslav Drazan wrote:

> Hi Dimitrios,
> I don't know what can cause this exception but it seems you delete the 
> metamodel which was instantiated and in which you loaded (or created) 
> some model you want to access. I'm sure that I have already seen such 
> Eception in my code when stared with MDR but I don't forget what 
> exactly caused it.
> I think I can help you if you send me the source code where you work 
> with the repository.
>
> Regards
> Jarda
>
>
>>  Hi Jarda,
>>  
>>  I do call the shutdown() method on my repository (even tried the 
>>  MDRManager.shutdownAll()). The trace of the exception I get is the 
>>  following:
>>  
>>  Exception in thread "main" org.netbeans.mdr.util.DebugException
>>      at 
>>  org.netbeans.mdr.handlers.MDRClassLoader.resolveInterface(MDRClassLoader.java:118) 
>>
>>      at 
>>  org.netbeans.mdr.handlers.BaseObjectHandler.resolveClass(BaseObjectHandler.java:147) 
>>
>>      at 
>>  org.netbeans.mdr.NBMDRepositoryImpl.getHandler(NBMDRepositoryImpl.java:612) 
>>
>>      at 
>>  org.netbeans.mdr.handlers.IndexSetWrapper.wrap(IndexSetWrapper.java:53)
>>      at 
>>  org.netbeans.mdr.handlers.IndexSetWrapper$IndexIteratorWrapper.next(IndexSetWrapper.java:228) 
>>
>>      at org.xol.models.mdr.MDRModel.findMetaClass(MDRModel.java:216)
>>  
>>  If I delete the btd btx etc and re-run the program, it works. As for 
>> the  version it is a couple of weeks old. I ll try today's build but 
>> I doubt  it will help...
>>  
>>  Cheers,
>>  Dimitrios
>>  
>>  Jaroslav Drazan wrote:
>>  
>>  > Hi Dimitrios,
>>  > I need to see the DebugException which are thrown (and maybe it 
>> can be  > some bug of MDR or an issue for Martin Matula). The 
>> possible problem  > could be not calling shutdown() method on 
>> MDRManager (or  > MDRrepository, I'm not sure) otherwise I need to 
>> see the log or the  > source code.
>>  >
>>  > Maybe you can also try some newer version of MDR (I don't know 
>> which  > version do you use).
>>  >
>>  > Regards
>>  > Jarda
>>  >
>>  >>  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.
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>   >>   >>   >
>>  >>  >
>>  >>   >>   >>   >
>>  >
>>  
>>  
>>  
>
>