Re: [mdr-users] Using transient storage

Martin Matula <[email protected]> Mon, 13 Mar 2006 14:40:32 +0100
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <[email protected]>
Try using different storage ids. Anyway, deleting the extents would save 
more memory, since otherwise the repository is not garbage collected 
unless the application ends.
Martin

Frank Finger wrote:
> I'm using Netbeans MDR to transform a proprietary model format to UML 
> XMI (standalone). In every run of the transformation, I want to build 
> the model from scratch, export it, and throw the repository away 
> afterwards. That's why I thought that ...memoryimpl.StorageFactoryImpl 
> would be the storage implementation to use.
> A single export works fine, but when exporting twice I run into 
> exceptions. The same exceptions can be produced by the piece of source 
> code below.
>  From a quick look at ...mdr.persistence.memoryimpl.StorageImpl, I 
> thought that not assigning STORAGE_ID values would lead to independent 
> repositories.
> 
> 
> public static void main( String[] args ) throws Exception
> {
>   Map properties = new HashMap();
>   properties.put(
>     "storage",
>     "org.netbeans.mdr.persistence.memoryimpl.StorageFactoryImpl"
>   );
>   // I'm not setting the STORAGE_ID.
>   // properties.put( StorageFactoryImpl.STORAGE_ID, ... );
> 
>   MDRepository firstRepository = new NBMDRepositoryImpl( properties );
>   System.out.println(
>     "firstRepository extents: "+
>     Arrays.asList( firstRepository.getExtentNames() )
>   );
>   MDRepository secondRepository = new NBMDRepositoryImpl( properties );
>   // following line throws exception:
>   System.out.println(
>     "secondRepository extents: "+
>     Arrays.asList( secondRepository.getExtentNames() )
>   );
> }
> 
> The stack trace of the exception is:
> org.netbeans.mdr.util.DebugException: Missing storage files or different 
> storage version.
>   at ...storagemodel.MdrStorage.initializeIndexes(MdrStorage.java:507)
>   at ...storagemodel.MdrStorage.rollback(MdrStorage.java:554)
>   at ...util.TransactionMutex.end(TransactionMutex.java:73)
>   at ...util.MultipleReadersMutex.leave(MultipleReadersMutex.java:173)
>   at ...NBMDRepositoryImpl.endTrans(NBMDRepositoryImpl.java:249)
>   at ...NBMDRepositoryImpl.boot(NBMDRepositoryImpl.java:1331)
>   at ...NBMDRepositoryImpl.initCheck(NBMDRepositoryImpl.java:758)
>   at ...NBMDRepositoryImpl.getExtentNames(NBMDRepositoryImpl.java:347)
>   at Main.main(Main.java:58) /* ="secondRepository.getExtentNames()" */
> 
> 
> Can anybody tell me what I'm doing wrong?
> 
> Thanks in advance,
> Frank