Search in sources :

Example 1 with CurrentNotificationEventId

use of org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId in project hive by apache.

the class ObjectStore method getCurrentNotificationEventId.

@Override
public CurrentNotificationEventId getCurrentNotificationEventId() {
    boolean commited = false;
    Query query = null;
    try {
        openTransaction();
        query = pm.newQuery(MNotificationNextId.class);
        Collection<MNotificationNextId> ids = (Collection) query.execute();
        long id = 0;
        if (ids != null && ids.size() > 0) {
            id = ids.iterator().next().getNextEventId() - 1;
        }
        commited = commitTransaction();
        return new CurrentNotificationEventId(id);
    } finally {
        if (!commited) {
            rollbackTransaction();
        }
        if (query != null) {
            query.closeAll();
        }
    }
}
Also used : Query(javax.jdo.Query) MNotificationNextId(org.apache.hadoop.hive.metastore.model.MNotificationNextId) Collection(java.util.Collection) CurrentNotificationEventId(org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId)

Aggregations

Collection (java.util.Collection)1 Query (javax.jdo.Query)1 CurrentNotificationEventId (org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId)1 MNotificationNextId (org.apache.hadoop.hive.metastore.model.MNotificationNextId)1