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


Java Pool.destroy方法代码示例

本文整理汇总了Java中org.apache.tomcat.jni.Pool.destroy方法的典型用法代码示例。如果您正苦于以下问题:Java Pool.destroy方法的具体用法?Java Pool.destroy怎么用?Java Pool.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tomcat.jni.Pool的用法示例。


在下文中一共展示了Pool.destroy方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: destroy

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Deallocate APR memory pools, and close server socket.
 */
public void destroy() throws Exception {
    if (running) {
        stop();
    }
    Pool.destroy(serverSockPool);
    serverSockPool = 0;
    // Close server socket
    Socket.close(serverSock);
    serverSock = 0;
    sslContext = 0;
    // Close all APR memory pools and resources
    Pool.destroy(rootPool);
    rootPool = 0;
    initialized = false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:AprEndpoint.java

示例2: destroyPull

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
void destroyPull() {
    if (shutdowned)
        return;

    // Causes segfault in AprSocketSource.poll() method, so this function must be called from it
    try {
        Socket.close(socket);
        // or
        // Socket.shutdown(socket, Socket.APR_SHUTDOWN_READWRITE);
        Pool.destroy(pool);
    } catch (Exception e) {
        s_logger.info("[ignored]"
                + "failure during network cleanup: " + e.getLocalizedMessage());
    }

}
 
开发者ID:apache,项目名称:cloudstack,代码行数:17,代码来源:AprSocketWrapperImpl.java

示例3: unbind

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Deallocate APR memory pools, and close server socket.
 */
@Override
public void unbind() throws Exception {
    if (running) {
        stop();
    }

    // Destroy pool if it was initialised
    if (serverSockPool != 0) {
        Pool.destroy(serverSockPool);
        serverSockPool = 0;
    }

    // Close server socket if it was initialised
    if (serverSock != 0) {
        Socket.close(serverSock);
        serverSock = 0;
    }

    sslContext = 0;

    // Close all APR memory pools and resources if initialised
    if (rootPool != 0) {
        Pool.destroy(rootPool);
        rootPool = 0;
    }

    handler.recycle();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:32,代码来源:AprEndpoint.java

示例4: destroy

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Destroy the poller.
 */
protected void destroy() {
    sendfileRunning = false;
    // Wait for polltime before doing anything, so that the poller threads
    // exit, otherwise parallel destruction of sockets which are still
    // in the poller can cause problems
    try {
        synchronized (this) {
            this.notify();
            this.wait(pollTime / 1000);
        }
    } catch (InterruptedException e) {
        // Ignore
    }
    // Close any socket remaining in the add queue
    for (int i = (addS.size() - 1); i >= 0; i--) {
        SendfileData data = addS.get(i);
        closeSocket(data.socket);
    }
    // Close all sockets still in the poller
    int rv = Poll.pollset(sendfilePollset, desc);
    if (rv > 0) {
        for (int n = 0; n < rv; n++) {
            closeSocket(desc[n*2+1]);
        }
    }
    Pool.destroy(pool);
    sendfileData.clear();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:32,代码来源:AprEndpoint.java

示例5: add

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Add the sendfile data to the sendfile poller. Note that in most cases,
 * the initial non blocking calls to sendfile will return right away, and
 * will be handled asynchronously inside the kernel. As a result,
 * the poller will never be used.
 *
 * @param data containing the reference to the data which should be snet
 * @return true if all the data has been sent right away, and false
 *              otherwise
 */
public boolean add(SendfileData data) {
    // Initialize fd from data given
    try {
        data.fdpool = Socket.pool(data.socket);
        data.fd = File.open
            (data.fileName, File.APR_FOPEN_READ
             | File.APR_FOPEN_SENDFILE_ENABLED | File.APR_FOPEN_BINARY,
             0, data.fdpool);
        data.pos = data.start;
        // Set the socket to nonblocking mode
        Socket.timeoutSet(data.socket, 0);
        while (true) {
            long nw = Socket.sendfilen(data.socket, data.fd,
                                       data.pos, data.end - data.pos, 0);
            if (nw < 0) {
                if (!(-nw == Status.EAGAIN)) {
                    Pool.destroy(data.fdpool);
                    data.socket = 0;
                    return false;
                } else {
                    // Break the loop and add the socket to poller.
                    break;
                }
            } else {
                data.pos = data.pos + nw;
                if (data.pos >= data.end) {
                    // Entire file has been sent
                    Pool.destroy(data.fdpool);
                    // Set back socket to blocking mode
                    Socket.timeoutSet(
                            data.socket, getSoTimeout() * 1000);
                    return true;
                }
            }
        }
    } catch (Exception e) {
        log.warn(sm.getString("endpoint.sendfile.error"), e);
        return false;
    }
    // Add socket to the list. Newly added sockets will wait
    // at most for pollTime before being polled
    synchronized (this) {
        addS.add(data);
        this.notify();
    }
    return false;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:58,代码来源:AprEndpoint.java

示例6: destroyAprSocket

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
private void destroyAprSocket(long serverSock, long pool) {
    if (serverSock != 0) {
        Socket.shutdown(serverSock, Socket.APR_SHUTDOWN_READWRITE);
        Socket.close(serverSock);
        Socket.destroy(serverSock);
    }

    if (pool != 0) {
        Pool.destroy(pool);
        pool = 0;
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:13,代码来源:TestXxxEndpoint.java

示例7: unbind

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Deallocate APR memory pools, and close server socket.
 */
@Override
public void unbind() throws Exception {
	if (running) {
		stop();
	}

	// Destroy pool if it was initialised
	if (serverSockPool != 0) {
		Pool.destroy(serverSockPool);
		serverSockPool = 0;
	}

	// Close server socket if it was initialised
	if (serverSock != 0) {
		Socket.close(serverSock);
		serverSock = 0;
	}

	sslContext = 0;

	// Close all APR memory pools and resources if initialised
	if (rootPool != 0) {
		Pool.destroy(rootPool);
		rootPool = 0;
	}

	handler.recycle();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:AprEndpoint.java

示例8: destroy

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Destroy the poller.
 */
protected void destroy() {
	sendfileRunning = false;
	// Wait for polltime before doing anything, so that the poller
	// threads
	// exit, otherwise parallel destruction of sockets which are still
	// in the poller can cause problems
	try {
		synchronized (this) {
			this.notify();
			this.wait(pollTime / 1000);
		}
	} catch (InterruptedException e) {
		// Ignore
	}
	// Close any socket remaining in the add queue
	for (int i = (addS.size() - 1); i >= 0; i--) {
		SendfileData data = addS.get(i);
		closeSocket(data.socket);
	}
	// Close all sockets still in the poller
	int rv = Poll.pollset(sendfilePollset, desc);
	if (rv > 0) {
		for (int n = 0; n < rv; n++) {
			closeSocket(desc[n * 2 + 1]);
		}
	}
	Pool.destroy(pool);
	sendfileData.clear();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:33,代码来源:AprEndpoint.java

示例9: destroy

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Destroy the poller.
 */
@Override
public void destroy() {
    // Close all sockets in the add queue
    for (int i = 0; i < addCount; i++) {
        if (comet) {
            processSocket(addSocket[i], SocketStatus.STOP);
        } else {
            destroySocket(addSocket[i]);
        }
    }
    // Close all sockets still in the pollers
    closePollset(connectionPollset);
    if (separateKeepAlive) {
        closePollset(keepAlivePollset);
    }
    Pool.destroy(pool);
    keepAliveCount = 0;
    addCount = 0;
    try {
        while (this.isAlive()) {
            this.interrupt();
            this.join(1000);
        }
    } catch (InterruptedException e) {
        // Ignore
    }
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:31,代码来源:AprEndpoint.java

示例10: add

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Add the sendfile data to the sendfile poller. Note that in most cases,
 * the initial non blocking calls to sendfile will return right away, and
 * will be handled asynchronously inside the kernel. As a result,
 * the poller will never be used.
 *
 * @param data containing the reference to the data which should be snet
 * @return true if all the data has been sent right away, and false
 *              otherwise
 */
public boolean add(SendfileData data) {
    // Initialize fd from data given
    try {
        data.fdpool = Socket.pool(data.socket);
        data.fd = File.open
            (data.fileName, File.APR_FOPEN_READ
             | File.APR_FOPEN_SENDFILE_ENABLED | File.APR_FOPEN_BINARY,
             0, data.fdpool);
        data.pos = data.start;
        // Set the socket to nonblocking mode
        Socket.timeoutSet(data.socket, 0);
        while (true) {
            long nw = Socket.sendfilen(data.socket, data.fd,
                                       data.pos, data.end - data.pos, 0);
            if (nw < 0) {
                if (!(-nw == Status.EAGAIN)) {
                    Socket.destroy(data.socket);
                    data.socket = 0;
                    return false;
                } else {
                    // Break the loop and add the socket to poller.
                    break;
                }
            } else {
                data.pos = data.pos + nw;
                if (data.pos >= data.end) {
                    // Entire file has been sent
                    Pool.destroy(data.fdpool);
                    // Set back socket to blocking mode
                    Socket.timeoutSet(data.socket, soTimeout * 1000);
                    return true;
                }
            }
        }
    } catch (Exception e) {
        log.error(sm.getString("endpoint.sendfile.error"), e);
        return false;
    }
    // Add socket to the list. Newly added sockets will wait
    // at most for pollTime before being polled
    synchronized (this) {
        addS.add(data);
        this.notify();
    }
    return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:57,代码来源:AprEndpoint.java

示例11: add

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
/**
 * Add the sendfile data to the sendfile poller. Note that in most
 * cases, the initial non blocking calls to sendfile will return right
 * away, and will be handled asynchronously inside the kernel. As a
 * result, the poller will never be used.
 *
 * @param data
 *            containing the reference to the data which should be snet
 * @return true if all the data has been sent right away, and false
 *         otherwise
 */
public SendfileState add(SendfileData data) {
	// Initialize fd from data given
	try {
		data.fdpool = Socket.pool(data.socket);
		data.fd = File.open(data.fileName,
				File.APR_FOPEN_READ | File.APR_FOPEN_SENDFILE_ENABLED | File.APR_FOPEN_BINARY, 0, data.fdpool);
		data.pos = data.start;
		// Set the socket to nonblocking mode
		Socket.timeoutSet(data.socket, 0);
		while (true) {
			long nw = Socket.sendfilen(data.socket, data.fd, data.pos, data.end - data.pos, 0);
			if (nw < 0) {
				if (!(-nw == Status.EAGAIN)) {
					Pool.destroy(data.fdpool);
					data.socket = 0;
					return SendfileState.ERROR;
				} else {
					// Break the loop and add the socket to poller.
					break;
				}
			} else {
				data.pos = data.pos + nw;
				if (data.pos >= data.end) {
					// Entire file has been sent
					Pool.destroy(data.fdpool);
					// Set back socket to blocking mode
					Socket.timeoutSet(data.socket, getSoTimeout() * 1000);
					return SendfileState.DONE;
				}
			}
		}
	} catch (Exception e) {
		log.warn(sm.getString("endpoint.sendfile.error"), e);
		return SendfileState.ERROR;
	}
	// Add socket to the list. Newly added sockets will wait
	// at most for pollTime before being polled
	synchronized (this) {
		addS.add(data);
		this.notify();
	}
	return SendfileState.PENDING;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:55,代码来源:AprEndpoint.java

示例12: destroyPools

import org.apache.tomcat.jni.Pool; //导入方法依赖的package包/类
protected final void destroyPools() {
    // Guard against multiple destroyPools() calls triggered by construction exception and finalize() later
    if (aprPool != 0 && DESTROY_UPDATER.compareAndSet(this, 0, 1)) {
        Pool.destroy(aprPool);
    }
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:7,代码来源:OpenSslContext.java


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