本文整理了Java中org.glassfish.grizzly.Transport.getMemoryManager()
方法的一些代码示例,展示了Transport.getMemoryManager()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transport.getMemoryManager()
方法的具体详情如下:
包路径:org.glassfish.grizzly.Transport
类名称:Transport
方法名:getMemoryManager
[英]Get the Transport associated MemoryManager, which will be used by the Transport, its Connections and by during processing I/O events, occurred on Connections.
[中]获取与传输关联的MemoryManager,在处理连接上发生的I/O事件期间,它将由传输、其连接和使用。
代码示例来源:origin: apache/incubator-dubbo
@Override
public NextAction handleWrite(FilterChainContext context) throws IOException {
Connection<?> connection = context.getConnection();
GrizzlyChannel channel = GrizzlyChannel.getOrAddChannel(connection, url, handler);
try {
ChannelBuffer channelBuffer = ChannelBuffers.dynamicBuffer(1024); // Do not need to close
Object msg = context.getMessage();
codec.encode(channel, channelBuffer, msg);
GrizzlyChannel.removeChannelIfDisconnected(connection);
Buffer buffer = connection.getTransport().getMemoryManager().allocate(channelBuffer.readableBytes());
buffer.put(channelBuffer.toByteBuffer());
buffer.flip();
buffer.allowBufferDispose(true);
context.setMessage(buffer);
} finally {
GrizzlyChannel.removeChannelIfDisconnected(connection);
}
return context.getInvokeAction();
}
代码示例来源:origin: apache/incubator-dubbo
@Override
public NextAction handleWrite(FilterChainContext context) throws IOException {
Connection<?> connection = context.getConnection();
GrizzlyChannel channel = GrizzlyChannel.getOrAddChannel(connection, url, handler);
try {
ChannelBuffer channelBuffer = ChannelBuffers.dynamicBuffer(1024); // Do not need to close
Object msg = context.getMessage();
codec.encode(channel, channelBuffer, msg);
GrizzlyChannel.removeChannelIfDisconnected(connection);
Buffer buffer = connection.getTransport().getMemoryManager().allocate(channelBuffer.readableBytes());
buffer.put(channelBuffer.toByteBuffer());
buffer.flip();
buffer.allowBufferDispose(true);
context.setMessage(buffer);
} finally {
GrizzlyChannel.removeChannelIfDisconnected(connection);
}
return context.getInvokeAction();
}
代码示例来源:origin: javaee/grizzly
protected Buffer acquireBuffer(Connection connection) {
Transport connectionTransport = connection.getTransport();
return connectionTransport.getMemoryManager().
allocate(DEFAULT_BUFFER_SIZE);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-core
protected Buffer acquireBuffer(Connection connection) {
Transport connectionTransport = connection.getTransport();
return connectionTransport.getMemoryManager().
allocate(DEFAULT_BUFFER_SIZE);
}
代码示例来源:origin: javaee/grizzly
protected Buffer acquireBuffer(Connection connection) {
Transport connectionTransport = connection.getTransport();
return connectionTransport.getMemoryManager().
allocate(DEFAULT_BUFFER_SIZE);
}
代码示例来源:origin: javaee/grizzly
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int coresCount = Runtime.getRuntime().availableProcessors();
config.setPoolName("Grizzly-worker");
config.setCorePoolSize(coresCount * 2);
config.setMaxPoolSize(coresCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int coresCount = Runtime.getRuntime().availableProcessors();
config.setPoolName("Grizzly-worker");
config.setCorePoolSize(coresCount * 2);
config.setMaxPoolSize(coresCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: javaee/grizzly
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int coresCount = Runtime.getRuntime().availableProcessors();
config.setPoolName("Grizzly-worker");
config.setCorePoolSize(coresCount * 2);
config.setMaxPoolSize(coresCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: javaee/grizzly
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int coresCount = Runtime.getRuntime().availableProcessors();
config.setPoolName("Grizzly-worker");
config.setCorePoolSize(coresCount * 2);
config.setMaxPoolSize(coresCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: org.mule.modules/mule-module-http
public ResponseStreamingCompletionHandler(final FilterChainContext ctx,
final HttpRequestPacket request, final HttpResponse httpResponse, ResponseStatusCallback responseStatusCallback)
{
Preconditions.checkArgument((httpResponse.getEntity() instanceof InputStreamHttpEntity), "http response must have an input stream entity");
this.ctx = ctx;
httpResponsePacket = buildHttpResponsePacket(request, httpResponse);
inputStream = ((InputStreamHttpEntity) httpResponse.getEntity()).getInputStream();
memoryManager = ctx.getConnection().getTransport().getMemoryManager();
this.responseStatusCallback = responseStatusCallback;
}
代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-websockets
@SuppressWarnings("unchecked")
protected void sendRaw(byte[] rawData) {
final Connection connection = protocolHandler.getConnection();
final MemoryManager mm = connection.getTransport().getMemoryManager();
final Buffer buffer = Buffers.wrap(mm, rawData);
buffer.allowBufferDispose(false);
connection.write(buffer);
}
代码示例来源:origin: javaee/grizzly
@SuppressWarnings("unchecked")
protected void sendRaw(byte[] rawData) {
final Connection connection = protocolHandler.getConnection();
final MemoryManager mm = connection.getTransport().getMemoryManager();
final Buffer buffer = Buffers.wrap(mm, rawData);
buffer.allowBufferDispose(false);
connection.write(buffer);
}
代码示例来源:origin: javaee/grizzly
@SuppressWarnings("unchecked")
protected void sendRaw(byte[] rawData) {
final Connection connection = protocolHandler.getConnection();
final MemoryManager mm = connection.getTransport().getMemoryManager();
final Buffer buffer = Buffers.wrap(mm, rawData);
buffer.allowBufferDispose(false);
connection.write(buffer);
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server
@SuppressWarnings("unchecked")
protected void sendRaw(byte[] rawData) {
final Connection connection = protocolHandler.getConnection();
final MemoryManager mm = connection.getTransport().getMemoryManager();
final Buffer buffer = Buffers.wrap(mm, rawData);
buffer.allowBufferDispose(false);
connection.write(buffer);
}
代码示例来源:origin: javaee/grizzly
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int selectorRunnerCount = ((NIOTransport) transport).getSelectorRunnersCount();
config.setCorePoolSize(selectorRunnerCount * 2);
config.setMaxPoolSize(selectorRunnerCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: org.glassfish.grizzly/grizzly-core
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int selectorRunnerCount = ((NIOTransport) transport).getSelectorRunnersCount();
config.setCorePoolSize(selectorRunnerCount * 2);
config.setMaxPoolSize(selectorRunnerCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: javaee/grizzly
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int selectorRunnerCount = ((NIOTransport) transport).getSelectorRunnersCount();
config.setCorePoolSize(selectorRunnerCount * 2);
config.setMaxPoolSize(selectorRunnerCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: javaee/grizzly
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int selectorRunnerCount = ((NIOTransport) transport).getSelectorRunnersCount();
config.setCorePoolSize(selectorRunnerCount * 2);
config.setMaxPoolSize(selectorRunnerCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: org.mule.glassfish.grizzly/grizzly-framework
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int selectorRunnerCount = ((NIOTransport) transport).getSelectorRunnersCount();
config.setCorePoolSize(selectorRunnerCount * 2);
config.setMaxPoolSize(selectorRunnerCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
代码示例来源:origin: javaee/grizzly
@Override
public ThreadPoolConfig createDefaultWorkerPoolConfig(final Transport transport) {
final ThreadPoolConfig config = ThreadPoolConfig.defaultConfig().copy();
final int selectorRunnerCount = ((NIOTransport) transport).getSelectorRunnersCount();
config.setCorePoolSize(selectorRunnerCount * 2);
config.setMaxPoolSize(selectorRunnerCount * 2);
config.setMemoryManager(transport.getMemoryManager());
return config;
}
内容来源于网络,如有侵权,请联系作者删除!