Package org.glassfish.grizzly

Examples of org.glassfish.grizzly.WriteHandler


            } catch (Exception ignored) {
            }
        }

        private static void onError0(final OutputBuffer ob, final Throwable t) {
            final WriteHandler localHandler = ob.handler;

            if (localHandler != null) {
                try {
                    ob.handler = null;
                    localHandler.onError(t);
                } catch (Exception ignored) {
                }
            }
        }
View Full Code Here


            // prepare context for suspend
            final NextAction suspendAction = ctx.getSuspendAction();
            ctx.suspend();

            // notify when connection becomes writable, so we can resume it
            output.notifyCanWrite(new WriteHandler() {
                @Override
                public void onWritePossible() throws Exception {
                    finish();
                }
View Full Code Here

        }
       
        final int maxQueueSize = maxQueueSizeHolder.getMaxQueueSize();
       
        while(spaceInBytes() <= maxQueueSize) {
            WriteHandler writeHandler = pollWriteHandler();
            if (writeHandler == null) {
                return;
            }
           
            try {
                writeHandler.onWritePossible();
            } catch (Throwable e) {
                writeHandler.onError(e);
            }
        }
    }
View Full Code Here

            while ((record = poll()) != null) {
                record.notifyFailure(error);
            }
        }
       
        WriteHandler writeHandler;
        while ((writeHandler = pollWriteHandler()) != null) {
            if (error == null) {
                error = new IOException("Connection closed", cause);
            }
            writeHandler.onError(error);
        }
    }
View Full Code Here

       
        return false;
    }

    private WriteHandler pollWriteHandler() {
        final WriteHandler record = writeHandlersQueue.poll();
        if (record != null) {
            writeHandlersCounter.decrementAndGet();
            return record;
        }
       
View Full Code Here

        @Override
        public boolean isValid() {
            if (!connection.canWrite()) {
                try {
                    connection.notifyCanWrite(new WriteHandler() {
                        @Override
                        public void onWritePossible() throws Exception {
                            TaskProcessor.processQueue(taskQueue, WriterCondition.this);
                        }
View Full Code Here

        private static void blockUntilQueueFree(final FilterChainContext ctx) {
            HttpContext httpContext = HttpContext.get(ctx);
            final OutputSink outputSink = httpContext.getOutputSink();
            if (!outputSink.canWrite()) {
                final FutureImpl<Boolean> future = Futures.createSafeFuture();
                outputSink.notifyCanWrite(new WriteHandler() {

                    @Override
                    public void onWritePossible() throws Exception {
                        future.result(TRUE);
                    }
View Full Code Here

TOP

Related Classes of org.glassfish.grizzly.WriteHandler

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.