Examples of SecondaryCursor


Examples of com.sleepycat.je.SecondaryCursor

        }
    }

    public MessageIdentity getLastestMessageIdentity() throws JMSException {
        checkClosed();
        SecondaryCursor cursor = null;
        try {
            cursor = getSecondaryDatabase().openSecondaryCursor(BDbHelper.getTransaction(), getCursorConfig());
            DatabaseEntry keyEntry = new DatabaseEntry();
            DatabaseEntry valueEntry = new DatabaseEntry();
            OperationStatus status = cursor.getLast(keyEntry, valueEntry, LockMode.DEFAULT);
            if (status == OperationStatus.SUCCESS) {
                if (log.isDebugEnabled()) {
                    log.debug("Loaded last sequence number of: " + BDbHelper.longFromBytes(keyEntry.getData()));
                }
                return new MessageIdentity(null, keyEntry);
            }
            else if (status != OperationStatus.NOTFOUND) {
                log.error("Could not find the last sequence number. Status: " + status);
            }
            return null;
        }
        catch (DatabaseException e) {
            throw JMSExceptionHelper.newJMSException("Unable to load the last sequence number. Reason: " + e, e);
        }
        finally {
            if (cursor != null) {
                try {
                    cursor.close();
                }
                catch (DatabaseException e) {
                    log.warn("Caught exception closing cursor: " + e, e);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.