当前位置: 首页>>代码示例>>Java>>正文


Java SocketStatus类代码示例

本文整理汇总了Java中org.apache.tomcat.util.net.SocketStatus的典型用法代码示例。如果您正苦于以下问题:Java SocketStatus类的具体用法?Java SocketStatus怎么用?Java SocketStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SocketStatus类属于org.apache.tomcat.util.net包,在下文中一共展示了SocketStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: event

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Process pipelined HTTP requests using the specified input and output
 * streams.
 *
 * @throws IOException error during an I/O operation
 */
@Override
public SocketState event(SocketStatus status)
    throws IOException {

    RequestInfo rp = request.getRequestProcessor();

    try {
        rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
        if (!getAdapter().event(request, response, status)) {
            setErrorState(ErrorState.CLOSE_NOW, null);
        }
    } catch (InterruptedIOException e) {
        setErrorState(ErrorState.CLOSE_NOW, e);
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        // 500 - Internal Server Error
        response.setStatus(500);
        setErrorState(ErrorState.CLOSE_NOW, t);
        getAdapter().log(request, response, 0);
        log.error(sm.getString("http11processor.request.process"), t);
    }

    rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

    if (getErrorState().isError() || status==SocketStatus.STOP) {
        return SocketState.CLOSED;
    } else if (!comet) {
        inputBuffer.nextRequest();
        outputBuffer.nextRequest();
        return SocketState.OPEN;
    } else {
        return SocketState.LONG;
    }
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:41,代码来源:Http11AprProcessor.java

示例2: setErrorState

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Update the current error state to the new error state if the new error
 * state is more severe than the current error state.
 */
protected void setErrorState(ErrorState errorState, Throwable t) {
    boolean blockIo = this.errorState.isIoAllowed() && !errorState.isIoAllowed();
    this.errorState = this.errorState.getMostSevere(errorState);
    if (blockIo && !ContainerThreadMarker.isContainerThread() && isAsync()) {
        // The error occurred on a non-container thread during async
        // processing which means not all of the necessary clean-up will
        // have been completed. Dispatch to a container thread to do the
        // clean-up. Need to do it this way to ensure that all the necessary
        // clean-up is performed.
        if (response.getStatus() < 400) {
            response.setStatus(500);
        }
        getLog().info(sm.getString("abstractProcessor.nonContainerThreadError"), t);
        // Set the request attribute so that the async onError() event is
        // fired when the error event is processed
        request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
        getEndpoint().processSocketAsync(socketWrapper, SocketStatus.ERROR);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:24,代码来源:AbstractProcessor.java

示例3: event

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Process pipelined HTTP requests using the specified input and output
 * streams.
 *
 * @throws IOException
 *             error during an I/O operation
 */
@Override
public SocketState event(SocketStatus status) throws IOException {

	RequestInfo rp = request.getRequestProcessor();

	try {
		rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
		if (!getAdapter().event(request, response, status)) {
			setErrorState(ErrorState.CLOSE_NOW, null);
		}
	} catch (InterruptedIOException e) {
		setErrorState(ErrorState.CLOSE_NOW, e);
	} catch (Throwable t) {
		ExceptionUtils.handleThrowable(t);
		// 500 - Internal Server Error
		response.setStatus(500);
		setErrorState(ErrorState.CLOSE_NOW, t);
		getAdapter().log(request, response, 0);
		log.error(sm.getString("http11processor.request.process"), t);
	}

	rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

	if (getErrorState().isError() || status == SocketStatus.STOP) {
		return SocketState.CLOSED;
	} else if (!comet) {
		inputBuffer.nextRequest();
		outputBuffer.nextRequest();
		return SocketState.OPEN;
	} else {
		return SocketState.LONG;
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:41,代码来源:Http11AprProcessor.java

示例4: setErrorState

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Update the current error state to the new error state if the new error
 * state is more severe than the current error state.
 */
protected void setErrorState(ErrorState errorState, Throwable t) {
	boolean blockIo = this.errorState.isIoAllowed() && !errorState.isIoAllowed();
	this.errorState = this.errorState.getMostSevere(errorState);
	if (response.getStatus() < 400) {
		response.setStatus(500);
	}
	if (t != null) {
		request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
	}
	if (blockIo && !ContainerThreadMarker.isContainerThread() && isAsync()) {
		// The error occurred on a non-container thread during async
		// processing which means not all of the necessary clean-up will
		// have been completed. Dispatch to a container thread to do the
		// clean-up. Need to do it this way to ensure that all the necessary
		// clean-up is performed.
		getLog().info(sm.getString("abstractProcessor.nonContainerThreadError"), t);
		getEndpoint().processSocketAsync(socketWrapper, SocketStatus.ERROR);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:24,代码来源:AbstractProcessor.java

示例5: actionInternal

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Send an action to the connector.
 *
 * @param actionCode Type of the action
 * @param param Action parameter
 */
@Override
protected void actionInternal(ActionCode actionCode, Object param) {

    if (actionCode == ActionCode.ASYNC_COMPLETE) {
        if (asyncStateMachine.asyncComplete()) {
            ((AprEndpoint)endpoint).processSocketAsync(this.socketWrapper,
                    SocketStatus.OPEN_READ);
        }

    } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
        if (param == null) return;
        long timeout = ((Long)param).longValue();
        socketWrapper.setTimeout(timeout);

    } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
        if (asyncStateMachine.asyncDispatch()) {
            ((AprEndpoint)endpoint).processSocketAsync(this.socketWrapper,
                    SocketStatus.OPEN_READ);
        }
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:28,代码来源:AjpAprProcessor.java

示例6: actionInternal

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Send an action to the connector.
 *
 * @param actionCode Type of the action
 * @param param Action parameter
 */
@Override
protected void actionInternal(ActionCode actionCode, Object param) {

    if (actionCode == ActionCode.ASYNC_COMPLETE) {
        if (asyncStateMachine.asyncComplete()) {
            ((NioEndpoint)endpoint).processSocket(this.socketWrapper.getSocket(),
                    SocketStatus.OPEN_READ, false);
        }

    } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
        if (param == null) return;
        long timeout = ((Long)param).longValue();
        final KeyAttachment ka =
                (KeyAttachment)socketWrapper.getSocket().getAttachment(false);
        ka.setTimeout(timeout);

    } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
        if (asyncStateMachine.asyncDispatch()) {
            ((NioEndpoint)endpoint).processSocket(this.socketWrapper.getSocket(),
                    SocketStatus.OPEN_READ, true);
        }
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:30,代码来源:AjpNioProcessor.java

示例7: actionInternal

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Send an action to the connector.
 *
 * @param actionCode Type of the action
 * @param param Action parameter
 */
@Override
protected void actionInternal(ActionCode actionCode, Object param) {

    if (actionCode == ActionCode.ASYNC_COMPLETE) {
        if (asyncStateMachine.asyncComplete()) {
            ((JIoEndpoint)endpoint).processSocketAsync(this.socketWrapper,
                    SocketStatus.OPEN_READ);
        }

    } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
        if (param == null) return;
        long timeout = ((Long)param).longValue();
        // if we are not piggy backing on a worker thread, set the timeout
        socketWrapper.setTimeout(timeout);

    } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
        if (asyncStateMachine.asyncDispatch()) {
            ((JIoEndpoint)endpoint).processSocketAsync(this.socketWrapper,
                    SocketStatus.OPEN_READ);
        }
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:29,代码来源:AjpProcessor.java

示例8: asyncDispatch

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
@Override
public SocketState asyncDispatch(SocketStatus status) {

    RequestInfo rp = request.getRequestProcessor();
    try {
        rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
        error = !adapter.asyncDispatch(request, response, status);
        resetTimeouts();
    } catch (InterruptedIOException e) {
        error = true;
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        getLog().error(sm.getString("http11processor.request.process"), t);
        error = true;
    } finally {
        if (error) {
            // 500 - Internal Server Error
            response.setStatus(500);
            adapter.log(request, response, 0);
        }
    }

    rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

    if (isAsync()) {
        if (error) {
            request.updateCounters();
            return SocketState.CLOSED;
        } else {
            return SocketState.LONG;
        }
    } else {
        request.updateCounters();
        if (error) {
            return SocketState.CLOSED;
        } else {
            return SocketState.OPEN;
        }
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:41,代码来源:AbstractAjpProcessor.java

示例9: asyncDispatch

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
@Override
public SocketState asyncDispatch(SocketStatus status) {

    RequestInfo rp = request.getRequestProcessor();
    try {
        rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
        error = !adapter.asyncDispatch(request, response, status);
        resetTimeouts();
    } catch (InterruptedIOException e) {
        error = true;
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        getLog().error(sm.getString("http11processor.request.process"), t);
        error = true;
    } finally {
        if (error) {
            // 500 - Internal Server Error
            response.setStatus(500);
            adapter.log(request, response, 0);
        }
    }

    rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

    if (error) {
        return SocketState.CLOSED;
    } else if (isAsync()) {
        return SocketState.LONG;
    } else {
        if (!keepAlive) {
            return SocketState.CLOSED;
        } else {
            getInputBuffer().nextRequest();
            getOutputBuffer().nextRequest();
            return SocketState.OPEN;
        }
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:39,代码来源:AbstractHttp11Processor.java

示例10: event

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Process pipelined HTTP requests using the specified input and output
 * streams.
 *
 * @throws IOException error during an I/O operation
 */
@Override
public SocketState event(SocketStatus status)
    throws IOException {

    RequestInfo rp = request.getRequestProcessor();

    try {
        rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
        error = !adapter.event(request, response, status);
    } catch (InterruptedIOException e) {
        error = true;
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        log.error(sm.getString("http11processor.request.process"), t);
        // 500 - Internal Server Error
        response.setStatus(500);
        adapter.log(request, response, 0);
        error = true;
    }

    rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

    if (error || status==SocketStatus.STOP) {
        return SocketState.CLOSED;
    } else if (!comet) {
        inputBuffer.nextRequest();
        outputBuffer.nextRequest();
        return SocketState.OPEN;
    } else {
        return SocketState.LONG;
    }
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:39,代码来源:Http11AprProcessor.java

示例11: asyncDispatch

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
@Override
public SocketState asyncDispatch(SocketStatus status) {

    RequestInfo rp = request.getRequestProcessor();
    try {
        rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
        if (!getAdapter().asyncDispatch(request, response, status)) {
            setErrorState(ErrorState.CLOSE_NOW, null);
        }
        resetTimeouts();
    } catch (InterruptedIOException e) {
        setErrorState(ErrorState.CLOSE_NOW, e);
    } catch (Throwable t) {
        ExceptionUtils.handleThrowable(t);
        setErrorState(ErrorState.CLOSE_NOW, t);
        getLog().error(sm.getString("http11processor.request.process"), t);
    } finally {
        if (getErrorState().isError()) {
            // 500 - Internal Server Error
            response.setStatus(500);
            adapter.log(request, response, 0);
        }
    }

    rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);

    if (getErrorState().isError()) {
        return SocketState.CLOSED;
    } else if (isAsync()) {
        return SocketState.LONG;
    } else {
        if (!keepAlive) {
            return SocketState.CLOSED;
        } else {
            getInputBuffer().nextRequest();
            getOutputBuffer().nextRequest();
            return SocketState.OPEN;
        }
    }
}
 
开发者ID:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:41,代码来源:AbstractHttp11Processor.java

示例12: longPoll

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:39,代码来源:Http11AprProtocol.java

示例13: setErrorState

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Update the current error state to the new error state if the new error
 * state is more severe than the current error state.
 */
protected void setErrorState(ErrorState errorState, Throwable t) {
    boolean blockIo = this.errorState.isIoAllowed() && !errorState.isIoAllowed();
    this.errorState = this.errorState.getMostSevere(errorState);
    if (blockIo && !ContainerThreadMarker.isContainerThread()) {
        // The error occurred on a non-container thread which means not all
        // of the necessary clean-up will have been completed. Dispatch to
        // a container thread to do the clean-up. Need to do it this way to
        // ensure that all the necessary clean-up is performed.
        if (response.getStatus() < 400) {
            response.setStatus(500);
        }
        getLog().info(sm.getString("abstractProcessor.nonContainerThreadError"), t);
        getEndpoint().processSocketAsync(socketWrapper, SocketStatus.CLOSE_NOW);
    }
}
 
开发者ID:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:20,代码来源:AbstractProcessor.java

示例14: actionInternal

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Send an action to the connector.
 *
 * @param actionCode Type of the action
 * @param param Action parameter
 */
@Override
protected void actionInternal(ActionCode actionCode, Object param) {

    if (actionCode == ActionCode.ASYNC_COMPLETE) {
        if (asyncStateMachine.asyncComplete()) {
            ((AprEndpoint)endpoint).processSocketAsync(this.socket,
                    SocketStatus.OPEN);
        }
    } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
        if (param == null) return;
        long timeout = ((Long)param).longValue();
        socket.setTimeout(timeout);
    } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
        if (asyncStateMachine.asyncDispatch()) {
            ((AprEndpoint)endpoint).processSocketAsync(this.socket,
                    SocketStatus.OPEN);
        }
    }
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:26,代码来源:AjpAprProcessor.java

示例15: actionInternal

import org.apache.tomcat.util.net.SocketStatus; //导入依赖的package包/类
/**
 * Send an action to the connector.
 *
 * @param actionCode Type of the action
 * @param param Action parameter
 */
@Override
protected void actionInternal(ActionCode actionCode, Object param) {

    if (actionCode == ActionCode.ASYNC_COMPLETE) {
        if (asyncStateMachine.asyncComplete()) {
            ((NioEndpoint)endpoint).processSocket(this.socket,
                    SocketStatus.OPEN, false);
        }
    } else if (actionCode == ActionCode.ASYNC_SETTIMEOUT) {
        if (param == null) return;
        long timeout = ((Long)param).longValue();
        final KeyAttachment ka = (KeyAttachment)socket.getAttachment(false);
        if (keepAliveTimeout > 0) {
            ka.setTimeout(timeout);
        }
    } else if (actionCode == ActionCode.ASYNC_DISPATCH) {
        if (asyncStateMachine.asyncDispatch()) {
            ((NioEndpoint)endpoint).processSocket(this.socket,
                    SocketStatus.OPEN, true);
        }
    }
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:29,代码来源:AjpNioProcessor.java


注:本文中的org.apache.tomcat.util.net.SocketStatus类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。