public RecordLocation getNextRecordLocation()

in activeio-core/src/main/java/org/apache/activeio/journal/active/JournalImpl.java [363:388]


    public RecordLocation getNextRecordLocation(final RecordLocation lastLocation) throws IOException,
            InvalidRecordLocationException {
        
        if (lastLocation == null) {
            if (lastMarkedLocation != null) {
                return lastMarkedLocation;
            } else {
                return file.getFirstActiveLogLocation();
            }
        }

        // Run this in the queued executor thread.
        try {
            final FutureTask result = new FutureTask(new Callable() {
                public Object call() throws Exception {
                    return queuedGetNextRecordLocation((Location) lastLocation);
                }});
            executor.execute(result);
            return (Location) result.get();
        } catch (InterruptedException e) {
            throw (IOException) new IOException("Interrupted.").initCause(e);
        }
        catch (ExecutionException e) {
            throw handleExecutionException(e);
        }
    }