List of usage examples for java.util.concurrent ConcurrentMap values
Collection<V> values();
From source file:com.murati.oszk.audiobook.model.MusicProvider.java
private synchronized void buildAlbumList() { //TODO: rename album to ebook ConcurrentMap<String, List<MediaMetadataCompat>> newAlbumList = new ConcurrentHashMap<>(); // Add tracks to ebook for (MutableMediaMetadata m : mTrackListById.values()) { String album = m.metadata.getString(MediaMetadataCompat.METADATA_KEY_ALBUM); List<MediaMetadataCompat> list = newAlbumList.get(album); if (list == null) { list = new ArrayList<>(); newAlbumList.put(album, list); }//from ww w . j a va 2s . c om list.add(m.metadata); } //Sort Individual ebooks by track numbers for (List<MediaMetadataCompat> album : newAlbumList.values()) { //MediaMetadataCompat[] sortedOrder = album.toArray(new MediaMetadataCompat[album.size()]); java.util.Collections.sort(album, new Comparator<MediaMetadataCompat>() { @Override public int compare(final MediaMetadataCompat lhs, MediaMetadataCompat rhs) { if (lhs.getLong(METADATA_KEY_TRACK_NUMBER) < rhs.getLong(METADATA_KEY_TRACK_NUMBER)) return -1; return 1; } }); } mEbookList = newAlbumList; }
From source file:org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils.java
public 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); }//www. j a va 2 s. c om }
From source file:org.opendaylight.controller.usermanager.internal.UserManagerImpl.java
@SuppressWarnings("unchecked") private void loadUserConfig() { ObjectReader objReader = new ObjectReader(); ConcurrentMap<String, UserConfig> confList = (ConcurrentMap<String, UserConfig>) objReader.read(this, usersFileName);//from ww w .j a v a 2 s.c o m if (confList == null) { return; } for (UserConfig conf : confList.values()) { addLocalUser(conf); } }
From source file:org.opendaylight.controller.usermanager.internal.UserManagerImpl.java
@SuppressWarnings("unchecked") private void loadServerConfig() { ObjectReader objReader = new ObjectReader(); ConcurrentMap<String, ServerConfig> confList = (ConcurrentMap<String, ServerConfig>) objReader.read(this, serversFileName);//from w w w . ja v a 2 s .co m if (confList == null) { return; } for (ServerConfig conf : confList.values()) { addAAAServer(conf); } }
From source file:org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils.java
/** * Removes the given MAC Addresses from all the External Devices belonging * to the specified ELAN./*from w w w . j a v a 2 s .c om*/ * * @param elanInstance * the elan instance * @param macAddresses * the mac addresses */ public 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:org.opendaylight.controller.usermanager.internal.UserManagerImpl.java
@SuppressWarnings("unchecked") private void loadAuthConfig() { ObjectReader objReader = new ObjectReader(); ConcurrentMap<String, AuthorizationConfig> confList = (ConcurrentMap<String, AuthorizationConfig>) objReader .read(this, authFileName); if (confList == null) { return;/*from w w w. j a v a2s. c o m*/ } for (AuthorizationConfig conf : confList.values()) { addAuthInfo(conf); } }
From source file:org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils.java
/** * Install elan l2gw devices local macs in dpn. * * @param dpnId/* w ww .j a va 2s . c o m*/ * the dpn id * @param elan * the elan * @param interfaceName * the interface name * @throws ElanException in case of issues creating the flow objects */ public void installElanL2gwDevicesLocalMacsInDpn(BigInteger dpnId, ElanInstance elan, String interfaceName) throws ElanException { ConcurrentMap<String, L2GatewayDevice> elanL2GwDevicesFromCache = ElanL2GwCacheUtils .getInvolvedL2GwDevices(elan.getElanInstanceName()); if (elanL2GwDevicesFromCache != null) { for (L2GatewayDevice l2gwDevice : elanL2GwDevicesFromCache.values()) { installDmacFlowsOnDpn(dpnId, l2gwDevice, elan, interfaceName); } } else { LOG.debug("No Elan l2 gateway devices in cache for [{}] ", elan.getElanInstanceName()); } }
From source file:org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils.java
public void installL2GwUcastMacInElan(final ElanInstance elan, final L2GatewayDevice extL2GwDevice, final String macToBeAdded, final LocalUcastMacs localUcastMacs, String interfaceName) { final String extDeviceNodeId = extL2GwDevice.getHwvtepNodeId(); final String elanInstanceName = elan.getElanInstanceName(); final List<DpnInterfaces> elanDpns = getElanDpns(elanInstanceName); // Retrieve all participating DPNs in this Elan. Populate this MAC in // DMAC table. // Looping through all DPNs in order to add/remove mac flows in their // DMAC table if (elanDpns != null && elanDpns.size() > 0) { String jobKey = elan.getElanInstanceName() + ":" + macToBeAdded; ElanClusterUtils.runOnlyInLeaderNode(entityOwnershipService, jobKey, "install l2gw macs in dmac table", () -> {/* w w w. j av a 2 s . com*/ List<ListenableFuture<Void>> fts = new ArrayList<>(); if (doesLocalUcastMacExistsInCache(extL2GwDevice, localUcastMacs)) { for (DpnInterfaces elanDpn : elanDpns) { // TODO batch the below call fts.addAll(elanUtils.installDmacFlowsToExternalRemoteMac(elanDpn.getDpId(), extDeviceNodeId, elan.getElanTag(), ElanUtils.getVxlanSegmentationId(elan), macToBeAdded, elanInstanceName, interfaceName)); } } else { LOG.trace("Skipping install of dmac flows for mac {} as it is not found in cache", macToBeAdded); } return fts; }); } final IpAddress extL2GwDeviceTepIp = extL2GwDevice.getTunnelIp(); final List<PhysAddress> macList = new ArrayList<>(); macList.add(new PhysAddress(macToBeAdded)); String jobKey = "hwvtep:" + elan.getElanInstanceName() + ":" + macToBeAdded; ElanClusterUtils.runOnlyInLeaderNode(entityOwnershipService, jobKey, "install remote ucast macs in l2gw device", () -> { List<ListenableFuture<Void>> fts = new ArrayList<>(); if (!doesLocalUcastMacExistsInCache(extL2GwDevice, localUcastMacs)) { LOG.trace( "Skipping install of remote ucast macs {} in l2gw device as it is not found in cache", macToBeAdded); return fts; } ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils .getInvolvedL2GwDevices(elanInstanceName); for (L2GatewayDevice otherDevice : elanL2GwDevices.values()) { if (!otherDevice.getHwvtepNodeId().equals(extDeviceNodeId) && !areMLAGDevices(extL2GwDevice, otherDevice)) { final String hwvtepId = otherDevice.getHwvtepNodeId(); InstanceIdentifier<Node> iid = HwvtepSouthboundUtils .createInstanceIdentifier(new NodeId(hwvtepId)); final String logicalSwitchName = elanInstanceName; ListenableFuture<Void> ft = HwvtepUtils.installUcastMacs(broker, hwvtepId, macList, logicalSwitchName, extL2GwDeviceTepIp); // TODO batch the above call Futures.addCallback(ft, new FutureCallback<Void>() { @Override public void onSuccess(Void noarg) { LOG.trace("Successful in initiating ucast_remote_macs addition" + "related to {} in {}", logicalSwitchName, hwvtepId); } @Override public void onFailure(Throwable error) { LOG.error(String.format( "Failed adding ucast_remote_macs related to " + "%s in %s", logicalSwitchName, hwvtepId), error); } }); fts.add(ft); } } return fts; }); }
From source file:org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils.java
/** * Delete elan l2 gateway devices ucast local macs from dpn. * * @param elanName/* ww w. ja v a 2 s.c o m*/ * the elan name * @param dpnId * the dpn id */ public void deleteElanL2GwDevicesUcastLocalMacsFromDpn(final String elanName, final BigInteger dpnId) { ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils .getInvolvedL2GwDevices(elanName); if (elanL2GwDevices == null || elanL2GwDevices.isEmpty()) { LOG.trace("No L2 gateway devices in Elan [{}] cache.", elanName); return; } final ElanInstance elan = ElanUtils.getElanInstanceByName(broker, elanName); if (elan == null) { LOG.error("Could not find Elan by name: {}", elanName); return; } LOG.info("Deleting Elan [{}] L2GatewayDevices UcastLocalMacs from Dpn [{}]", elanName, dpnId); final Long elanTag = elan.getElanTag(); for (final L2GatewayDevice l2GwDevice : elanL2GwDevices.values()) { List<MacAddress> localMacs = getL2GwDeviceLocalMacs(l2GwDevice); if (localMacs != null && !localMacs.isEmpty()) { for (final MacAddress mac : localMacs) { String jobKey = elanName + ":" + mac.getValue(); ElanClusterUtils.runOnlyInLeaderNode(entityOwnershipService, jobKey, "delete l2gw macs from dmac table", () -> { List<ListenableFuture<Void>> futures = new ArrayList<>(); futures.addAll(elanUtils.deleteDmacFlowsToExternalMac(elanTag, dpnId, l2GwDevice.getHwvtepNodeId(), mac.getValue())); return futures; }); } } } }
From source file:org.opendaylight.netvirt.elan.internal.ElanInterfaceManager.java
public List<Bucket> getRemoteBCGroupBucketsOfElanL2GwDevices(ElanInstance elanInfo, BigInteger dpnId, int bucketId) { List<Bucket> listBucketInfo = new ArrayList<>(); ConcurrentMap<String, L2GatewayDevice> map = ElanL2GwCacheUtils .getInvolvedL2GwDevices(elanInfo.getElanInstanceName()); for (L2GatewayDevice device : map.values()) { String interfaceName = elanL2GatewayUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId), device.getHwvtepNodeId()); if (interfaceName == null) { continue; }/*www.j a va 2s . c o m*/ List<Action> listActionInfo = elanUtils.buildTunnelItmEgressActions(interfaceName, ElanUtils.getVxlanSegmentationId(elanInfo)); listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP)); bucketId++; } return listBucketInfo; }