本文整理了Java中java.util.concurrent.ConcurrentHashMap.keys()
方法的一些代码示例,展示了ConcurrentHashMap.keys()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentHashMap.keys()
方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentHashMap
类名称:ConcurrentHashMap
方法名:keys
[英]Returns an enumeration of the keys in this table.
[中]返回此表中键的枚举。
代码示例来源:origin: wildfly/wildfly
public Enumeration<K> keys() {
return backingMap.keys();
}
代码示例来源:origin: spring-projects/spring-framework
public Enumeration<?> getPropertyNames() throws JMSException {
return this.properties.keys();
}
代码示例来源:origin: Atmosphere/atmosphere
@Override
public Enumeration<String> getAttributeNames() {
if (!valid.get()) throw new IllegalStateException();
return attributes.keys();
}
代码示例来源:origin: Atmosphere/atmosphere
@Override
public String[] getValueNames() {
if (!valid.get()) throw new IllegalStateException();
return (String[]) Collections.list(attributes.keys()).toArray();
}
代码示例来源:origin: apache/zookeeper
/**
* Try to establish a connection with each server if one
* doesn't exist.
*/
public void connectAll(){
long sid;
for(Enumeration<Long> en = queueSendMap.keys();
en.hasMoreElements();){
sid = en.nextElement();
connectOne(sid);
}
}
代码示例来源:origin: org.apache.zookeeper/zookeeper
/**
* Try to establish a connection with each server if one
* doesn't exist.
*/
public void connectAll(){
long sid;
for(Enumeration<Long> en = queueSendMap.keys();
en.hasMoreElements();){
sid = en.nextElement();
connectOne(sid);
}
}
代码示例来源:origin: apache/storm
@Override
public Iterable<String> getAllKeys() {
if (backingStore != null) {
return backingStore.getAllKeys();
}
final Enumeration<String> storeEnumeration = store.keys();
final Iterator<String> resultIterator = new Iterator<String>() {
@Override
public boolean hasNext() {
return storeEnumeration.hasMoreElements();
}
@Override
public String next() {
return storeEnumeration.nextElement();
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove operation is not supported as it is immutable.");
}
};
return new Iterable<String>() {
@Override
public Iterator<String> iterator() {
return resultIterator;
}
};
}
代码示例来源:origin: alibaba/jstorm
@Override
public Iterable<String> getAllKeys() {
if (backingStore != null) {
return backingStore.getAllKeys();
}
final Enumeration<String> storeEnumeration = store.keys();
final Iterator<String> resultIterator = new Iterator<String>() {
@Override
public boolean hasNext() {
return storeEnumeration.hasMoreElements();
}
@Override
public String next() {
return storeEnumeration.nextElement();
}
@Override
public void remove() {
throw new UnsupportedOperationException("remove operation is not supported as it is immutable.");
}
};
return new Iterable<String>() {
@Override
public Iterator<String> iterator() {
return resultIterator;
}
};
}
代码示例来源:origin: apache/geode
private void sendSuspectRequest(final List<SuspectRequest> requests) {
logger.debug("Sending suspect request for members {}", requests);
List<InternalDistributedMember> recipients;
if (currentView.size() > ServiceConfig.SMALL_CLUSTER_SIZE) {
HashSet<InternalDistributedMember> filter = new HashSet<>();
for (Enumeration<InternalDistributedMember> e = suspectedMemberIds.keys(); e
.hasMoreElements();) {
filter.add(e.nextElement());
}
filter.addAll(
requests.stream().map(SuspectRequest::getSuspectMember).collect(Collectors.toList()));
recipients =
currentView.getPreferredCoordinators(filter, services.getJoinLeave().getMemberID(),
ServiceConfig.SMALL_CLUSTER_SIZE + 1);
} else {
recipients = currentView.getMembers();
}
logger.info("Sending suspect messages to {}", recipients);
SuspectMembersMessage smm = new SuspectMembersMessage(recipients, requests);
Set<InternalDistributedMember> failedRecipients;
try {
failedRecipients = services.getMessenger().send(smm);
this.stats.incSuspectsSent();
} catch (CancelException e) {
return;
}
if (failedRecipients != null && failedRecipients.size() > 0) {
logger.info("Unable to send suspect message to {}", failedRecipients);
}
}
代码示例来源:origin: wildfly/wildfly
return new DomainEnumeration(securityManagerMap.keys(), securityManagerMap);
代码示例来源:origin: paoding-code/paoding-rose
@Override
public boolean set(String key, Object value, int expiry) {
if (logger.isDebugEnabled()) {
logger.debug("Set cache \'" + key + "\' to pool \'" + poolName + "\': " + value);
}
if (map.size() >= maxSize) {
map.remove(map.keys().nextElement());
}
map.put(key, value);
return true;
}
代码示例来源:origin: spring-projects/spring-integration
@Override
public Enumeration<?> getPropertyNames() throws JMSException {
return this.properties.keys();
}
代码示例来源:origin: stephanenicolas/toothpick
/**
* Clears all scopes. Useful for testing and not getting any leak...
*/
public static void reset() {
for (Object name : Collections.list(MAP_KEY_TO_SCOPE.keys())) {
closeScope(name);
}
ConfigurationHolder.configuration.onScopeForestReset();
ScopeImpl.resetUnBoundProviders();
}
代码示例来源:origin: org.apache.wicket/wicket-native-websocket-core
@Override
public Enumeration<String> getAttributeNames()
{
return attributes.keys();
}
代码示例来源:origin: apache/wicket
@Override
public Enumeration<String> getAttributeNames()
{
return attributes.keys();
}
代码示例来源:origin: ucarGroup/DataLink
@Override
public Enumeration<String> getAttributeNames() {
return attributes.keys();
}
}
代码示例来源:origin: apache/wicket
@Override
public String[] getValueNames()
{
return Collections.list(attributes.keys()).toArray(new String[0]);
}
代码示例来源:origin: org.apache.hadoop/zookeeper
/**
* Try to establish a connection with each server if one
* doesn't exist.
*/
public void connectAll(){
long sid;
for(Enumeration<Long> en = queueSendMap.keys();
en.hasMoreElements();){
sid = en.nextElement();
connectOne(sid);
}
}
代码示例来源:origin: qaprosoft/carina
/**
* Stop all proxies if possible
*/
public static void stopAllProxies() {
for (Long threadId : Collections.list(proxies.keys())) {
stopProxyByThread(threadId);
}
}
代码示例来源:origin: com.vmware.dcp/dcp-common
public void fail(Throwable t) {
this.failures = new ConcurrentHashMap<>();
this.failures.put(this.operations.keys().nextElement(), t);
OperationContext origContext = OperationContext.getOperationContext();
OperationContext.restoreOperationContext(this.opContext);
for (Operation op : this.operations.values()) {
op.fail(t);
}
OperationContext.restoreOperationContext(origContext);
}
}
内容来源于网络,如有侵权,请联系作者删除!