/*
* 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
没有合适的资源?快使用搜索试试~ 我知道了~
netty-all-5.0.0.Alpha3 完整pom.xml配置
共2000个文件
class:2210个
java:1305个
jpeg:400个
需积分: 44 13 下载量 175 浏览量
2016-08-16
11:02:23
上传
评论
收藏 5.6MB RAR 举报
温馨提示
由于netty各个版本之间差异较大,这里整理了一下各个版本的包及样例,使用了maven工程,将各个版本需要的最简jar文件已配置完全,可以在些基础上进行正式项目的开发。
资源推荐
资源详情
资源评论
收起资源包目录
netty-all-5.0.0.Alpha3 完整pom.xml配置 (2000个子文件)
ConcurrentHashMapV8.class 71KB
HttpUploadClient.class 62KB
ForkJoinPool.class 42KB
CompositeByteBuf.class 40KB
Bzip2DivSufSort.class 35KB
DefaultHeaders.class 31KB
OpenSslEngine.class 30KB
HttpPostMultipartRequestDecoder.class 29KB
SslHandler.class 29KB
AsciiString.class 28KB
DefaultChannelPipeline.class 27KB
AbstractByteBuf.class 27KB
PlatformDependent.class 26KB
DnsNameResolver.class 25KB
DefaultPromise.class 22KB
ReplayingDecoderByteBuf.class 21KB
HttpPostRequestEncoder.class 21KB
SwappedByteBuf.class 21KB
ForkJoinTask.class 20KB
WrappedByteBuf.class 20KB
Http2ConnectionHandler.class 20KB
EmptyByteBuf.class 19KB
SslContext.class 19KB
DefaultHttp2FrameWriter.class 18KB
MqttDecoder.class 18KB
GlobalChannelTrafficShapingHandler.class 18KB
AbstractEpollStreamChannel.class 17KB
DnsNameResolverContext.class 17KB
OpenSslContext.class 17KB
SingleThreadEventExecutor.class 17KB
NioEventLoop.class 17KB
SpdySessionHandler.class 17KB
HttpUploadServerHandler.class 17KB
NioDatagramChannel.class 17KB
ByteBufUtil.class 16KB
AdvancedLeakAwareByteBuf.class 16KB
PoolArena.class 16KB
DefaultHttp2FrameReader.class 16KB
AbstractChannelHandlerContext.class 16KB
HttpObjectDecoder.class 16KB
EmptyHeaders.class 16KB
NetUtil.class 15KB
WorldClockProtocol$LocalTimes$Builder.class 15KB
WorldClockProtocol$Locations$Builder.class 15KB
ChannelOutboundBuffer.class 15KB
DefaultHttp2ConnectionDecoder$FrameReadListener.class 15KB
PlatformDependent0.class 15KB
DefaultHttp2Connection$DefaultStream.class 15KB
OpenSslServerContext.class 15KB
HttpPostStandardRequestDecoder.class 14KB
JdkSslContext.class 14KB
DefaultHttp2ConnectionEncoder.class 14KB
AbstractChannel$AbstractUnsafe.class 14KB
OioSctpChannel.class 14KB
WorldClockProtocol$LocalTime.class 14KB
UnpooledDirectByteBuf.class 14KB
EpollDatagramChannel.class 14KB
FixedCompositeByteBuf.class 14KB
MqttEncoder.class 14KB
Unpooled.class 14KB
NioSctpChannel.class 13KB
UnsafeByteBufUtil.class 13KB
OioDatagramChannel.class 13KB
SpdyFrameCodec.class 13KB
HttpConversionUtil.class 13KB
WorldClockProtocol$Location.class 13KB
EpollSocketChannelConfig.class 13KB
DefaultHttp2Connection.class 13KB
WorldClockProtocol$LocalTimes.class 13KB
WorldClockProtocol$Locations.class 13KB
SpdyCodecUtil.class 12KB
PausableChannelEventExecutor.class 12KB
AbstractChannel.class 12KB
ConcurrentHashMapV8$TreeBin.class 12KB
SpdyHttpDecoder.class 12KB
HttpStaticFileServerHandler.class 12KB
DefaultChannelId.class 12KB
AbstractBootstrap.class 12KB
LocalChannel.class 12KB
SimpleChannelPool.class 12KB
WorldClockProtocol$LocalTime$Builder.class 12KB
AbstractDnsMessage.class 12KB
EpollDatagramChannelConfig.class 12KB
CharObjectHashMap.class 11KB
AbstractTrafficShapingHandler.class 11KB
ShortObjectHashMap.class 11KB
LongObjectHashMap.class 11KB
ByteObjectHashMap.class 11KB
IntObjectHashMap.class 11KB
OpenSslEngine$OpenSslSession.class 11KB
UnpooledUnsafeDirectByteBuf.class 11KB
DefaultHttp2RemoteFlowController.class 11KB
PooledDirectByteBuf.class 11KB
DefaultChannelConfig.class 11KB
DefaultDatagramChannelConfig.class 11KB
UnpooledHeapByteBuf.class 11KB
OpenSslClientContext.class 11KB
DefaultChannelGroup.class 11KB
PooledByteBufAllocator.class 11KB
ProxyHandler.class 11KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
冷月宫主
- 粉丝: 1185
- 资源: 364
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功