/*
* Copyright 2013 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
/*
* Written by Doug Lea with assistance from members of JCP JSR-166
* Expert Group and released to the public domain, as explained at
* http://creativecommons.org/publicdomain/zero/1.0/
*/
package io.netty.util.internal.chmv8;
import io.netty.util.internal.IntegerHolder;
import io.netty.util.internal.InternalThreadLocalMap;
import java.io.ObjectStreamField;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;
/**
* A hash table supporting full concurrency of retrievals and
* high expected concurrency for updates. This class obeys the
* same functional specification as {@link java.util.Hashtable}, and
* includes versions of methods corresponding to each method of
* {@code Hashtable}. However, even though all operations are
* thread-safe, retrieval operations do <em>not</em> entail locking,
* and there is <em>not</em> any support for locking the entire table
* in a way that prevents all access. This class is fully
* interoperable with {@code Hashtable} in programs that rely on its
* thread safety but not on its synchronization details.
*
* <p>Retrieval operations (including {@code get}) generally do not
* block, so may overlap with update operations (including {@code put}
* and {@code remove}). Retrievals reflect the results of the most
* recently <em>completed</em> update operations holding upon their
* onset. (More formally, an update operation for a given key bears a
* <em>happens-before</em> relation with any (non-null) retrieval for
* that key reporting the updated value.) For aggregate operations
* such as {@code putAll} and {@code clear}, concurrent retrievals may
* reflect insertion or removal of only some entries. Similarly,
* Iterators and Enumerations return elements reflecting the state of
* the hash table at some point at or since the creation of the
* iterator/enumeration. They do <em>not</em> throw {@link
* ConcurrentModificationException}. However, iterators are designed
* to be used by only one thread at a time. Bear in mind that the
* results of aggregate status methods including {@code size}, {@code
* isEmpty}, and {@code containsValue} are typically useful only when
* a map is not undergoing concurrent updates in other threads.
* Otherwise the results of these methods reflect transient states
* that may be adequate for monitoring or estimation purposes, but not
* for program control.
*
* <p>The table is dynamically expanded when there are too many
* collisions (i.e., keys that have distinct hash codes but fall into
* the same slot modulo the table size), with the expected average
* effect of maintaining roughly two bins per mapping (corresponding
* to a 0.75 load factor threshold for resizing). There may be much
* variance around this average as mappings are added and removed, but
* overall, this maintains a commonly accepted time/space tradeoff for
* hash tables. However, resizing this or any other kind of hash
* table may be a relatively slow operation. When possible, it is a
* good idea to provide a size estimate as an optional {@code
* initialCapacity} constructor argument. An additional optional
* {@code loadFactor} constructor argument provides a further means of
* customizing initial table capacity by specifying the table density
* to be used in calculating the amount of space to allocate for the
* given number of elements. Also, for compatibility with previous
* versions of this class, constructors may optionally specify an
* expected {@code concurrencyLevel} as an additional hint for
* internal sizing. Note that using many keys with exactly the same
* {@code hashCode()} is a sure way to slow down performance of any
* hash table. To ameliorate impact, when keys are {@link Comparable},
* this class may use comparison order among keys to help break ties.
*
* <p>A {@link Set} projection of a ConcurrentHashMapV8 may be created
* (using {@link #newKeySet()} or {@link #newKeySet(int)}), or viewed
* (using {@link #keySet(Object)} when only keys are of interest, and the
* mapped values are (perhaps transiently) not used or all take the
* same mapping value.
*
* <p>This class and its views and iterators implement all of the
* <em>optional</em> methods of the {@link Map} and {@link Iterator}
* interfaces.
*
* <p>Like {@link Hashtable} but unlike {@link HashMap}, this class
* does <em>not</em> allow {@code null} to be used as a key or value.
*
* <p>ConcurrentHashMapV8s support a set of sequential and parallel bulk
* operations that are designed
* to be safely, and often sensibly, applied even with maps that are
* being concurrently updated by other threads; for example, when
* computing a snapshot summary of the values in a shared registry.
* There are three kinds of operation, each with four forms, accepting
* functions with Keys, Values, Entries, and (Key, Value) arguments
* and/or return values. Because the elements of a ConcurrentHashMapV8
* are not ordered in any particular way, and may be processed in
* different orders in different parallel executions, the correctness
* of supplied functions should not depend on any ordering, or on any
* other objects or values that may transiently change while
* computation is in progress; and except for forEach actions, should
* ideally be side-effect-free. Bulk operations on {@link java.util.Map.Entry}
* objects do not support method {@code setValue}.
*
* <ul>
* <li> forEach: Perform a given action on each element.
* A variant form applies a given transformation on each element
* before performing the action.</li>
*
* <li> search: Return the first available non-null result of
* applying a given function on each element; skipping further
* search when a result is found.</li>
*
* <li> reduce: Accumulate each element. The supplied reduction
* function cannot rely on ordering (more formally, it should be
* both associative and commutative). There are five variants:
*
* <ul>
*
* <li> Plain reductions. (There is not a form of this method for
* (key, value) function arguments since there is no corresponding
* return type.)</li>
*
* <li> Mapped reductions that accumulate the results of a given
* function applied to each element.</li>
*
* <li> Reductions to scalar doubles, longs, and ints, using a
* given basis value.</li>
*
* </ul>
* </li>
* </ul>
*
* <p>These bulk operations accept a {@code parallelismThreshold}
* argument. Methods proceed sequentially if the current map size is
* estimated to be less than the given threshold. Using a value of
* {@code Long.MAX_VALUE} suppresses all parallelism. Using a value
* of {@code 1} results in maximal parallelism by partitioning into
* enough subtasks to fully utilize the {@link
* ForkJoinPool#commonPool()} that is
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
jboss netty5.0 (2000个子文件)
ConcurrentHashMapV8.class 71KB
HttpUploadClient.class 61KB
ForkJoinPool.class 42KB
DefaultHeaders.class 38KB
CompositeByteBuf.class 37KB
Bzip2DivSufSort.class 35KB
HttpPostMultipartRequestDecoder.class 29KB
DefaultChannelPipeline.class 28KB
AbstractByteBuf.class 23KB
AsciiString.class 22KB
DefaultPromise.class 22KB
DnsNameResolver.class 21KB
HttpPostRequestEncoder.class 20KB
ForkJoinTask.class 20KB
PlatformDependent.class 20KB
ReplayingDecoderBuffer.class 19KB
SwappedByteBuf.class 19KB
EmptyHeaders.class 18KB
WrappedByteBuf.class 18KB
MqttDecoder.class 18KB
EmptyByteBuf.class 18KB
GlobalChannelTrafficShapingHandler.class 18KB
NioEventLoop.class 17KB
Http2ConnectionHandler.class 17KB
SpdySessionHandler.class 17KB
NioDatagramChannel.class 16KB
DefaultHttp2FrameWriter.class 16KB
AbstractChannelHandlerContext.class 16KB
SingleThreadEventExecutor.class 16KB
NetUtil.class 16KB
DefaultHttp2FrameReader.class 16KB
HttpUploadServerHandler.class 16KB
AdvancedLeakAwareByteBuf.class 16KB
WorldClockProtocol$LocalTimes$Builder.class 15KB
DefaultHttp2ConnectionEncoder.class 15KB
WorldClockProtocol$Locations$Builder.class 15KB
Native.class 15KB
HttpObjectDecoder.class 15KB
DefaultTextHeaders.class 15KB
OioSctpChannel.class 15KB
AbstractChannel$AbstractUnsafe.class 14KB
HttpPostStandardRequestDecoder.class 14KB
WorldClockProtocol$LocalTime.class 14KB
ChannelOutboundBuffer.class 14KB
DefaultHttp2ConnectionDecoder$FrameReadListener.class 14KB
EpollDatagramChannel.class 14KB
DnsNameResolverContext.class 14KB
MqttEncoder.class 14KB
Unpooled.class 14KB
EmptyHttp2Headers.class 13KB
DefaultHttpHeaders.class 13KB
NioSctpChannel.class 13KB
UnpooledDirectByteBuf.class 13KB
OioDatagramChannel.class 13KB
DefaultHttp2Headers.class 13KB
WorldClockProtocol$Location.class 13KB
LoggingHandler.class 13KB
WorldClockProtocol$LocalTimes.class 13KB
WorldClockProtocol$Locations.class 13KB
FixedCompositeByteBuf.class 13KB
SpdyHttpDecoder.class 12KB
SpdyCodecUtil.class 12KB
PausableChannelEventExecutor.class 12KB
ByteBufUtil.class 12KB
ConcurrentHashMapV8$TreeBin.class 12KB
SpdyFrameCodec.class 12KB
DefaultSpdyHeaders.class 12KB
DefaultChannelId.class 12KB
AbstractBootstrap.class 12KB
UnpooledUnsafeDirectByteBuf.class 12KB
AbstractChannel.class 12KB
WorldClockProtocol$LocalTime$Builder.class 12KB
DefaultHttp2Connection$DefaultStream.class 12KB
HttpStaticFileServerHandler.class 12KB
EpollDatagramChannelConfig.class 11KB
EpollSocketChannelConfig.class 11KB
EmptyHttpHeaders.class 11KB
AbstractTrafficShapingHandler.class 11KB
DefaultStompHeaders.class 11KB
PooledUnsafeDirectByteBuf.class 11KB
DefaultHttp2Connection.class 11KB
DefaultDatagramChannelConfig.class 11KB
ProxyHandler.class 11KB
DefaultChannelGroupFuture.class 11KB
PlatformDependent0.class 11KB
AbstractDiskHttpData.class 11KB
DefaultBinaryHeaders.class 11KB
PoolArena.class 11KB
ForkJoinPool$WorkQueue.class 11KB
UnpooledHeapByteBuf.class 10KB
DefaultChannelHandlerInvoker.class 10KB
WebSocket08FrameDecoder.class 10KB
DefaultChannelProgressivePromise.class 10KB
Snappy.class 10KB
WorldClockProtocol$Location$Builder.class 10KB
IntObjectHashMap.class 10KB
DefaultChannelGroup.class 10KB
PooledDirectByteBuf.class 10KB
DefaultChannelConfig.class 10KB
Bootstrap.class 10KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
_stonem
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于STM32使用HAL库实现USB组合设备之多路CDC源码+说明文档.zip
- 金融贸易项目springboot
- mybatis动态sqlSQL 映射 XML 文件是所有 sql 语句
- 基于基于STM32的智能家居系统源码+qt上位机源码.zip
- 深圳房地产资源数据报告
- 基于stm32的智能门禁系统源码+设计文档+演示视频.zip
- cef + chromium 完整源码支持h265和h264
- 基于SpringBoot的API管理平台源代码+数据库,以项目的形式管理API文档,可以进行API的编辑、测试、Mock等操作
- protobuf 3.11版本,静态编译
- 2023NOC创客智慧编程赛项真题图形化-选拔赛(有解析)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功