Package org.fusesource.hawtjournal.api.Journal

Examples of org.fusesource.hawtjournal.api.Journal.WriteCommand


        Location location = new Location();
        location.setSize(size);
        location.setType(type);

        WriteCommand write = new WriteCommand(location, data, sync);
        WriteBatch batch = enqueue(write);

        location.setLatch(batch.getLatch());
        if (sync) {
            try {
View Full Code Here


                            canBatch = currentBatch.canBatch(writeRecord, journal.getMaxWriteBatchSize(), journal.getMaxFileLength());
                            if (!canBatch) {
                                file = journal.rotateWriteFile();
                                currentBatch = new WriteBatch(file, file.getLength());
                            }
                            WriteCommand controlRecord = currentBatch.prepareBatch();
                            currentBatch.appendBatch(writeRecord);
                            if (!writeRecord.isSync()) {
                                journal.getInflightWrites().put(controlRecord.getLocation(), controlRecord);
                                journal.getInflightWrites().put(writeRecord.getLocation(), writeRecord);
                                nextWriteBatch = currentBatch;
                            } else {
                                batchQueue.put(currentBatch);
                            }
View Full Code Here

            accessorLock.unlock();
        }
    }

    Buffer readLocation(Location location) throws IOException {
        WriteCommand asyncWrite = journal.getInflightWrites().get(location);
        Buffer result = null;
        if (asyncWrite != null) {
            result = asyncWrite.getData();
        } else {
            RandomAccessFile raf = getOrCreateRaf(Thread.currentThread(), location.getDataFileId());
            Lock threadLock = getOrCreateLock(Thread.currentThread(), location.getDataFileId());
            accessorLock.lock();
            threadLock.lock();
View Full Code Here

            throw new IOException("Deleted location: " + location);
        }
    }

    boolean fillLocationDetails(Location location) throws IOException {
        WriteCommand asyncWrite = journal.getInflightWrites().get(location);
        if (asyncWrite != null) {
            location.setSize(asyncWrite.getLocation().getSize());
            location.setType(asyncWrite.getLocation().getType());
            return true;
        } else {
            RandomAccessFile raf = getOrCreateRaf(Thread.currentThread(), location.getDataFileId());
            Lock threadLock = getOrCreateLock(Thread.currentThread(), location.getDataFileId());
            accessorLock.lock();
View Full Code Here

TOP

Related Classes of org.fusesource.hawtjournal.api.Journal.WriteCommand

Copyright © 2018 www.massapicom. 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.