Examples of allowBufferDispose()


Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

        if (hasContent) {
            httpChunkBuffer = Buffers.appendBuffers(memoryManager,
                    httpChunkBuffer, content);
            if (httpChunkBuffer.isComposite()) {
                httpChunkBuffer.allowBufferDispose(true);
                ((CompositeBuffer) httpChunkBuffer).allowInternalBuffersDispose(true);
                ((CompositeBuffer) httpChunkBuffer).disposeOrder(DisposeOrder.FIRST_TO_LAST);
            }
        }
       
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

       
        httpChunkTrailer = put(memoryManager, httpChunkTrailer,
                HttpCodecFilter.CRLF_BYTES);

        httpChunkTrailer.trim();
        httpChunkTrailer.allowBufferDispose(true);

        return Buffers.appendBuffers(memoryManager, httpChunkBuffer,
                httpChunkTrailer);
    }
}
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

     * @throws IOException if an error occurs during the write
     */
    @SuppressWarnings({"unchecked", "UnusedDeclaration"})
    public void writeByteBuffer(final ByteBuffer byteBuffer) throws IOException {
        final Buffer w = Buffers.wrap(memoryManager, byteBuffer);
        w.allowBufferDispose(false);
        writeBuffer(w);
    }


    /**
 
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

//        final byte[] clonedBytes = Arrays.copyOfRange(heap,
//                offset + pos, offset + lim);
        final int length = remaining();
       
        final Buffer buffer = MemoryManager.DEFAULT_MEMORY_MANAGER.allocate(length);
        buffer.allowBufferDispose(true);
        buffer.put(heap, offset + pos, length);
        buffer.flip();

        // reset the mutable buffer content with the cloned array
//        reset(clonedBytes, 0, clonedBytes.length);
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

                    encodedBuffer = put(memoryManager,
                                        encodedBuffer,
                                        CRLF_BYTES);
                    onInitialLineEncoded(httpHeader, ctx);
                    encodedBuffer.trim();
                    encodedBuffer.allowBufferDispose(true);

                    HttpProbeNotifier.notifyHeaderSerialize(this, connection,
                            httpHeader, encodedBuffer);

                    response.acknowledged();
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

            final byte[] tempEncodingBuffer = httpHeader.getTempHeaderEncodingBuffer();
            encodedBuffer = encodeMimeHeaders(memoryManager, encodedBuffer, mimeHeaders, tempEncodingBuffer);
            onHttpHeadersEncoded(httpHeader, ctx);
            encodedBuffer = put(memoryManager, encodedBuffer, CRLF_BYTES);
            encodedBuffer.trim();
            encodedBuffer.allowBufferDispose(true);
           
            httpHeader.setCommitted(true);

            HttpProbeNotifier.notifyHeaderSerialize(this, connection, httpHeader,
                    encodedBuffer);
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

            try {
                boolean isLast;
                do {
                    final Buffer buffer = ctx.getMemoryManager().allocate(chunkSize);
                    buffer.allowBufferDispose(true);
                   
                    final long readNow = Buffers.readFromFileChannel(fc, buffer);
                    isLast = readNow <= 0 || (remaining -= readNow) <= 0;

                    buffer.trim();
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

            buffer.put(b, 0, read);
        }
        buffer.trim();
        if (buffer.hasRemaining()) {
            final HttpContent content = requestPacket.httpContentBuilder().content(buffer).build();
            buffer.allowBufferDispose(false);
            content.setLast(true);
            ctx.write(content, ((!requestPacket.isCommitted()) ? ctx.getTransportContext().getCompletionHandler() : null));
        }
        return true;
    }
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

                try {
                    final MemoryManager mm = ctx.getMemoryManager();
                    boolean last = false;
                    while (!last) {
                        Buffer buffer = mm.allocate(BodyHandler.MAX_CHUNK_SIZE);
                        buffer.allowBufferDispose(true);
                        final long readBytes = bodyLocal.read(buffer.toByteBuffer());
                        if (readBytes > 0) {
                            buffer.position((int) readBytes);
                            buffer.trim();
                        } else {
View Full Code Here

Examples of org.glassfish.grizzly.Buffer.allowBufferDispose()

        final MemoryManager mm = ctx.getMemoryManager();
        boolean last = false;

        while (!last) {
            Buffer buffer = mm.allocate(MAX_CHUNK_SIZE);
            buffer.allowBufferDispose(true);

            final long readBytes = bodyLocal.read(buffer.toByteBuffer());
            if (readBytes > 0) {
                buffer.position((int) readBytes);
                buffer.trim();
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.