Package org.eclipse.jetty.util

Examples of org.eclipse.jetty.util.Callback


        }

        @Override
        void onEnter(final AbstractConnection connection)
        {
            Callback callback=new Callback()
            {
                @Override
                public void succeeded()
                {
                    while(true)
View Full Code Here


            if (request.isAsyncSupported() &&
                min_async_size>0 &&
                resource.length()>=min_async_size)
            {
                final AsyncContext async = request.startAsync();
                Callback callback = new Callback()
                {
                    @Override
                    public void succeeded()
                    {
                        async.complete();
View Full Code Here

     * @param content The content to send
     * @param callback The callback to use to notify success or failure
     */
    public void sendContent(ByteBuffer content, final Callback callback)
    {
        write(content,true,new Callback()
        {
            @Override
            public void succeeded()
            {
                closed();
View Full Code Here

        }

        @Override
        void onEnter(final AbstractConnection connection)
        {
            Callback callback=new Callback()
            {
                @Override
                public void succeeded()
                {
                    while(true)
View Full Code Here

    /* ------------------------------------------------------------ */
    /** Call to signal that a read is now possible.
     */
    public void fillable()
    {
        Callback callback=_interested.get();
        if (callback!=null && _interested.compareAndSet(callback,null))
            callback.succeeded();
    }
View Full Code Here

    /* ------------------------------------------------------------ */
    /** Call to signal a failure to a registered interest
     */
    public void onFail(Throwable cause)
    {
        Callback callback=_interested.get();
        if (callback!=null && _interested.compareAndSet(callback,null))
            callback.failed(cause);
    }
View Full Code Here

    }
   
    /* ------------------------------------------------------------ */
    public void onClose()
    {
        Callback callback=_interested.get();
        if (callback!=null && _interested.compareAndSet(callback,null))
            callback.failed(new ClosedChannelException());
    }
View Full Code Here

                // write the content asynchronously if supported
                if (request.isAsyncSupported())
                {
                    final AsyncContext context = request.startAsync();

                    ((HttpOutput)out).sendContent(content,new Callback()
                    {
                        @Override
                        public void succeeded()
                        {  
                            context.complete();
View Full Code Here

            if (info==null)
                info = _response.newResponseInfo();

            // wrap callback to process 100 or 500 responses
            final int status=info.getStatus();
            final Callback committed = (status<200&&status>=100)?new Commit100Callback(callback):new CommitCallback(callback);

            // committing write
            _transport.send(info, content, complete, committed);
        }
        else if (info==null)
View Full Code Here

                _response.getHttpOutput().closed();
            }
            else
            {
                LOG.warn("Commit failed",x);
                _transport.send(HttpGenerator.RESPONSE_500_INFO,null,true,new Callback()
                {
                    @Override
                    public void succeeded()
                    {
                        _callback.failed(x);
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.util.Callback

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.