private void writeAllEnvelopes ( boolean reuse ) { // perform remove of m:n indirection table entries first performM2NUnlinkEntries ( ) ; Iterator iter ; // using clone to avoid ConcurentModificationException iter = ( ( List ) mvOrderOfIds . clone ( ) ) . iterator ( ) ; while ( iter . hasNext ( ) ) { ObjectEnvelope mod = ( ObjectEnvelope ) mhtObjectEnvelopes . get ( iter . next ( ) ) ; boolean insert = false ; if ( needsCommit ) { insert = mod . needsInsert ( ) ; mod . getModificationState ( ) . commit ( mod ) ; if ( reuse && insert ) { getTransaction ( ) . doSingleLock ( mod . getClassDescriptor ( ) , mod . getObject ( ) , mod . getIdentity ( ) , Transaction . WRITE ) ; } } /* arminw: important to call this cleanup method for each registered ObjectEnvelope, because this method will e.g. remove proxy listener objects for registered objects. */ mod . cleanup ( reuse , insert ) ; } // add m:n indirection table entries performM2NLinkEntries ( ) ; }
commit all envelopes against the current broker