org.apache.jackrabbit.mk.util
Class CommitGate

java.lang.Object
  extended by org.apache.jackrabbit.mk.util.CommitGate

public class CommitGate
extends Object

A gate where listeners can wait for a new commit.


Constructor Summary
CommitGate()
           
 
Method Summary
 void commit(String newHead)
          Commit a new head.
 String waitForCommit(String lastHead, long millis)
          Wait for a new commit to occur.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommitGate

public CommitGate()
Method Detail

waitForCommit

public String waitForCommit(String lastHead,
                            long millis)
                     throws InterruptedException
Wait for a new commit to occur. In very few cases, this method may return with the old head before the requested timeout.

Parameters:
lastHead - the last head
millis - the maximum number of milliseconds to wait (0 means don't wait)
Returns:
the new head (or old head, if no new commit occurred)
Throws:
InterruptedException - if the thread was interrupted

commit

public void commit(String newHead)
Commit a new head. Waiting threads are awoken.

Parameters:
newHead - the new head


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.