Java Code Examples for org.apache.tomcat.jni.Status#APR_SUCCESS

The following examples show how to use org.apache.tomcat.jni.Status#APR_SUCCESS . 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: AprEndpoint.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Remove specified socket from the pollers. Must only be called from
 * {@link Poller#run()}.
 */
private boolean removeFromPoller(long socket) {
    if (log.isDebugEnabled()) {
        log.debug(sm.getString("endpoint.debug.pollerRemove",
                Long.valueOf(socket)));
    }
    int rv = -1;
    for (int i = 0; i < pollers.length; i++) {
        if (pollerSpace[i] < actualPollerSize) {
            rv = Poll.remove(pollers[i], socket);
            if (rv != Status.APR_NOTFOUND) {
                pollerSpace[i]++;
                connectionCount.decrementAndGet();
                if (log.isDebugEnabled()) {
                    log.debug(sm.getString("endpoint.debug.pollerRemoved",
                            Long.valueOf(socket)));
                }
                break;
            }
        }
    }
    timeouts.remove(socket);
    return (rv == Status.APR_SUCCESS);
}
 
Example 2
Source File: AprEndpoint.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Remove specified socket from the pollers. Must only be called from
 * {@link Poller#run()}.
 */
private boolean removeFromPoller(long socket) {
    if (log.isDebugEnabled()) {
        log.debug(sm.getString("endpoint.debug.pollerRemove",
                Long.valueOf(socket)));
    }
    int rv = -1;
    for (int i = 0; i < pollers.length; i++) {
        if (pollerSpace[i] < actualPollerSize) {
            rv = Poll.remove(pollers[i], socket);
            if (rv != Status.APR_NOTFOUND) {
                pollerSpace[i]++;
                connectionCount.decrementAndGet();
                if (log.isDebugEnabled()) {
                    log.debug(sm.getString("endpoint.debug.pollerRemoved",
                            Long.valueOf(socket)));
                }
                break;
            }
        }
    }
    timeouts.remove(socket);
    return (rv == Status.APR_SUCCESS);
}
 
Example 3
Source File: AprEndpoint.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Add specified socket to one of the pollers. Must only be called from
 * {@link Poller#run()}.
 */
private boolean addToPoller(long socket, int events) {
    int rv = -1;
    for (int i = 0; i < pollers.length; i++) {
        if (pollerSpace[i] > 0) {
            rv = Poll.add(pollers[i], socket, events);
            if (rv == Status.APR_SUCCESS) {
                pollerSpace[i]--;
                connectionCount.incrementAndGet();
                return true;
            }
        }
    }
    return false;
}
 
Example 4
Source File: AprEndpoint.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Remove socket from the poller.
 *
 * @param data the sendfile data which should be removed
 */
protected void remove(SendfileData data) {
    int rv = Poll.remove(sendfilePollset, data.socket);
    if (rv == Status.APR_SUCCESS) {
        sendfileCount--;
    }
    sendfileData.remove(Long.valueOf(data.socket));
}
 
Example 5
Source File: AprEndpoint.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Add specified socket to one of the pollers. Must only be called from
 * {@link Poller#run()}.
 */
protected boolean addToPoller(long socket, int events) {
    int rv = -1;
    for (int i = 0; i < pollers.length; i++) {
        if (pollerSpace[i] > 0) {
            rv = Poll.add(pollers[i], socket, events);
            if (rv == Status.APR_SUCCESS) {
                pollerSpace[i]--;
                connectionCount.incrementAndGet();
                return true;
            }
        }
    }
    return false;
}
 
Example 6
Source File: AprEndpoint.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Remove socket from the poller.
 *
 * @param data the sendfile data which should be removed
 */
protected void remove(SendfileData data) {
    int rv = Poll.remove(sendfilePollset, data.socket);
    if (rv == Status.APR_SUCCESS) {
        sendfileCount--;
    }
    sendfileData.remove(Long.valueOf(data.socket));
}
 
Example 7
Source File: AprEndpoint.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Add specified socket to one of the pollers. Must only be called from
 * {@link Poller#run()}.
 */
protected boolean addToPoller(long socket, int events) {
    int rv = -1;
    for (int i = 0; i < pollers.length; i++) {
        if (pollerSpace[i] > 0) {
            rv = Poll.add(pollers[i], socket, events);
            if (rv == Status.APR_SUCCESS) {
                pollerSpace[i]--;
                connectionCount.incrementAndGet();
                return true;
            }
        }
    }
    return false;
}
 
Example 8
Source File: AprEndpoint.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Remove socket from the poller.
 *
 * @param data the sendfile data which should be removed
 */
protected void remove(SendfileData data) {
    int rv = Poll.remove(sendfilePollset, data.socket);
    if (rv == Status.APR_SUCCESS) {
        sendfileCount--;
    }
    sendfileData.remove(Long.valueOf(data.socket));
}