Package freenet.support.api.LockableRandomAccessBuffer

Examples of freenet.support.api.LockableRandomAccessBuffer.RAFLock.unlock()


        RAFLock lock = raf.lockOpen();
        try {
            raf.pread(fileOffset, buf, offset, length);
            raf.pread(fileOffset+length, checksumBuf, 0, checksumLength);
        } finally {
            lock.unlock();
        }
        if(!checksumChecker.checkChecksum(buf, offset, length, checksumBuf)) {
            Arrays.fill(buf, offset, offset+length, (byte)0);
            throw new ChecksumFailedException();
        }
View Full Code Here


            length = (int)len;
            buf = new byte[length];
            raf.pread(fileOffset+lengthBuf.length, buf, 0, length);
            raf.pread(fileOffset+length+lengthBuf.length, checksumBuf, 0, checksumLength);
        } finally {
            lock.unlock();
        }
        if(!checksumChecker.checkChecksum(buf, 0, length, checksumBuf)) {
            Arrays.fill(buf, 0, length, (byte)0);
            throw new ChecksumFailedException();
        }
View Full Code Here

            parent.failOnDiskError(e);
        } catch (Throwable t) {
            Logger.error(this, "Failed: "+t, t);
            parent.fail(new InsertException(InsertExceptionMode.INTERNAL_ERROR, t, null));
        } finally {
            if(lock != null) lock.unlock();
        }
    }

    /** Generate keys for each block and record them.
     * @throws IOException */
 
View Full Code Here

        RAFLock lock = parent.lockUnderlying();
        try {
            for(int i=0;i<dataBlockCount;i++)
                data[i] = readDataBlock(i);
        } finally {
            lock.unlock();
        }
        for(int i=0;i<crossCheckBlockCount;i++)
            data[i+dataBlockCount] = readCrossCheckBlock(i);
        return data;
    }
View Full Code Here

        RAFLock lock = raf.lockOpen();
        try {
            raf.pread(fileOffset, buf, offset, length);
            raf.pread(fileOffset+length, checksumBuf, 0, checker.checksumLength());
        } finally {
            lock.unlock();
        }
        if(!checker.checkChecksum(buf, offset, length, checksumBuf)) {
            Arrays.fill(buf, offset, offset+length, (byte)0);
            throw new ChecksumFailedException();
        }
View Full Code Here

            length = (int)len;
            buf = new byte[length];
            raf.pread(fileOffset+lengthBuf.length, buf, 0, length);
            raf.pread(fileOffset+length+lengthBuf.length, checksumBuf, 0, checker.checksumLength());
        } finally {
            lock.unlock();
        }
        if(!checker.checkChecksum(buf, 0, length, checksumBuf)) {
            Arrays.fill(buf, 0, length, (byte)0);
            throw new ChecksumFailedException();
        }
View Full Code Here

        RAFLock lock = parent.lockRAF();
        try {
            for(int i=0;i<checkBlocks.length;i++)
                writeCheckBlock(i, checkBlocks[i]);
        } finally {
            lock.unlock();
        }
    }

    private void writeCheckBlock(int checkBlockNo, byte[] buf) throws IOException {
        parent.writeCheckBlock(segNo, checkBlockNo, buf);
View Full Code Here

                    segments[i].setKey(blockNumbers[i], key);
                }
            }
            return data;
        } finally {
            lock.unlock();
        }
    }

    public synchronized boolean isFinishedEncoding() {
        return encoded;
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.