本文整理汇总了Java中io.undertow.server.DefaultByteBufferPool类的典型用法代码示例。如果您正苦于以下问题:Java DefaultByteBufferPool类的具体用法?Java DefaultByteBufferPool怎么用?Java DefaultByteBufferPool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultByteBufferPool类属于io.undertow.server包,在下文中一共展示了DefaultByteBufferPool类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: test
import io.undertow.server.DefaultByteBufferPool; //导入依赖的package包/类
@Test
public void test() throws Exception {
ByteBufferPool byteBufferPool = new DefaultByteBufferPool(true, 2, -1, 4);
PooledByteBufferOutputStream output = new PooledByteBufferOutputStream(byteBufferPool);
String hello = "hello, 世界!";
output.write(hello);
output.flip();
PooledByteBuffer[] buffers = output.getPooledByteBuffers();
try (PooledByteBufferInputStream input = new PooledByteBufferInputStream(buffers);) {
byte[] bytes = new byte[input.available()];
input.read(bytes);
String str = new String(bytes, "UTF-8");
assertEquals(hello, str);
}
output.release();
output.close();
}
开发者ID:hank-whu,项目名称:undertow-async,代码行数:23,代码来源:IOTest.java
示例2: connectionBuilder
import io.undertow.server.DefaultByteBufferPool; //导入依赖的package包/类
protected ConnectionBuilder connectionBuilder() throws XNIOException {
try {
this.worker = Xnio.getInstance().createWorker(OptionMap.EMPTY);
return new ConnectionBuilder(this.worker, new DefaultByteBufferPool(true, 1024), uri);
} catch (IOException e) {
throw new XNIOException(e);
}
}
开发者ID:BraindeadCrew,项目名称:java-websocket,代码行数:9,代码来源:WebSocketClientImpl.java
示例3: Undertow13BufferSupport
import io.undertow.server.DefaultByteBufferPool; //导入依赖的package包/类
public Undertow13BufferSupport() {
this.undertowBufferPool = new DefaultByteBufferPool(false, 1024, -1, 2);
this.httpClientConnectCallbackMethod = ReflectionUtils.findMethod(UndertowClient.class, "connect",
ClientCallback.class, URI.class, XnioWorker.class, ByteBufferPool.class, OptionMap.class);
this.httpClientConnectMethod = ReflectionUtils.findMethod(UndertowClient.class, "connect",
URI.class, XnioWorker.class, ByteBufferPool.class, OptionMap.class);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:UndertowXhrTransport.java
示例4: webSocketDeploymentInfo
import io.undertow.server.DefaultByteBufferPool; //导入依赖的package包/类
private static WebSocketDeploymentInfo webSocketDeploymentInfo(Config cfg) {
Config wsOptions = cfg.getConfig(KEY_WS_WEB_SOCKET_OPTIONS);
return new WebSocketDeploymentInfo()
.setWorker(webSocketWorker(wsOptions))
.setBuffers(new DefaultByteBufferPool(wsOptions.getBoolean(KEY_WS_USE_DIRECT_BUFFER),
wsOptions.getInt(KEY_WS_BUFFER_SIZE)))
.addEndpoint(ServerLogsWebSocket.class);
}
开发者ID:AdeptJ,项目名称:adeptj-runtime,代码行数:9,代码来源:Server.java
示例5: initUndertowServer
import io.undertow.server.DefaultByteBufferPool; //导入依赖的package包/类
public void initUndertowServer() {
JbootServerClassloader classloader = new JbootServerClassloader(UnderTowServer.class.getClassLoader());
classloader.setDefaultAssertionStatus(false);
deploymentInfo = buildDeploymentInfo(classloader);
if (webConfig.isWebsocketEnable()) {
Set<Class> endPointClasses = JbootWebsocketManager.me().getWebsocketEndPoints();
WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo();
webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(true, webConfig.getWebsocketBufferPoolSize()));
for (Class endPointClass : endPointClasses) {
webSocketDeploymentInfo.addEndpoint(endPointClass);
}
deploymentInfo.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, webSocketDeploymentInfo);
}
servletContainer = Servlets.newContainer();
deploymentManager = servletContainer.addDeployment(deploymentInfo);
deploymentManager.deploy();
HttpHandler httpHandler = null;
try {
/**
* 启动并初始化servlet和filter
*/
httpHandler = deploymentManager.start();
} catch (Throwable ex) {
ex.printStackTrace();
}
pathHandler = Handlers.path(
Handlers.resource(new ClassPathResourceManager(classloader, "webRoot")));
pathHandler.addPrefixPath(config.getContextPath(), httpHandler);
undertow = Undertow.builder()
.addHttpListener(config.getPort(), config.getHost())
.setHandler(pathHandler)
.build();
}
开发者ID:yangfuhai,项目名称:jboot,代码行数:46,代码来源:UnderTowServer.java
示例6: InVMConnection
import io.undertow.server.DefaultByteBufferPool; //导入依赖的package包/类
InVMConnection(XnioWorker worker, int port) {
this.bufferPool = new DefaultByteBufferPool(false, 1024, 0, 0);
this.worker = worker;
this.address = new InetSocketAddress(port); // port carried forward from the initial
}
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:6,代码来源:InVMConnection.java
示例7: doStart
import io.undertow.server.DefaultByteBufferPool; //导入依赖的package包/类
@Override
protected void doStart() throws Exception {
super.doStart();
pool = new DefaultByteBufferPool(true, 8192);
worker = Xnio.getInstance().createWorker(options);
LOG.debug("Created worker: {} with options: {}", worker, options);
}
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:UndertowProducer.java
注:本文中的io.undertow.server.DefaultByteBufferPool类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论