当前位置: 首页>>代码示例>>Java>>正文


Java BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR属性代码示例

本文整理汇总了Java中org.xnio.BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR属性的典型用法代码示例。如果您正苦于以下问题:Java BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR属性的具体用法?Java BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR怎么用?Java BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.xnio.BufferAllocator的用法示例。


在下文中一共展示了BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

private static ManagementHttpServer create(Builder builder) {
    SSLContext sslContext = null;
    SslClientAuthMode sslClientAuthMode = builder.sslClientAuthMode;
    if (builder.secureBindAddress != null) {
        sslContext = getSSLContext(builder);
        if (sslContext == null) {
            throw ROOT_LOGGER.sslRequestedNoSslContext();
        }
    }

    HttpOpenListener openListener = new HttpOpenListener(new ByteBufferSlicePool(BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR, 4096, 10 * 4096));

    int secureRedirectPort = builder.secureBindAddress != null ? builder.secureBindAddress.getPort() : -1;
    // WFLY-2870 -- redirect not supported if bindAddress and secureBindAddress are using different InetAddress
    boolean redirectSupported = (builder.bindAddress == null || builder.secureBindAddress == null || builder.bindAddress.getAddress().equals(builder.secureBindAddress.getAddress()));
    if (!redirectSupported && secureRedirectPort > 0) {
        HttpServerLogger.ROOT_LOGGER.httpsRedirectNotSupported(builder.bindAddress.getAddress(), builder.secureBindAddress.getAddress());
        secureRedirectPort = -1;
    }

    final ExtensionHandlers extensionHandlers = setupOpenListener(openListener, secureRedirectPort, builder);
    return new ManagementHttpServer(openListener, builder.bindAddress, builder.secureBindAddress, sslContext, sslClientAuthMode, builder.worker, extensionHandlers);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:23,代码来源:ManagementHttpServer.java

示例2: createByteBufferPool

private ByteBufferPool createByteBufferPool() {
    long maxMemory = Runtime.getRuntime().maxMemory();
    boolean useDirectBuffers;
    int bufferSize, buffersPerRegion;
    if (maxMemory < 64 * 1024 * 1024) {
        //smaller than 64mb of ram we use 512b buffers
        useDirectBuffers = false;
        bufferSize = 512;
        buffersPerRegion = 10;
    } else if (maxMemory < 128 * 1024 * 1024) {
        //use 1k buffers
        useDirectBuffers = true;
        bufferSize = 1024;
        buffersPerRegion = 10;
    } else {
        //use 16k buffers for best performance
        //as 16k is generally the max amount of data that can be sent in a single write() call
        useDirectBuffers = true;
        bufferSize = 1024 * 16;
        buffersPerRegion = 20;
    }
    BufferAllocator<ByteBuffer> allocator;
    if (useDirectBuffers) {
        allocator = BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR;
    } else {
        allocator = BufferAllocator.BYTE_BUFFER_ALLOCATOR;
    }
    int maxRegionSize = buffersPerRegion * bufferSize;
    ByteBufferSlicePool pool = new ByteBufferSlicePool(allocator, bufferSize, maxRegionSize);
    return new XnioByteBufferPool(pool);
}
 
开发者ID:hawkular,项目名称:hawkular-metrics,代码行数:31,代码来源:TokenAuthenticator.java

示例3: getResourceManager

private ResourceManager getResourceManager(File warFile, Long transferMinSize, String cfmlDirs, File internalCFMLServerRoot) {
    MappedResourceManager mappedResourceManager = new MappedResourceManager(warFile, transferMinSize, cfmlDirs, internalCFMLServerRoot);
    if(serverOptions.isDirectoryListingRefreshEnabled()) return mappedResourceManager;
    final DirectBufferCache dataCache = new DirectBufferCache(1000, 10, 1000 * 10 * 1000, BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR, METADATA_MAX_AGE);
    final int metadataCacheSize = 100;
    final long maxFileSize = 10000;
    return new CachingResourceManager(metadataCacheSize,maxFileSize, dataCache, mappedResourceManager, METADATA_MAX_AGE);
}
 
开发者ID:cfmlprojects,项目名称:runwar,代码行数:8,代码来源:Server.java

示例4: DirectBufferCache

public DirectBufferCache(int sliceSize, int slicesPerPage, int maxMemory) {
    this(sliceSize, slicesPerPage, maxMemory, BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:3,代码来源:DirectBufferCache.java

示例5: start

@Override
public void start(StartContext context) throws StartException {
    bufferPool = new ByteBufferSlicePool(directBuffers ? BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR : BufferAllocator.BYTE_BUFFER_ALLOCATOR, bufferSize, buffersPerSlice * bufferSize);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:4,代码来源:BufferPoolService.java

示例6: LimitedBufferSlicePool

/**
 * Construct a new instance, using a direct buffer allocator.
 *
 * @param bufferSize the size of each buffer
 * @param maxRegionSize the maximum region size for each backing buffer
 */
public LimitedBufferSlicePool(final int bufferSize, final int maxRegionSize) {
    this(BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR, bufferSize, maxRegionSize);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:LimitedBufferSlicePool.java


注:本文中的org.xnio.BufferAllocator.DIRECT_BYTE_BUFFER_ALLOCATOR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。