Currently when I update an itemstate, I need to acquire a cluster lock
(Journal.doLock()). This lock will block any update on others itemstates. I
want to only lock *one* itemstate in the cluster. So I want to modify the
SharedISM.update( ). (I donot use XA). Is there any side-effect? 

    public void update(ChangeLog local, EventStateCollectionFactory factory)
                        throws ReferentialIntegrityException, 
StaleItemStateException,
                        ItemStateException {
        
                // beginUpdate(oneItemLog, factory, null).end();
                
                Iterator deletedStates = local.deletedStates();
                while (deletedStates.hasNext()) {
                        ItemState state = (ItemState) deletedStates.next();
                        updateOneItemState(state, factory);
                }
                Iterator modifiedStates = local.modifiedStates();
                while (modifiedStates.hasNext()) {
                        ItemState state = (ItemState) modifiedStates.next();
                        updateOneItemState(state, factory);

                }
                Iterator addedStates = local.addedStates();
                while (addedStates.hasNext()) {
                        ItemState state = (ItemState) addedStates.next();
                        updateOneItemState(state, factory);
                }
        }

    private void updateOneItemState(ItemState state,
EventStateCollectionFactory factory)
        throws ReferentialIntegrityException, StaleItemStateException,
ItemStateException{
        ChangeLog oneItemLog  = new ChangeLog();
        oneItemLog.added(state);
         try {
           doLock(state);//Only lock this state in the cluster
           beginUpdate(oneItemLog, factory, null).end();
         }finally{
           unLock(state);
         }
    }
-- 
View this message in context: 
http://www.nabble.com/Replace-cluster-wide-lock-to-itemstate-wide-lock-tp22083258p22083258.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Reply via email to