Package org.voltcore.utils.DBBPool

Examples of org.voltcore.utils.DBBPool.BBContainer.b()


                    container = bufferQueue.take();
                    ByteBuffer messageBuffer = container.b();
                    messageBuffer.clear();

                    compressionBufferC = compressionBufferQueue.take();
                    compressionBuffer = compressionBufferC.b();
                    compressionBuffer.clear();
                    compressionBuffer.limit(data.length);
                    compressionBuffer.put(data);
                    compressionBuffer.flip();
                    int uncompressedSize =
View Full Code Here


        RestoreWork restoreWork = null;
        long hsId = msg.getFirst();
        long targetId = msg.getSecond().getFirst();
        BBContainer container = msg.getSecond().getSecond();
        try {
            ByteBuffer block = container.b();
            byte typeByte = block.get(StreamSnapshotDataTarget.typeOffset);
            final int blockIndex = block.getInt(StreamSnapshotDataTarget.blockIndexOffset);
            StreamSnapshotMessageType type = StreamSnapshotMessageType.values()[typeByte];
            if (type == StreamSnapshotMessageType.FAILURE) {
                VoltDB.crashLocalVoltDB("Rejoin source sent failure message.", false, null);
View Full Code Here

            return null;
        }

        decrementNumObjects();
        assertions();
        assert (retcont.b() != null);
        return wrapRetCont(segment, retcont);
    }

    private BBContainer wrapRetCont(final PBDSegment segment, final BBContainer retcont) {
        return new BBContainer(retcont.b()) {
View Full Code Here

                            readBuffer.position(readBuffer.limit());
                            readBuffer.limit(oldLimit);
                        }
                        try {
                            //Handoff the object to the truncator and await a decision
                            ByteBuffer retval = truncator.parse(nextObject.b());
                            if (retval == null) {
                                //Nothing to do, leave the object alone and move to the next
                                continue;
                            } else {
                                //If the returned bytebuffer is empty, remove the object and truncate the file
View Full Code Here

        m_bytesRead += nextUncompressedLength;

        if (compressed) {
            //Get storage for output
            final BBContainer retcont = factory.getContainer(nextUncompressedLength);
            final ByteBuffer retbuf = retcont.b();

            //Limit to appropriate uncompressed size
            retbuf.limit(nextUncompressedLength);

            //Uncompress to output buffer
View Full Code Here

            @Override
            public BBContainer take() throws InterruptedException {
                final Semaphore permits = m_permits.get(bufLenInBytes);
                permits.acquire();
                final BBContainer origin = DBBPool.allocateDirectAndPool(bufLenInBytes);
                return new BBContainer(origin.b()) {
                    @Override
                    public void discard() {
                        checkDoubleFree();
                        permits.release();
                        origin.discard();
View Full Code Here

                    FileInputStream fis = new FileInputStream(f);
                    FileOutputStream fos = new FileOutputStream(fInOtherSubroot);
                    FileChannel inputChannel = fis.getChannel();
                    FileChannel outputChannel = fos.getChannel();
                    BBContainer bufC = DBBPool.allocateDirect(8192);
                    ByteBuffer buf = bufC.b();

                    try {
                        while (inputChannel.read(buf) != -1) {
                            buf.flip();
                            outputChannel.write(buf);
View Full Code Here

        BBContainer output = buffers.output;

        final int maxCompressedLength = Snappy.maxCompressedLength(length);

        final int inputCapacity = input.b().capacity();
        final int outputCapacity = output.b().capacity();

        /*
         * A direct byte buffer might be provided in which case no input buffer is needed
         */
        boolean changedBuffer = false;
View Full Code Here

        if (changedBuffer) {
            buffers = new IOBuffers(input, output);
            m_buffers.set(buffers);
        }
        output.b().clear();
        input.b().clear();

        return buffers;
    }
View Full Code Here

            buffers.output.discard();
            output = DBBPool.allocateDirect(Math.max(outputCapacity * 2, uncompressedLength));
            buffers = new IOBuffers(buffers.input, output);
            m_buffers.set(buffers);
        }
        output.b().clear();

        final int actualUncompressedLength = Snappy.uncompress(compressed, output.b());
        assert(uncompressedLength == actualUncompressedLength);

        byte result[] = new byte[actualUncompressedLength];
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.