use of org.glassfish.grizzly.memory.MemoryManager in project Payara by payara.
the class GrizzlyConfigTest method testDirectBufferConfiguration.
@Test
public void testDirectBufferConfiguration() throws Exception {
GrizzlyConfig grizzlyConfig = null;
try {
configure();
grizzlyConfig = new GrizzlyConfig("grizzly-direct-buffer.xml");
grizzlyConfig.setupNetwork();
final String bufferType = grizzlyConfig.getConfig().getNetworkListeners().getNetworkListener().get(0).findTransport().getByteBufferType();
Assert.assertEquals("direct", bufferType);
GenericGrizzlyListener genericGrizzlyListener = (GenericGrizzlyListener) getListener(grizzlyConfig, "http-listener-1");
MemoryManager mm = genericGrizzlyListener.getTransport().getMemoryManager();
assertEquals(ByteBufferManager.class.getName(), mm.getClass().getName());
assertTrue(((ByteBufferManager) mm).isDirect());
} finally {
if (grizzlyConfig != null) {
grizzlyConfig.shutdownNetwork();
grizzlyConfig.shutdown();
}
}
}
use of org.glassfish.grizzly.memory.MemoryManager in project Payara by payara.
the class XProtocolFilter method handleRead.
@Override
public NextAction handleRead(final FilterChainContext ctx) throws IOException {
final Connection connection = ctx.getConnection();
final MemoryManager memoryManager = connection.getTransport().getMemoryManager();
ctx.write(Buffers.wrap(memoryManager, "X-Protocol-Response", CHARSET));
ctx.flush(new EmptyCompletionHandler() {
@Override
public void completed(Object result) {
connection.closeSilently();
}
});
return ctx.getStopAction();
}
use of org.glassfish.grizzly.memory.MemoryManager in project Payara by payara.
the class GrizzlyConfigTest method testDefaultBufferConfiguration.
@Test
public void testDefaultBufferConfiguration() throws Exception {
GrizzlyConfig grizzlyConfig = null;
try {
configure();
grizzlyConfig = new GrizzlyConfig("grizzly-config.xml");
grizzlyConfig.setupNetwork();
final String bufferType = grizzlyConfig.getConfig().getNetworkListeners().getNetworkListener().get(0).findTransport().getByteBufferType();
Assert.assertEquals("heap", bufferType);
GenericGrizzlyListener genericGrizzlyListener = (GenericGrizzlyListener) getListener(grizzlyConfig, "http-listener-1");
MemoryManager mm = genericGrizzlyListener.getTransport().getMemoryManager();
assertEquals(HeapMemoryManager.class.getName(), mm.getClass().getName());
} finally {
if (grizzlyConfig != null) {
grizzlyConfig.shutdownNetwork();
grizzlyConfig.shutdown();
}
}
}
Aggregations