final int threadLocalSize() { return threadLocal.get().size; }
final int threadLocalCapacity() { return threadLocal.get().elements.length; }
private void clearNioBuffers() { int count = nioBufferCount; if (count > 0) { nioBufferCount = 0; Arrays.fill(NIO_BUFFERS.get(), 0, count, null); } }
private void clearNioBuffers() { int count = nioBufferCount; if (count > 0) { nioBufferCount = 0; Arrays.fill(NIO_BUFFERS.get(), 0, count, null); } }
private byte[] fingerprint(X509Certificate cert) throws CertificateEncodingException { MessageDigest md = tlmd.get(); md.reset(); return md.digest(cert.getEncoded()); }
/** * Allocates a new array if minLength > {@link ByteBufUtil#MAX_TL_ARRAY_LEN} */ static byte[] threadLocalTempArray(int minLength) { return minLength <= MAX_TL_ARRAY_LEN ? BYTE_ARRAYS.get() : PlatformDependent.allocateUninitializedArray(minLength); }
private static DateFormatter formatter() { DateFormatter formatter = INSTANCES.get(); formatter.reset(); return formatter; }
@Override protected void onRemoval(Stack<T> value) { // Let us remove the WeakOrderQueue from the WeakHashMap directly if its safe to remove some overhead if (value.threadRef.get() == Thread.currentThread()) { if (DELAYED_RECYCLED.isSet()) { DELAYED_RECYCLED.get().remove(value); } } } };
static CodecOutputList newInstance() { return CODEC_OUTPUT_LISTS_POOL.get().getOrCreate(); }
private static DateFormatter formatter() { DateFormatter formatter = INSTANCES.get(); formatter.reset(); return formatter; }
@Override protected void onRemoval(Stack<T> value) { // Let us remove the WeakOrderQueue from the WeakHashMap directly if its safe to remove some overhead if (value.threadRef.get() == Thread.currentThread()) { if (DELAYED_RECYCLED.isSet()) { DELAYED_RECYCLED.get().remove(value); } } } };
/** * Allocates a new array if minLength > {@link ByteBufUtil#MAX_TL_ARRAY_LEN} */ static byte[] threadLocalTempArray(int minLength) { return minLength <= MAX_TL_ARRAY_LEN ? BYTE_ARRAYS.get() : PlatformDependent.allocateUninitializedArray(minLength); }
/** * Creates a new instance. * * @param name the name of this {@link TrustManagerFactory} */ protected SimpleTrustManagerFactory(String name) { super(CURRENT_SPI.get(), PROVIDER, name); CURRENT_SPI.get().init(this); CURRENT_SPI.remove(); if (name == null) { throw new NullPointerException("name"); } }
private InetSocketAddress nextNameServerAddress() { return nameServerAddrStream.get().next(); }
@Override public Marshaller getMarshaller(ChannelHandlerContext ctx) throws Exception { Marshaller marshaller = marshallers.get(); if (marshaller == null) { marshaller = factory.createMarshaller(config); marshallers.set(marshaller); } return marshaller; } }
@Override public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception { Unmarshaller unmarshaller = unmarshallers.get(); if (unmarshaller == null) { unmarshaller = factory.createUnmarshaller(config); unmarshallers.set(unmarshaller); } return unmarshaller; }
@Override public Marshaller getMarshaller(ChannelHandlerContext ctx) throws Exception { Marshaller marshaller = marshallers.get(); if (marshaller == null) { marshaller = factory.createMarshaller(config); marshallers.set(marshaller); } return marshaller; } }
@Override public Unmarshaller getUnmarshaller(ChannelHandlerContext ctx) throws Exception { Unmarshaller unmarshaller = unmarshallers.get(); if (unmarshaller == null) { unmarshaller = factory.createUnmarshaller(config); unmarshallers.set(unmarshaller); } return unmarshaller; }
@SuppressWarnings("unchecked") public final T get() { if (maxCapacityPerThread == 0) { return newObject((Handle<T>) NOOP_HANDLE); } Stack<T> stack = threadLocal.get(); DefaultHandle<T> handle = stack.pop(); if (handle == null) { handle = stack.newHandle(); handle.value = newObject(handle); } return (T) handle.value; }
@SuppressWarnings("unchecked") public final T get() { if (maxCapacityPerThread == 0) { return newObject((Handle<T>) NOOP_HANDLE); } Stack<T> stack = threadLocal.get(); DefaultHandle<T> handle = stack.pop(); if (handle == null) { handle = stack.newHandle(); handle.value = newObject(handle); } return (T) handle.value; }