org.jboss.netty.util.internal.ConcurrentHashMap Java Examples

The following examples show how to use org.jboss.netty.util.internal.ConcurrentHashMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZooKeeperRegister.java    From turbo-rpc with Apache License 2.0 5 votes vote down vote up
@Override
public void init(List<HostPort> hostPorts) {
	watcherMap = new ConcurrentHashMap<>();
	String connectString = hostPorts.stream().map(i -> i.toString()).collect(Collectors.joining(","));
	RetryPolicy retryPolicy = new ForeverRetryPolicy(1000, 60 * 1000);
	client = CuratorFrameworkFactory.newClient(connectString, 1000 * 10, 1000 * 3, retryPolicy);
	client.start();
}
 
Example #2
Source File: ChannelService.java    From anima with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initialize(Application application) {
	super.initialize(application);
	this.localSessionMgr = application.getMoulde(LocalSessionMgr.class);
	this.backendSessionMgr = application.getMoulde(BackendSessionMgr.class);
	if (this.channels == null) {
		this.channels = new ConcurrentHashMap<Integer, Channel>();
	}
}
 
Example #3
Source File: AsyncClientMgr.java    From anima with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void initialize(Application application) {
	super.initialize(application);
	asyncClientConfigs = application.getServerConifg().getAsyncClientConfigs();
	if (asyncClientConfigs != null) {
		responseArgMapping = AsyncClientResponseArgMapping.getInstance();
		asyncMethodCalls = new ConcurrentHashMap<Integer, AsyncClientMgr.AsyncMethodCall<?>>();
		AsyncClientHelper.setAsyncCientMgr(this);
	}
}
 
Example #4
Source File: FullRestMethodTest.java    From yuzhouwan with Apache License 2.0 5 votes vote down vote up
@Test
public void concurrentHashMap() throws Exception {
    ConcurrentHashMap<String, String> chm = new ConcurrentHashMap<>();
    assertNull(chm.get(""));
    assertNull(chm.put("a", "a"));
    assertEquals("a", chm.put("a", "b"));
    assertEquals("b", chm.put("a", "c"));
    assertEquals("c", chm.remove("a"));
}
 
Example #5
Source File: ZookeeperRegistryFactory.java    From Distributed-KV with Apache License 2.0 4 votes vote down vote up
private ZookeeperRegistryFactory() {
	// 初始化缓存,缓存是线程安全的
	registries = new ConcurrentHashMap<>();
}
 
Example #6
Source File: BackendSessionMgr.java    From anima with GNU General Public License v3.0 4 votes vote down vote up
public BackendSessionMgr(String moduleName) {
	super(moduleName);
	bsessionTableBySid = HashBasedTable.create();
	sessionByUid = new ConcurrentHashMap<Integer, BackendSession>();
}