java.util.concurrent.ConcurrentHashMap.elements()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中java.util.concurrent.ConcurrentHashMap.elements()方法的一些代码示例,展示了ConcurrentHashMap.elements()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentHashMap.elements()方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentHashMap
类名称:ConcurrentHashMap
方法名:elements

ConcurrentHashMap.elements介绍

[英]Returns an enumeration of the values in this table.
[中]返回此表中值的枚举。

代码示例

代码示例来源:origin: wildfly/wildfly

public Enumeration<V> elements() {
  return backingMap.elements();
}

代码示例来源:origin: Atmosphere/atmosphere

@Override
public synchronized void destroy() {
  // Invalid state
  if (config == null) return;
  String s = config.getInitParameter(ApplicationConfig.SHARED);
  if (s != null && s.equalsIgnoreCase("true")) {
    logger.warn("Factory shared, will not be destroyed. This can possibly cause memory leaks if" +
        "Broadcasters were created. Make sure you destroy them manually.");
    return;
  }
  Enumeration<Broadcaster> e = store.elements();
  Broadcaster b;
  // We just need one when shared.
  BroadcasterConfig bc = null;
  while (e.hasMoreElements()) {
    try {
      b = e.nextElement();
      bc = b.getBroadcasterConfig();
      bc.forceDestroy();
      b.destroy();
    } catch (Throwable t) {
      // Shield us from any bad behaviour
      logger.debug("Destroy", t);
    }
  }
  broadcasterListeners.clear();
  store.clear();
}

代码示例来源:origin: didi/DDMQ

@Override
public String pickOneAtLeast() {
  final Enumeration<FaultItem> elements = this.faultItemTable.elements();
  List<FaultItem> tmpList = new LinkedList<FaultItem>();
  while (elements.hasMoreElements()) {
    final FaultItem faultItem = elements.nextElement();
    tmpList.add(faultItem);
  }
  if (!tmpList.isEmpty()) {
    Collections.shuffle(tmpList);
    Collections.sort(tmpList);
    final int half = tmpList.size() / 2;
    if (half <= 0) {
      return tmpList.get(0).getName();
    } else {
      final int i = this.whichItemWorst.getAndIncrement() % half;
      return tmpList.get(i).getName();
    }
  }
  return null;
}

代码示例来源:origin: com.sun.grizzly/grizzly-http

/**
 * Return an <code>Enumeration</code> of the active 
 * {@link SelectorThread}s
 */
public static Enumeration<SelectorThread> getSelectors(){
  return selectorThreads.elements();
}

代码示例来源:origin: org.glassfish.external/grizzly-module

/**
 * Return an <code>Enumeration</code> of the active 
 * {@link SelectorThread}s
 */
public final static Enumeration<SelectorThread> getSelectors(){
  return selectorThreads.elements();
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.saml

/**
 * Get all the SAMLSSOServiceProviderDO objects which are registered through the OSGi service.
 *
 * @return Enumeration of SAMLSSOServiceProviderDO objects
 */
public Enumeration<SAMLSSOServiceProviderDO> getAllServiceProviders() {
  return serviceProviderMap.elements();
}

代码示例来源:origin: com.ebay.jetstream/jetstreamcore

/**
 * @return
 */
public Enumeration<Channel> getAllProducers() {
  return m_epr.elements();
}

代码示例来源:origin: org.wso2.carbon.identity.inbound.auth.saml.cloud/org.wso2.carbon.identity.sso.saml.cloud

/**
 * Get all the SAMLSSOServiceProviderDO objects which are registered through the OSGi service.
 *
 * @return Enumeration of SAMLSSOServiceProviderDO objects
 */
public Enumeration<SAMLSSOServiceProviderDO> getAllServiceProviders() {
  return serviceProviderMap.elements();
}

代码示例来源:origin: com.cloudhopper/ch-mq

/**
 * Get all queues managed by this QueueManager.
 * @return All queues managed by this QueueManager.
 */
public Enumeration<Queue> getQueues() {
  return this.queueMap.elements();
}

代码示例来源:origin: xcy396/MediaCodecDemo

/**
 * Enumeration of all the participants with known ssrcs.
 * 
 * This is primarily used for sending packets in multicast sessions.
 * 
 * @return enumerator with all the participants with known SSRCs
 */
protected Enumeration<Participant> getParticipants() {
  return this.ssrcTable.elements();
}

代码示例来源:origin: org.glassfish.metro/webservices-extra

/**
 * Return an <code>Enumeration</code> of the active 
 * <code>SelectorThread</code>s
 */
public final static Enumeration<SelectorThread> getSelectors(){
  return selectorThreads.elements();
}

代码示例来源:origin: com.ebay.jetstream/jetstreamcore

/**
 * @return
 */
public Enumeration<EventConsumerInfo> getConsumers() {
  return m_eventConsumerRegistry.elements();
}

代码示例来源:origin: semanticvectors/semanticvectors

@Override
public Enumeration<ObjectVector> getAllVectors() {
 return this.objectVectors.elements();
}

代码示例来源:origin: apache/felix

/**
 * Returns a list of components.
 * 
 * @return a list of components
 */
public List<Component> getComponents() {
  return Collections.list(m_components.elements());
}

代码示例来源:origin: jpcsp/jpcsp

public void setFontSize(int size) {
  Enumeration<MutableAttributeSet> e = attributes.elements();
  while (e.hasMoreElements()) {
    StyleConstants.setFontSize(e.nextElement(), size);
  }
}

代码示例来源:origin: jpcsp/jpcsp

public void setFontName(String name) {
  Enumeration<MutableAttributeSet> e = attributes.elements();
  while (e.hasMoreElements()) {
    StyleConstants.setFontFamily(e.nextElement(), name);
  }
}

代码示例来源:origin: com.ebay.jetstream/jetstreamcore

public List<ITransportProvider> getTransportProviders() {
  Enumeration<DispatcherInfo> dispatcherlist = m_dispatcherlist
      .elements();
  List<ITransportProvider> transports = new CopyOnWriteArrayList<ITransportProvider>();
  while (dispatcherlist.hasMoreElements()) {
    DispatcherInfo dispinfo = dispatcherlist.nextElement();
    transports.add(dispinfo.getTransport());
  }
  return transports;
}

代码示例来源:origin: ibinti/bugvm

public void NotifiyListeners(LineEvent.Type type, long position) {
    if(!linelisteners.isEmpty()) {
      for (Enumeration e = linelisteners.elements() ; e.hasMoreElements() ;) {
        LineListener listener = (LineListener)e.nextElement();
        LineEvent event = new LineEvent(this, type, position);
        listener.update(event);
      }            
    }
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

public void NotifiyListeners(LineEvent.Type type, long position) {
    if(!linelisteners.isEmpty()) {
      for (Enumeration e = linelisteners.elements() ; e.hasMoreElements() ;) {
        LineListener listener = (LineListener)e.nextElement();
        LineEvent event = new LineEvent(this, type, position);
        listener.update(event);
      }            
    }
  }
}

代码示例来源:origin: KDE/kdeconnect-android

private void updateWidget(final Context context) {
  if (getCurrentDevice() == null || !getCurrentDevice().isReachable()) {
    BackgroundService.RunCommand(context, service -> {
      if (service.getDevices().size() > 0)
        currentDeviceId = service.getDevices().elements().nextElement().getDeviceId();
      updateWidgetImpl(context);
    });
  }
  updateWidgetImpl(context);
}

相关文章