本文整理汇总了Java中org.apache.tomcat.jni.Poll类的典型用法代码示例。如果您正苦于以下问题:Java Poll类的具体用法?Java Poll怎么用?Java Poll使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Poll类属于org.apache.tomcat.jni包,在下文中一共展示了Poll类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: removeFromPoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* 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);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:28,代码来源:AprEndpoint.java
示例2: toString
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Displays the list of sockets in the pollers.
*/
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("Poller");
long[] res = new long[actualPollerSize * 2];
for (int i = 0; i < pollers.length; i++) {
int count = Poll.pollset(pollers[i], res);
buf.append(" [ ");
for (int j = 0; j < count; j++) {
buf.append(desc[2*j+1]).append(" ");
}
buf.append("]");
}
return buf.toString();
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:AprEndpoint.java
示例3: removeFromPoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* 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);
}
开发者ID:how2j,项目名称:lazycat,代码行数:26,代码来源:AprEndpoint.java
示例4: toString
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Displays the list of sockets in the pollers.
*/
@Override
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("Poller");
long[] res = new long[actualPollerSize * 2];
for (int i = 0; i < pollers.length; i++) {
int count = Poll.pollset(pollers[i], res);
buf.append(" [ ");
for (int j = 0; j < count; j++) {
buf.append(desc[2 * j + 1]).append(" ");
}
buf.append("]");
}
return buf.toString();
}
开发者ID:how2j,项目名称:lazycat,代码行数:19,代码来源:AprEndpoint.java
示例5: remove
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* 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));
}
开发者ID:how2j,项目名称:lazycat,代码行数:14,代码来源:AprEndpoint.java
示例6: allocatePoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Allocate a new poller of the specified size.
*/
protected long allocatePoller(int size, long pool, int timeout) {
try {
return Poll.create(size, pool, 0, timeout * 1000);
} catch (Error e) {
if (Status.APR_STATUS_IS_EINVAL(e.getError())) {
log.info(sm.getString("endpoint.poll.limitedpollsize", "" + size));
return 0;
} else {
log.error(sm.getString("endpoint.poll.initfail"), e);
return -1;
}
}
}
开发者ID:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:17,代码来源:AprEndpoint.java
示例7: addToPoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* 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;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:19,代码来源:AprEndpoint.java
示例8: destroy
import org.apache.tomcat.jni.Poll; //导入依赖的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
示例9: remove
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* 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));
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:13,代码来源:AprEndpoint.java
示例10: allocatePoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Allocate a new poller of the specified size.
*/
protected long allocatePoller(int size, long pool, int timeout) {
try {
return Poll.create(size, pool, 0, (timeout > 0) ? (timeout * 1000) : -1);
} catch (Error e) {
if (Status.APR_STATUS_IS_EINVAL(e.getError())) {
log.info(sm.getString("endpoint.poll.limitedpollsize", "" + size));
return 0;
} else {
log.error(sm.getString("endpoint.poll.initfail"), e);
return -1;
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:AprEndpoint.java
示例11: destroy
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Destroy the poller.
*/
protected void destroy() {
// Wait for pollerTime 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.wait(pollTime / 1000);
}
} catch (InterruptedException e) {
// Ignore
}
// Close all sockets in the add queue
SocketInfo info = addList.get();
while (info != null) {
if (!comet || (comet && !processSocket(info.socket, SocketStatus.STOP))) {
Socket.destroy(info.socket);
}
info = addList.get();
}
addList.clear();
// Close all sockets still in the poller
for (int i = 0; i < pollerCount; i++) {
int rv = Poll.pollset(pollers[i], desc);
if (rv > 0) {
for (int n = 0; n < rv; n++) {
if (!comet || (comet && !processSocket(desc[n*2+1], SocketStatus.STOP))) {
Socket.destroy(desc[n*2+1]);
}
}
}
}
Pool.destroy(pool);
connectionCount = 0;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:AprEndpoint.java
示例12: addToPoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Add specified socket to one of the pollers.
*/
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++;
return true;
}
}
}
return false;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AprEndpoint.java
示例13: removeFromPoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Remove specified socket from the pollers.
*/
protected boolean removeFromPoller(long 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--;
break;
}
}
}
return (rv == Status.APR_SUCCESS);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AprEndpoint.java
示例14: toString
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Displays the list of sockets in the pollers.
*/
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("Poller comet=[").append(comet).append("]");
long[] res = new long[actualPollerSize * 2];
for (int i = 0; i < pollers.length; i++) {
int count = Poll.pollset(pollers[i], res);
buf.append(" [ ");
for (int j = 0; j < count; j++) {
buf.append(desc[2*j+1]).append(" ");
}
buf.append("]");
}
return buf.toString();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AprEndpoint.java
示例15: remove
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* 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(new Long(data.socket));
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AprEndpoint.java
示例16: allocatePoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* Allocate a new poller of the specified size.
*/
protected long allocatePoller(int size, long pool, int timeout) {
try {
return Poll.create(size, pool, 0, timeout * 1000);
} catch (Error e) {
if (Status.APR_STATUS_IS_EINVAL(e.getError())) {
log.info(sm.getString("endpoint.poll.limitedpollsize", "" + size));
return 0;
} else {
log.error(sm.getString("endpoint.poll.initfail"), e);
return -1;
}
}
}
开发者ID:how2j,项目名称:lazycat,代码行数:17,代码来源:AprEndpoint.java
示例17: addToPoller
import org.apache.tomcat.jni.Poll; //导入依赖的package包/类
/**
* 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;
}
开发者ID:how2j,项目名称:lazycat,代码行数:19,代码来源:AprEndpoint.java
示例18: destroy
import org.apache.tomcat.jni.Poll; //导入依赖的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
注:本文中的org.apache.tomcat.jni.Poll类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论