Gang,

I tried to create a general EntityStore Cleaner, which would remove
all entities in the all EntityStores in the current module. To ensure
that Testcases cleanup their crap properly.

It is easy to iterate the EntityStore via

    EntityStoreUnitOfWork visitEntityStates( final EntityStateVisitor
visitor, Module moduleInstance );

BUT, since removal will load the entities and a commit can not happen
until after the above method returns, it is not possible to do batches
of let's say 1000 entities, to ensure that memory is not exhausted.

I propose a change to the EntityStateVisitor interface, so that the
EntityStoreUnitOfWork is passed in the method call;

    interface EntityStateVisitor
    {
        void visitEntityState( EntityState entityState,
EntityStoreUnitOfWork esuow );
    }

And that this change is propagated equally to the MapEntityStoreVisitor

    interface MapEntityStoreVisitor
    {
        void visitEntity( Reader entityState, EntityStoreUnitOfWork esuow );
    }

This allows the visitor to do intermediary commits if needed.

WDYT?


Cheers
-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to