本文整理汇总了Java中org.apache.tomcat.jni.Status类的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Status类属于org.apache.tomcat.jni包,在下文中一共展示了Status类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: read
import org.apache.tomcat.jni.Status; //导入依赖的package包/类
@Override
public int read(boolean block, byte[] bytes, int off, int len)
throws IOException {
if (!block) {
Socket.optSet(socket, Socket.APR_SO_NONBLOCK, -1);
}
try {
int result = Socket.recv(socket, bytes, off, len);
if (result > 0) {
return result;
} else if (-result == Status.EAGAIN) {
return 0;
} else {
throw new IOException(sm.getString("apr.read.error",
Integer.valueOf(-result)));
}
} finally {
if (!block) {
Socket.optSet(socket, Socket.APR_SO_NONBLOCK, 0);
}
}
}
开发者ID:sdw2330976,项目名称:apache-tomcat-7.0.57,代码行数:23,代码来源:UpgradeAprProcessor.java
示例2: removeFromPoller
import org.apache.tomcat.jni.Status; //导入依赖的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
示例3: read
import org.apache.tomcat.jni.Status; //导入依赖的package包/类
@Override
public int read(boolean block, byte[] bytes, int off, int len) throws IOException {
if (!block) {
Socket.optSet(socket, Socket.APR_SO_NONBLOCK, -1);
}
try {
int result = Socket.recv(socket, bytes, off, len);
if (result > 0) {
return result;
} else if (-result == Status.EAGAIN) {
return 0;
} else {
throw new IOException(sm.getString("apr.read.error", Integer.valueOf(-result)));
}
} finally {
if (!block) {
Socket.optSet(socket, Socket.APR_SO_NONBLOCK, 0);
}
}
}
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:UpgradeAprProcessor.java
示例4: removeFromPoller
import org.apache.tomcat.jni.Status; //导入依赖的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
示例5: remove
import org.apache.tomcat.jni.Status; //导入依赖的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.Status; //导入依赖的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: readt
import org.apache.tomcat.jni.Status; //导入依赖的package包/类
/**
* Read at least the specified amount of bytes, and place them
* in the input buffer.
*/
protected boolean readt(int n, boolean useAvailableData)
throws IOException {
if (useAvailableData && inputBuffer.remaining() == 0) {
return false;
}
if (inputBuffer.capacity() - inputBuffer.limit() <=
n - inputBuffer.remaining()) {
inputBuffer.compact();
inputBuffer.limit(inputBuffer.position());
inputBuffer.position(0);
}
int nRead;
while (inputBuffer.remaining() < n) {
nRead = Socket.recvbb
(socketWrapper.getSocket().longValue(), inputBuffer.limit(),
inputBuffer.capacity() - inputBuffer.limit());
if (nRead > 0) {
inputBuffer.limit(inputBuffer.limit() + nRead);
} else {
if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
return false;
} else {
throw new IOException(sm.getString("ajpprocessor.failedread"));
}
}
}
return true;
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:36,代码来源:AjpAprProcessor.java
示例8: addToPoller
import org.apache.tomcat.jni.Status; //导入依赖的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
示例9: add
import org.apache.tomcat.jni.Status; //导入依赖的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
示例10: remove
import org.apache.tomcat.jni.Status; //导入依赖的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
示例11: readt
import org.apache.tomcat.jni.Status; //导入依赖的package包/类
/**
* Read at least the specified amount of bytes, and place them
* in the input buffer.
*/
protected boolean readt(int n, boolean useAvailableData)
throws IOException {
if (useAvailableData && inputBuffer.remaining() == 0) {
return false;
}
if (inputBuffer.capacity() - inputBuffer.limit() <=
n - inputBuffer.remaining()) {
inputBuffer.compact();
inputBuffer.limit(inputBuffer.position());
inputBuffer.position(0);
}
int nRead;
while (inputBuffer.remaining() < n) {
nRead = Socket.recvbb
(socket, inputBuffer.limit(),
inputBuffer.capacity() - inputBuffer.limit());
if (nRead > 0) {
inputBuffer.limit(inputBuffer.limit() + nRead);
} else {
if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
return false;
} else {
throw new IOException(sm.getString("ajpprotocol.failedread"));
}
}
}
return true;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:AjpAprProcessor.java
示例12: allocatePoller
import org.apache.tomcat.jni.Status; //导入依赖的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
示例13: addToPoller
import org.apache.tomcat.jni.Status; //导入依赖的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
示例14: removeFromPoller
import org.apache.tomcat.jni.Status; //导入依赖的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
示例15: remove
import org.apache.tomcat.jni.Status; //导入依赖的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: readt
import org.apache.tomcat.jni.Status; //导入依赖的package包/类
/**
* Read at least the specified amount of bytes, and place them in the input
* buffer.
*/
protected boolean readt(int n, boolean useAvailableData) throws IOException {
if (useAvailableData && inputBuffer.remaining() == 0) {
return false;
}
if (inputBuffer.capacity() - inputBuffer.limit() <= n - inputBuffer.remaining()) {
inputBuffer.compact();
inputBuffer.limit(inputBuffer.position());
inputBuffer.position(0);
}
int nRead;
while (inputBuffer.remaining() < n) {
nRead = Socket.recvbb(socketWrapper.getSocket().longValue(), inputBuffer.limit(),
inputBuffer.capacity() - inputBuffer.limit());
if (nRead > 0) {
inputBuffer.limit(inputBuffer.limit() + nRead);
} else {
if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
return false;
} else {
throw new IOException(sm.getString("ajpprocessor.failedread"));
}
}
}
return true;
}
开发者ID:how2j,项目名称:lazycat,代码行数:33,代码来源:AjpAprProcessor.java
示例17: allocatePoller
import org.apache.tomcat.jni.Status; //导入依赖的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
示例18: addToPoller
import org.apache.tomcat.jni.Status; //导入依赖的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
注:本文中的org.apache.tomcat.jni.Status类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论