org.glassfish.grizzly.Connection.getMemoryManager()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.glassfish.grizzly.Connection.getMemoryManager()方法的一些代码示例,展示了Connection.getMemoryManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connection.getMemoryManager()方法的具体详情如下:
包路径:org.glassfish.grizzly.Connection
类名称:Connection
方法名:getMemoryManager

Connection.getMemoryManager介绍

暂无

代码示例

代码示例来源:origin: com.ning/async-http-client

public GrizzlyResponse(final HttpResponsePacket httpResponsePacket,
            final HttpResponseStatus status,
            final HttpResponseHeaders headers,
            final List<HttpResponseBodyPart> bodyParts) {
  super(status, headers, bodyParts);
  this.httpResponsePacket = httpResponsePacket;
  
  if (isNonEmpty(bodyParts)) {
    if (bodyParts.size() == 1) {
      responseBody = ((GrizzlyResponseBodyPart) bodyParts.get(0)).getBodyBuffer();
    } else {
      final Buffer firstBuffer = ((GrizzlyResponseBodyPart) bodyParts.get(0)).getBodyBuffer();
      final MemoryManager mm = httpResponsePacket.getRequest().getConnection().getMemoryManager();
      Buffer constructedBodyBuffer = firstBuffer;
      for (int i = 1, len = bodyParts.size(); i < len; i++) {
        constructedBodyBuffer =
            Buffers.appendBuffers(mm,
                constructedBodyBuffer,
                ((GrizzlyResponseBodyPart) bodyParts.get(i)).getBodyBuffer());
      }
      responseBody = constructedBodyBuffer;
    }
  } else {
    responseBody = Buffers.EMPTY_BUFFER;
  }
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

public TransformerInput(Transformer<Buffer, Buffer> transformer,
    Input underlyingInput, Connection connection) {
  this(transformer, underlyingInput,
      connection.getMemoryManager(), connection);
}

代码示例来源:origin: javaee/grizzly

public TransformerInput(Transformer<Buffer, Buffer> transformer,
    Input underlyingInput, Connection connection) {
  this(transformer, underlyingInput,
      connection.getMemoryManager(), connection);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http-server-core

public TransformerInput(Transformer<Buffer, Buffer> transformer,
    Input underlyingInput, Connection connection) {
  this(transformer, underlyingInput,
      connection.getMemoryManager(), connection);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

protected MemoryManager obtainMemoryManager(AttributeStorage storage) {
  if (memoryManager != null) {
    return memoryManager;
  }
  if (storage instanceof Connection) {
    Connection connection = (Connection) storage;
    return connection.getMemoryManager();
  }
  return MemoryManager.DEFAULT_MEMORY_MANAGER;
}

代码示例来源:origin: javaee/grizzly

protected MemoryManager obtainMemoryManager(AttributeStorage storage) {
  if (memoryManager != null) {
    return memoryManager;
  }
  if (storage instanceof Connection) {
    Connection connection = (Connection) storage;
    return connection.getMemoryManager();
  }
  return MemoryManager.DEFAULT_MEMORY_MANAGER;
}

代码示例来源:origin: javaee/grizzly

public TransformerOutput(Transformer<Buffer, Buffer> transformer,
    Output underlyingOutput, Connection connection) {
  this(transformer, underlyingOutput,
      connection.getMemoryManager(), connection);
}

代码示例来源:origin: javaee/grizzly

public TransformerInput(Transformer<Buffer, Buffer> transformer,
    Input underlyingInput, Connection connection) {
  this(transformer, underlyingInput,
      connection.getMemoryManager(), connection);
}

代码示例来源:origin: javaee/grizzly

public TransformerOutput(Transformer<Buffer, Buffer> transformer,
    Output underlyingOutput, Connection connection) {
  this(transformer, underlyingOutput,
      connection.getMemoryManager(), connection);
}

代码示例来源:origin: javaee/grizzly

/**
 * <p>A simple alias for <code>FilterChainContext.getConnection().getMemoryManager()</code>.
 *
 * @return the {@link MemoryManager} associated with the {@link Connection}
 *  of this <code>FilterChainContext</code>.
 */
public final MemoryManager getMemoryManager() {
  return getConnection().getMemoryManager();
}

代码示例来源:origin: javaee/grizzly

/**
 * <p>A simple alias for <code>FilterChainContext.getConnection().getMemoryManager()</code>.
 *
 * @return the {@link MemoryManager} associated with the {@link Connection}
 *  of this <code>FilterChainContext</code>.
 */
public final MemoryManager getMemoryManager() {
  return getConnection().getMemoryManager();
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-core

/**
 * <p>A simple alias for <code>FilterChainContext.getConnection().getMemoryManager()</code>.
 *
 * @return the {@link MemoryManager} associated with the {@link Connection}
 *  of this <code>FilterChainContext</code>.
 */
public final MemoryManager getMemoryManager() {
  return getConnection().getMemoryManager();
}

代码示例来源:origin: javaee/grizzly

/**
 * <p>A simple alias for <code>FilterChainContext.getConnection().getMemoryManager()</code>.
 *
 * @return the {@link MemoryManager} associated with the {@link Connection}
 *  of this <code>FilterChainContext</code>.
 */
public final MemoryManager getMemoryManager() {
  return getConnection().getMemoryManager();
}

代码示例来源:origin: org.glassfish.tyrus.tests/tyrus-test-tools

private void flushBufferedData() {
    if (buffer.size() == 0) {
      // buffer is empty
      return;
    }
    Buffer message = Buffers.wrap(grizzlyConnection.getMemoryManager(), buffer.toByteArray());
    grizzlyConnection.write(message);
    buffer.reset();
  }
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-http

@Override
public Buffer clone(final Connection connection,
    final Buffer originalMessage) {
  
  // Buffer was disposed somewhere on the way to async write queue -
  // just return the original message
  if (temporaryWriteBuffer.isDisposed()) {
    return originalMessage;
  }
  
  return clone0(connection.getMemoryManager(), originalMessage);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public void writeByteArray(byte[] data, int offset, int length) throws IOException {
  final Buffer buffer = Buffers.wrap(connection.getMemoryManager(),
      data, offset, length);
  output.write(buffer);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-core

/**
 * {@inheritDoc}
 */
@Override
public void writeByteArray(byte[] data, int offset, int length) throws IOException {
  final Buffer buffer = Buffers.wrap(connection.getMemoryManager(),
      data, offset, length);
  output.write(buffer);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public void writeByteArray(byte[] data, int offset, int length) throws IOException {
  final Buffer buffer = Buffers.wrap(connection.getMemoryManager(),
      data, offset, length);
  output.write(buffer);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

@Override
  @SuppressWarnings("unchecked")
  public Buffer grow(final SSLConnectionContext sslCtx,
    final Buffer oldBuffer, final int newSize) {
    final MemoryManager mm = sslCtx.getConnection().getMemoryManager();
    
    return oldBuffer == null ?
        mm.allocate(newSize) :
        mm.reallocate(oldBuffer, newSize);
  }
};

代码示例来源:origin: org.mule.services/mule-service-http

@Before
public void setUp() {
 HttpEntity entity = new ByteArrayHttpEntity(new byte[1]);
 responseMock = mock(HttpResponse.class);
 when(request.getProtocol()).thenReturn(HTTP_1_1);
 when(responseMock.getEntity()).thenReturn(entity);
 when(ctx.getConnection()).thenReturn(connection);
 when(connection.getMemoryManager()).thenReturn(null);
 when(ctx.getMemoryManager()).thenReturn(null);
}

相关文章