List of usage examples for java.util.concurrent ConcurrentMap values
Collection<V> values();
From source file:org.opendaylight.vpnservice.elan.l2gw.utils.ElanL2GatewayUtils.java
/** * Gets the l2 gateway devices ucast local macs as remote ucast macs. * * @param elanName/*from w w w . j a v a2s . c om*/ * the elan name * @param l2GatewayDeviceToBeConfigured * the l2 gateway device to be configured * @param hwVtepNodeId * the hw vtep node Id to be configured * @param logicalSwitchName * the logical switch name * @return the l2 gateway devices macs as remote ucast macs */ public static List<RemoteUcastMacs> getOtherDevicesMacs(String elanName, L2GatewayDevice l2GatewayDeviceToBeConfigured, NodeId hwVtepNodeId, String logicalSwitchName) { List<RemoteUcastMacs> lstRemoteUcastMacs = new ArrayList<RemoteUcastMacs>(); ConcurrentMap<String, L2GatewayDevice> elanL2GwDevicesFromCache = ElanL2GwCacheUtils .getInvolvedL2GwDevices(elanName); if (elanL2GwDevicesFromCache != null) { for (L2GatewayDevice otherDevice : elanL2GwDevicesFromCache.values()) { if (l2GatewayDeviceToBeConfigured.getHwvtepNodeId().equals(otherDevice.getHwvtepNodeId())) { continue; } if (!areMLAGDevices(l2GatewayDeviceToBeConfigured, otherDevice)) { List<LocalUcastMacs> lstUcastLocalMacs = otherDevice.getUcastLocalMacs(); if (lstUcastLocalMacs != null) { for (LocalUcastMacs localUcastMac : lstUcastLocalMacs) { HwvtepPhysicalLocatorAugmentation physLocatorAug = HwvtepSouthboundUtils .createHwvtepPhysicalLocatorAugmentation( String.valueOf(otherDevice.getTunnelIp().getValue())); RemoteUcastMacs remoteUcastMac = HwvtepSouthboundUtils.createRemoteUcastMac( hwVtepNodeId, localUcastMac.getMacEntryKey().getValue(), localUcastMac.getIpaddr(), logicalSwitchName, physLocatorAug); lstRemoteUcastMacs.add(remoteUcastMac); } } } } } return lstRemoteUcastMacs; }
From source file:org.wso2.carbon.stream.processor.core.persistence.PersistenceManager.java
private void persist() { ConcurrentMap<String, SiddhiAppRuntime> siddhiAppRuntimeMap = StreamProcessorDataHolder.getSiddhiManager() .getSiddhiAppRuntimeMap();/*from w w w. ja v a 2 s. c om*/ for (SiddhiAppRuntime siddhiAppRuntime : siddhiAppRuntimeMap.values()) { PersistenceReference persistenceReference = siddhiAppRuntime.persist(); if (log.isDebugEnabled()) { log.debug("Revision " + persistenceReference.getRevision() + " of siddhi App " + siddhiAppRuntime.getName() + " persisted successfully"); } } if (StreamProcessorDataHolder.getNodeInfo() != null) { StreamProcessorDataHolder.getNodeInfo().setLastPersistedTimestamp(System.currentTimeMillis()); } }
From source file:com.bt.aloha.call.MaxCallDurationTermination.java
protected void initialize() { log.debug("initialize() runOnStartup = " + runOnStartup); if (runOnStartup) { ConcurrentMap<String, CallInfo> calls = callCollection.getAllConnectedCallsWithMaxDuration(); log.debug(/*from w w w . ja v a 2 s . c om*/ String.format("Initialising MaxCallDurationTermination object with %s call(s)", calls.size())); for (ReadOnlyCallInfo callInfo : calls.values()) setTerminationTime(callInfo); } }
From source file:org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils.java
/** * Gets the l2 gateway devices ucast local macs as remote ucast macs. * * @param elanName/*from w w w . ja va 2s .c o m*/ * the elan name * @param l2GatewayDeviceToBeConfigured * the l2 gateway device to be configured * @param hwVtepNodeId * the hw vtep node Id to be configured * @param logicalSwitchName * the logical switch name * @return the l2 gateway devices macs as remote ucast macs */ public static List<RemoteUcastMacs> getOtherDevicesMacs(String elanName, L2GatewayDevice l2GatewayDeviceToBeConfigured, NodeId hwVtepNodeId, String logicalSwitchName) { List<RemoteUcastMacs> lstRemoteUcastMacs = new ArrayList<>(); ConcurrentMap<String, L2GatewayDevice> elanL2GwDevicesFromCache = ElanL2GwCacheUtils .getInvolvedL2GwDevices(elanName); if (elanL2GwDevicesFromCache != null) { for (L2GatewayDevice otherDevice : elanL2GwDevicesFromCache.values()) { if (l2GatewayDeviceToBeConfigured.getHwvtepNodeId().equals(otherDevice.getHwvtepNodeId())) { continue; } if (!areMLAGDevices(l2GatewayDeviceToBeConfigured, otherDevice)) { List<LocalUcastMacs> lstUcastLocalMacs = otherDevice.getUcastLocalMacs(); if (lstUcastLocalMacs != null) { for (LocalUcastMacs localUcastMac : lstUcastLocalMacs) { HwvtepPhysicalLocatorAugmentation physLocatorAug = HwvtepSouthboundUtils .createHwvtepPhysicalLocatorAugmentation( String.valueOf(otherDevice.getTunnelIp().getValue())); RemoteUcastMacs remoteUcastMac = HwvtepSouthboundUtils.createRemoteUcastMac( hwVtepNodeId, localUcastMac.getMacEntryKey().getValue().toLowerCase(), localUcastMac.getIpaddr(), logicalSwitchName, physLocatorAug); lstRemoteUcastMacs.add(remoteUcastMac); } } } } } return lstRemoteUcastMacs; }
From source file:org.onosproject.store.trivial.impl.SimpleFlowRuleStore.java
@Override public int getFlowRuleCount() { int sum = 0;/* w w w .j ava 2 s .c o m*/ for (ConcurrentMap<FlowId, List<StoredFlowEntry>> ft : flowEntries.values()) { for (List<StoredFlowEntry> fes : ft.values()) { sum += fes.size(); } } return sum; }
From source file:org.opendaylight.vpnservice.elan.l2gw.utils.ElanL2GatewayUtils.java
public static void installL2GwUcastMacInElan(final ElanInstance elan, final L2GatewayDevice extL2GwDevice, final String macToBeAdded) { final String extDeviceNodeId = extL2GwDevice.getHwvtepNodeId(); final String elanInstanceName = elan.getElanInstanceName(); // 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 final List<DpnInterfaces> elanDpns = ElanUtils.getInvolvedDpnsInElan(elanInstanceName); if (elanDpns != null && elanDpns.size() > 0) { String jobKey = elan.getElanInstanceName() + ":" + macToBeAdded; ElanClusterUtils.runOnlyInLeaderNode(jobKey, "install l2gw mcas in dmac table", new Callable<List<ListenableFuture<Void>>>() { @Override/*from ww w.j ava 2 s . c o m*/ public List<ListenableFuture<Void>> call() throws Exception { List<ListenableFuture<Void>> fts = Lists.newArrayList(); for (DpnInterfaces elanDpn : elanDpns) { //TODO batch the below call fts.addAll(ElanUtils.installDmacFlowsToExternalRemoteMac(elanDpn.getDpId(), extDeviceNodeId, elan.getElanTag(), elan.getVni(), macToBeAdded, elanInstanceName)); } return fts; } }); } final IpAddress extL2GwDeviceTepIp = extL2GwDevice.getTunnelIp(); final List<PhysAddress> macList = new ArrayList<PhysAddress>(); macList.add(new PhysAddress(macToBeAdded)); String jobKey = "hwvtep:" + elan.getElanInstanceName() + ":" + macToBeAdded; ElanClusterUtils.runOnlyInLeaderNode(jobKey, "install remote ucast macs in l2gw device", new Callable<List<ListenableFuture<Void>>>() { @Override public List<ListenableFuture<Void>> call() throws Exception { ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils .getInvolvedL2GwDevices(elanInstanceName); List<ListenableFuture<Void>> fts = Lists.newArrayList(); 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:com.bt.aloha.batchtest.MultistackApplicationContextManager.java
public void stopApplicationContext2() { long nocc = getConnectingCalls(); int counter = 5; while (counter > 0 && nocc > 0) { sleep(2000);/*ww w. j a va 2 s . c o m*/ nocc = getConnectingCalls(); counter--; } log.debug("----------Printing out the call states of all calls in the collection----------"); ConcurrentMap<String, CallInfo> allCalls = callCollection2.getAll(); for (CallInfo callInfo : allCalls.values()) log.debug(String.format("CallId %s: %s", callInfo.getId(), callInfo.getCallState().toString())); log.debug("--------------------------------------------------------------------------------"); log.warn("Forcibly distroying app context 2"); callCollection2 = null; removeAddressFromLoadBalancer(getApplicationContext2()); holder2.destroy(); ((MaxCallDurationTermination) getApplicationContext1().getBean("maxCallDurationTermination")).runTask(); }
From source file:org.wso2.carbon.stream.processor.core.persistence.PersistenceManager.java
private void persistAndSendControlMessage() { ConcurrentMap<String, SiddhiAppRuntime> siddhiAppRuntimeMap = StreamProcessorDataHolder.getSiddhiManager() .getSiddhiAppRuntimeMap();//from w w w. j a va 2 s . c o m String[] siddhiRevisionArray = new String[siddhiAppRuntimeMap.size()]; int siddhiAppCount = 0; for (SiddhiAppRuntime siddhiAppRuntime : siddhiAppRuntimeMap.values()) { PersistenceReference persistenceReference = siddhiAppRuntime.persist(); Future fullStateFuture = persistenceReference.getFullStateFuture(); try { if (fullStateFuture != null) { fullStateFuture.get(60000, TimeUnit.MILLISECONDS); } else { for (Future future : persistenceReference.getIncrementalStateFuture()) { future.get(60000, TimeUnit.MILLISECONDS); } } } catch (Throwable e) { log.error( "Active Node: Persisting of Siddhi app is not successful. Check if app deployed properly"); } siddhiRevisionArray[siddhiAppCount] = sequenceIDGenerator.incrementAndGet() + HAConstants.PERSISTED_APP_SPLIT_DELIMITER + persistenceReference.getRevision(); siddhiAppCount++; if (log.isDebugEnabled()) { log.debug("Revision " + persistenceReference.getRevision() + " of siddhi App " + siddhiAppRuntime.getName() + " persisted successfully"); } } if (haManager != null && haManager.isActiveNode() && haManager.isPassiveNodeAdded()) { if (log.isDebugEnabled()) { log.debug("Control Message is sent to the passive node - " + Arrays.toString(siddhiRevisionArray)); } sendControlMessageToPassiveNode(siddhiRevisionArray); } if (StreamProcessorDataHolder.getNodeInfo() != null) { StreamProcessorDataHolder.getNodeInfo().setLastPersistedTimestamp(System.currentTimeMillis()); } log.info("siddhi Apps are persisted successfully"); }
From source file:org.apache.hcatalog.common.HiveClientCache.java
/** * Note: This doesn't check if they are being used or not, meant only to be called during shutdown etc. *///from ww w .j a va 2 s.c o m void closeAllClientsQuietly() { try { ConcurrentMap<HiveClientCacheKey, CacheableHiveMetaStoreClient> elements = hiveCache.asMap(); for (CacheableHiveMetaStoreClient cacheableHiveMetaStoreClient : elements.values()) { cacheableHiveMetaStoreClient.tearDown(); } } catch (Exception e) { LOG.warn("Clean up of hive clients in the cache failed. Ignored", e); } }
From source file:org.onosproject.store.trivial.impl.SimpleGroupStore.java
@Override public void deviceInitialAuditCompleted(DeviceId deviceId, boolean completed) { synchronized (deviceAuditStatus) { if (completed) { log.debug("deviceInitialAuditCompleted: AUDIT " + "completed for device {}", deviceId); deviceAuditStatus.put(deviceId, true); // Execute all pending group requests ConcurrentMap<GroupKey, StoredGroupEntry> pendingGroupRequests = getPendingGroupKeyTable(deviceId); for (Group group : pendingGroupRequests.values()) { GroupDescription tmp = new DefaultGroupDescription(group.deviceId(), group.type(), group.buckets(), group.appCookie(), group.appId()); storeGroupDescriptionInternal(tmp); }/*from w w w . ja v a 2 s. com*/ getPendingGroupKeyTable(deviceId).clear(); } else { if (deviceAuditStatus.get(deviceId)) { log.debug("deviceInitialAuditCompleted: Clearing AUDIT " + "status for device {}", deviceId); deviceAuditStatus.put(deviceId, false); } } } }