本文整理了Java中org.glassfish.grizzly.Connection.getReadBufferSize()
方法的一些代码示例,展示了Connection.getReadBufferSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.getReadBufferSize()
方法的具体详情如下:
包路径:org.glassfish.grizzly.Connection
类名称:Connection
方法名:getReadBufferSize
[英]Get the default size of Buffers, which will be allocated for reading data from Connection. The value less or equal to zero will be ignored.
[中]获取缓冲区的默认大小,它将被分配用于从连接读取数据。小于或等于零的值将被忽略。
代码示例来源:origin: javaee/grizzly
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: javaee/grizzly
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: javaee/grizzly
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: javaee/grizzly
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: javaee/grizzly
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: javaee/grizzly
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: javaee/grizzly
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: javaee/grizzly
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-core
private static void checkBuffers(Connection connection, SSLEngine sslEngine) {
final int packetBufferSize = sslEngine.getSession().getPacketBufferSize();
if (connection.getReadBufferSize() < packetBufferSize) {
connection.setReadBufferSize(packetBufferSize);
}
if (connection.getWriteBufferSize() < packetBufferSize) {
connection.setWriteBufferSize(packetBufferSize);
}
}
代码示例来源:origin: org.mule.services/mule-service-http
/**
* Attempts to optimize the buffer size based on the presence of the content length header, the connection buffer size and the
* maximum buffer size possible. Defaults to an ~32KB buffer when transfer encoding is used.
*
* @param headers the current headers received
* @throws IllegalAccessException
*/
private void calculateBufferSize(HttpResponseHeaders headers) {
int maxBufferSize = MAX_RECEIVE_BUFFER_SIZE;
String contentLength = headers.getHeaders().getFirstValue(CONTENT_LENGTH);
if (!isEmpty(contentLength) && isEmpty(headers.getHeaders().getFirstValue(TRANSFER_ENCODING))) {
int contentLengthInt = valueOf(contentLength);
try {
if (responseField != null && headers instanceof GrizzlyResponseHeaders) {
maxBufferSize = (((HttpResponsePacket) responseField.get(headers)).getRequest().getConnection().getReadBufferSize());
}
} catch (IllegalAccessException e) {
LOGGER.debug("Unable to access connection buffer size.");
}
bufferSize = min(maxBufferSize, contentLengthInt);
} else {
// Assume maximum 32Kb chunk size + 10 bytes for chunk size and new lines etc. (need to confirm is this is needed, but use
// for now)
bufferSize = KB.toBytes(32) + 10;
}
LOGGER
.debug("Max buffer size = {} bytes, Connection buffer size = {} bytes, Content-length = {} bytes, Calculated buffer size = {} bytes",
MAX_RECEIVE_BUFFER_SIZE, maxBufferSize, contentLength, bufferSize);
}
内容来源于网络,如有侵权,请联系作者删除!