Search in sources :

Example 1 with Latch

use of org.apache.derby.iapi.services.locks.Latch in project derby by apache.

the class LockTable method next.

/**
 *		@see java.sql.ResultSet#next
 *		@exception SQLException if no transaction context can be found, or other
 *		Derby internal errors are encountered.
 */
public boolean next() throws SQLException {
    try {
        if (!initialized) {
            LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
            tc = lcc.getTransactionExecute();
            LockFactory lf = tc.getAccessManager().getLockFactory();
            lockTable = lf.makeVirtualLockTable();
            initialized = true;
            tabInfo = new TableNameInfo(lcc, true);
        }
        currentRow = null;
        if (lockTable != null) {
            while (lockTable.hasMoreElements() && (currentRow == null)) {
                currentRow = dumpLock((Latch) lockTable.nextElement());
            }
        }
    } catch (StandardException se) {
        throw PublicAPI.wrapStandardException(se);
    }
    return (currentRow != null);
}
Also used : StandardException(org.apache.derby.shared.common.error.StandardException) LanguageConnectionContext(org.apache.derby.iapi.sql.conn.LanguageConnectionContext) TableNameInfo(org.apache.derby.impl.services.locks.TableNameInfo) Latch(org.apache.derby.iapi.services.locks.Latch) LockFactory(org.apache.derby.iapi.services.locks.LockFactory)

Example 2 with Latch

use of org.apache.derby.iapi.services.locks.Latch in project derby by apache.

the class LockTableVTI method nextElement.

public Object nextElement() {
    if (!hasMoreElements())
        throw new NoSuchElementException();
    Latch ret = nextLock;
    nextLock = null;
    return ret;
}
Also used : Latch(org.apache.derby.iapi.services.locks.Latch) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

Latch (org.apache.derby.iapi.services.locks.Latch)2 NoSuchElementException (java.util.NoSuchElementException)1 LockFactory (org.apache.derby.iapi.services.locks.LockFactory)1 LanguageConnectionContext (org.apache.derby.iapi.sql.conn.LanguageConnectionContext)1 TableNameInfo (org.apache.derby.impl.services.locks.TableNameInfo)1 StandardException (org.apache.derby.shared.common.error.StandardException)1