Example usage for java.util.concurrent ConcurrentMap values

List of usage examples for java.util.concurrent ConcurrentMap values

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentMap values.

Prototype

Collection<V> values();

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:com.bt.aloha.util.CollectionHelper.java

public static void destroy(ConcurrentMap<String, Map<String, Object>> transients, String classname) {
    log.debug(String.format("Destroy method called on collection: %s", classname));
    for (Map<String, Object> element : transients.values()) {
        ScheduledFuture<?> future = (ScheduledFuture<?>) element.get("future");
        if (future == null || future.isCancelled() || future.isDone())
            continue;
        if (future.getDelay(TimeUnit.MILLISECONDS) > ONE_HUNDRED) {
            future.cancel(true);/*  ww w .  java 2 s .c o m*/
            continue;
        }
        int counter = 0;
        while (!future.isDone() && counter++ < THREE) {
            try {
                log.debug("Waiting for future to get done for some call...");
                Thread.sleep(ONE_THOUSAND);
            } catch (InterruptedException e) {
                log.warn(e.getMessage());
                continue;
            }
        }
    }
}

From source file:com.bt.aloha.media.conference.collections.PersistedConferenceCollectionImpl.java

public ConcurrentMap<String, ConferenceInfo> getAll() {
    ConcurrentMap<String, ConferenceInfo> results = conferenceInfoDao.getAll();
    for (ConferenceInfo value : results.values()) {
        readTransients(value);//from   ww  w  .  j  av a 2s .  c  o  m
    }
    return results;
}

From source file:org.opendaylight.vpnservice.elan.l2gw.utils.ElanL2GatewayUtils.java

public static void scheduleAddDpnMacInExtDevices(String elanName, BigInteger dpId,
        List<PhysAddress> staticMacAddresses) {
    ConcurrentMap<String, L2GatewayDevice> elanDevices = ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanName);
    for (final L2GatewayDevice externalDevice : elanDevices.values()) {
        scheduleAddDpnMacsInExtDevice(elanName, dpId, staticMacAddresses, externalDevice);
    }//from   w  w w .j  a  va 2 s.c om
}

From source file:com.bt.aloha.fitnesse.FixtureApplicationContexts.java

private void cancelTerminationTimers(ClassPathXmlApplicationContext applicationContext) {
    CallCollection callCollection = (CallCollection) applicationContext.getBean("callCollection");
    ConferenceCollection conferenceCollection = (ConferenceCollection) applicationContext
            .getBean("conferenceCollection");
    ScheduledExecutorServiceMaxCallDurationScheduler callTerminator = (ScheduledExecutorServiceMaxCallDurationScheduler) applicationContext
            .getBean("maxCallDurationScheduler");
    ScheduledExecutorServiceMaxConferenceDurationScheduler conferenceTerminator = (ScheduledExecutorServiceMaxConferenceDurationScheduler) applicationContext
            .getBean("maxConferenceDurationScheduler");

    ConcurrentMap<String, CallInfo> calls = callCollection.getAll();
    for (CallInfo callInfo : calls.values())
        callTerminator.cancelTerminateCall(callInfo);
    ConcurrentMap<String, ConferenceInfo> conferences = conferenceCollection.getAll();
    for (ConferenceInfo conferenceInfo : conferences.values())
        conferenceTerminator.cancelTerminateConference(conferenceInfo);
}

From source file:com.bt.aloha.media.conference.collections.PersistedConferenceCollectionImpl.java

public ConcurrentMap<String, ConferenceInfo> getAllActiveConferencesWithMaxDuration() {
    ConcurrentMap<String, ConferenceInfo> results = conferenceInfoDao.findConnectedMaxDurationConferences();
    for (ConferenceInfo value : results.values()) {
        readTransients(value);/* www . j  a  va 2  s  .  co  m*/
    }
    return results;
}

From source file:org.opendaylight.vpnservice.elan.l2gw.utils.ElanL2GatewayUtils.java

/**
 * Removes the given MAC Addresses from all the External Devices belonging
 * to the specified ELAN./* ww w  . j  a va 2s . com*/
 *
 * @param elanInstance
 *            the elan instance
 * @param macAddresses
 *            the mac addresses
 */
public static void removeMacsFromElanExternalDevices(ElanInstance elanInstance,
        List<PhysAddress> macAddresses) {
    ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils
            .getInvolvedL2GwDevices(elanInstance.getElanInstanceName());
    for (L2GatewayDevice l2GatewayDevice : elanL2GwDevices.values()) {
        removeRemoteUcastMacsFromExternalDevice(l2GatewayDevice.getHwvtepNodeId(),
                elanInstance.getElanInstanceName(), macAddresses);
    }
}

From source file:com.bt.aloha.dialog.StaleDialogChecker.java

protected void initialize() {
    log.debug("initialize()");
    ConcurrentMap<String, DialogInfo> allDialogs = dialogCollection.getAll();
    log.debug(String.format("Initialising StaleDialogChecker with %s dialogs", allDialogs.size()));
    for (ReadOnlyDialogInfo dialogInfo : allDialogs.values())
        if (dialogInfo.getDialogState().equals(DialogState.Confirmed))
            pingCallLeg(dialogInfo);/*from   w ww.jav a2 s .  c o m*/
}

From source file:com.bt.aloha.media.convedia.conference.MaxConferenceDurationTermination.java

public void initialize() {
    log.debug("initialize()");
    //TODO: replace getAll()
    ConcurrentMap<String, ConferenceInfo> allConferenceCalls = conferenceCollection.getAll();
    log.debug(String.format("Initialising with %s conference calls", allConferenceCalls.size()));
    for (ConferenceInfo conferenceInfo : allConferenceCalls.values())
        if (conferenceInfo.getConferenceState().equals(ConferenceState.Active)
                && conferenceInfo.getMaxDurationInMinutes() > 0)
            setTerminationTime(conferenceInfo);
}

From source file:org.opendaylight.vpnservice.elan.l2gw.utils.ElanL2GatewayUtils.java

/**
 * Gets the elan l2 gateway devices local macs.
 *
 * @param l2GwDeviceToBeExcluded//from w ww  . j  av  a2s  .c o m
 *            the l2 gw device to be excluded
 * @param elanName
 *            the elan name
 * @return the elan l2 gateway devices local macs
 */
public static List<MacAddress> getElanL2GatewayDevicesLocalMacs(L2GatewayDevice l2GwDeviceToBeExcluded,
        String elanName) {
    List<MacAddress> lstL2GatewayDeviceMacs = new ArrayList<>();

    ConcurrentMap<String, L2GatewayDevice> elanL2GwDevicesFromCache = ElanL2GwCacheUtils
            .getInvolvedL2GwDevices(elanName);
    if (elanL2GwDevicesFromCache != null) {
        for (L2GatewayDevice otherDevice : elanL2GwDevicesFromCache.values()) {
            if (!otherDevice.getHwvtepNodeId().equals(l2GwDeviceToBeExcluded.getHwvtepNodeId())) {
                List<LocalUcastMacs> lstUcastLocalMacs = otherDevice.getUcastLocalMacs();
                if (lstUcastLocalMacs != null) {
                    List<MacAddress> l2GwDeviceMacs = Lists.transform(lstUcastLocalMacs,
                            new Function<LocalUcastMacs, MacAddress>() {
                                @Override
                                public MacAddress apply(LocalUcastMacs localUcastMac) {
                                    return (localUcastMac != null) ? localUcastMac.getMacEntryKey() : null;
                                }
                            });
                    lstL2GatewayDeviceMacs.addAll(l2GwDeviceMacs);
                }
            }
        }
    }
    return lstL2GatewayDeviceMacs;
}

From source file:org.opendaylight.vpnservice.elan.l2gw.utils.ElanL2GatewayUtils.java

/**
 * Install elan l2gw devices local macs in dpn.
 *
 * @param dpnId/*ww w. j a va2 s.  c  om*/
 *            the dpn id
 * @param elan
 *            the elan
 */
public static void installElanL2gwDevicesLocalMacsInDpn(BigInteger dpnId, ElanInstance elan) {
    ConcurrentMap<String, L2GatewayDevice> elanL2GwDevicesFromCache = ElanL2GwCacheUtils
            .getInvolvedL2GwDevices(elan.getElanInstanceName());
    if (elanL2GwDevicesFromCache != null) {
        for (L2GatewayDevice l2gwDevice : elanL2GwDevicesFromCache.values()) {
            installDmacFlowsOnDpn(dpnId, l2gwDevice, elan);
        }
    } else {
        LOG.debug("No Elan l2 gateway devices in cache for [{}] ", elan.getElanInstanceName());
    }
}