Java Code Examples for org.apache.coyote.Processor#isUpgrade()

The following examples show how to use org.apache.coyote.Processor#isUpgrade() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Http11AprProtocol.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation") // Inbound/Outbound based upgrade
@Override
protected void longPoll(SocketWrapper<Long> socket,
        Processor<Long> processor) {

    if (processor.isAsync()) {
        // Async
        socket.setAsync(true);
    } else if (processor.isComet()) {
        // Comet
        if (proto.endpoint.isRunning()) {
            socket.setComet(true);
            ((AprEndpoint) proto.endpoint).getPoller().add(
                    socket.getSocket().longValue(),
                    proto.endpoint.getSoTimeout(), true, false);
        } else {
            // Process a STOP directly
            ((AprEndpoint) proto.endpoint).processSocket(
                    socket.getSocket().longValue(),
                    SocketStatus.STOP);
        }
    } else if (processor.isUpgrade()) {
        // Upgraded
        Poller p = ((AprEndpoint) proto.endpoint).getPoller();
        if (p == null) {
            // Connector has been stopped
            release(socket, processor, true, false);
        } else {
            p.add(socket.getSocket().longValue(), -1, true, false);
        }
    } else {
        // Tomcat 7 proprietary upgrade
        ((AprEndpoint) proto.endpoint).getPoller().add(
                socket.getSocket().longValue(),
                processor.getUpgradeInbound().getReadTimeout(),
                true, false);
    }
}
 
Example 2
Source File: Http11NioProtocol.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Expected to be used by the Poller to release resources on socket
 * close, errors etc.
 */
@Override
public void release(SocketWrapper<NioChannel> socket) {
    Processor<NioChannel> processor =
        connections.remove(socket.getSocket());
    if (processor != null) {
        processor.recycle(true);
        if (!processor.isUpgrade()) {
            recycledProcessors.offer(processor);
        }
    }
}
 
Example 3
Source File: Http11AprProtocol.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation") // Inbound/Outbound based upgrade
@Override
protected void longPoll(SocketWrapper<Long> socket,
        Processor<Long> processor) {

    if (processor.isAsync()) {
        // Async
        socket.setAsync(true);
    } else if (processor.isComet()) {
        // Comet
        if (proto.endpoint.isRunning()) {
            socket.setComet(true);
            ((AprEndpoint) proto.endpoint).getPoller().add(
                    socket.getSocket().longValue(),
                    proto.endpoint.getSoTimeout(), true, false);
        } else {
            // Process a STOP directly
            ((AprEndpoint) proto.endpoint).processSocket(
                    socket.getSocket().longValue(),
                    SocketStatus.STOP);
        }
    } else if (processor.isUpgrade()) {
        // Upgraded
        Poller p = ((AprEndpoint) proto.endpoint).getPoller();
        if (p == null) {
            // Connector has been stopped
            release(socket, processor, true, false);
        } else {
            p.add(socket.getSocket().longValue(), -1, true, false);
        }
    } else {
        // Tomcat 7 proprietary upgrade
        ((AprEndpoint) proto.endpoint).getPoller().add(
                socket.getSocket().longValue(),
                processor.getUpgradeInbound().getReadTimeout(),
                true, false);
    }
}