本文整理汇总了Java中org.onlab.util.Tools.futureGetOrElse方法的典型用法代码示例。如果您正苦于以下问题:Java Tools.futureGetOrElse方法的具体用法?Java Tools.futureGetOrElse怎么用?Java Tools.futureGetOrElse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.onlab.util.Tools
的用法示例。
在下文中一共展示了Tools.futureGetOrElse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFlowEntry
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public FlowEntry getFlowEntry(FlowRule rule) {
NodeId master = mastershipService.getMasterFor(rule.deviceId());
if (master == null) {
log.debug("Failed to getFlowEntry: No master for {}", rule.deviceId());
return null;
}
if (Objects.equals(local, master)) {
return flowTable.getFlowEntry(rule);
}
log.trace("Forwarding getFlowEntry to {}, which is the primary (master) for device {}",
master, rule.deviceId());
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(rule,
FlowStoreMessageSubjects.GET_FLOW_ENTRY,
SERIALIZER::encode,
SERIALIZER::decode,
master),
FLOW_RULE_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
null);
}
示例2: getFlowEntries
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) {
NodeId master = mastershipService.getMasterFor(deviceId);
if (master == null) {
log.debug("Failed to getFlowEntries: No master for {}", deviceId);
return Collections.emptyList();
}
if (Objects.equals(local, master)) {
return flowTable.getFlowEntries(deviceId);
}
log.trace("Forwarding getFlowEntries to {}, which is the primary (master) for device {}",
master, deviceId);
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(deviceId,
FlowStoreMessageSubjects.GET_DEVICE_FLOW_ENTRIES,
SERIALIZER::encode,
SERIALIZER::decode,
master),
FLOW_RULE_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
Collections.emptyList());
}
示例3: getCurrentStatistic
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public Set<FlowEntry> getCurrentStatistic(ConnectPoint connectPoint) {
final DeviceId deviceId = connectPoint.deviceId();
NodeId master = mastershipService.getMasterFor(deviceId);
if (master == null) {
log.warn("No master for {}", deviceId);
return Collections.emptySet();
}
if (master.equals(clusterService.getLocalNode().id())) {
return getCurrentStatisticInternal(connectPoint);
} else {
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(
connectPoint,
GET_CURRENT,
SERIALIZER::encode,
SERIALIZER::decode,
master),
STATISTIC_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
Collections.emptySet());
}
}
示例4: getPreviousStatistic
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public Set<FlowEntry> getPreviousStatistic(ConnectPoint connectPoint) {
final DeviceId deviceId = connectPoint.deviceId();
NodeId master = mastershipService.getMasterFor(deviceId);
if (master == null) {
log.warn("No master for {}", deviceId);
return Collections.emptySet();
}
if (master.equals(clusterService.getLocalNode().id())) {
return getPreviousStatisticInternal(connectPoint);
} else {
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(
connectPoint,
GET_PREVIOUS,
SERIALIZER::encode,
SERIALIZER::decode,
master),
STATISTIC_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
Collections.emptySet());
}
}
示例5: getCurrentFlowStatistic
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public Set<FlowEntry> getCurrentFlowStatistic(ConnectPoint connectPoint) {
final DeviceId deviceId = connectPoint.deviceId();
NodeId master = mastershipService.getMasterFor(deviceId);
if (master == null) {
log.warn("No master for {}", deviceId);
return Collections.emptySet();
}
if (Objects.equal(local, master)) {
return getCurrentStatisticInternal(connectPoint);
} else {
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(
connectPoint,
GET_CURRENT,
SERIALIZER::encode,
SERIALIZER::decode,
master),
STATISTIC_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
Collections.emptySet());
}
}
示例6: getPreviousFlowStatistic
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public Set<FlowEntry> getPreviousFlowStatistic(ConnectPoint connectPoint) {
final DeviceId deviceId = connectPoint.deviceId();
NodeId master = mastershipService.getMasterFor(deviceId);
if (master == null) {
log.warn("No master for {}", deviceId);
return Collections.emptySet();
}
if (Objects.equal(local, master)) {
return getPreviousStatisticInternal(connectPoint);
} else {
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(
connectPoint,
GET_PREVIOUS,
SERIALIZER::encode,
SERIALIZER::decode,
master),
STATISTIC_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
Collections.emptySet());
}
}
示例7: getFlowEntry
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public FlowEntry getFlowEntry(FlowRule rule) {
NodeId master = mastershipService.getMasterFor(rule.deviceId());
if (master == null) {
log.debug("Failed to getFlowEntry: No master for {}", rule.deviceId());
return null;
}
if (Objects.equals(local, master)) {
return flowTable.getFlowEntry(rule);
}
log.trace("Forwarding getFlowEntry to {}, which is the primary (master) for device {}",
master, rule.deviceId());
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(rule,
ECFlowRuleStoreMessageSubjects.GET_FLOW_ENTRY,
serializer::encode,
serializer::decode,
master),
FLOW_RULE_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
null);
}
示例8: getFlowEntries
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) {
NodeId master = mastershipService.getMasterFor(deviceId);
if (master == null) {
log.debug("Failed to getFlowEntries: No master for {}", deviceId);
return Collections.emptyList();
}
if (Objects.equals(local, master)) {
return flowTable.getFlowEntries(deviceId);
}
log.trace("Forwarding getFlowEntries to {}, which is the primary (master) for device {}",
master, deviceId);
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(deviceId,
ECFlowRuleStoreMessageSubjects.GET_DEVICE_FLOW_ENTRIES,
serializer::encode,
serializer::decode,
master),
FLOW_RULE_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
Collections.emptyList());
}
示例9: getFlowEntry
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public FlowEntry getFlowEntry(NetworkId networkId, FlowRule rule) {
MastershipService mastershipService =
vnaService.get(networkId, MastershipService.class);
NodeId master = mastershipService.getMasterFor(rule.deviceId());
if (master == null) {
log.debug("Failed to getFlowEntry: No master for {}, vnet {}",
rule.deviceId(), networkId);
return null;
}
if (Objects.equals(local, master)) {
return flowTable.getFlowEntry(networkId, rule);
}
log.trace("Forwarding getFlowEntry to {}, which is the primary (master) " +
"for device {}, vnet {}",
master, rule.deviceId(), networkId);
VirtualFlowRule vRule = new VirtualFlowRule(networkId, rule);
return Tools.futureGetOrElse(clusterCommunicator.sendAndReceive(vRule,
GET_FLOW_ENTRY,
serializer::encode,
serializer::decode,
master),
FLOW_RULE_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
null);
}
示例10: getFlowEntries
import org.onlab.util.Tools; //导入方法依赖的package包/类
@Override
public Iterable<FlowEntry> getFlowEntries(NetworkId networkId, DeviceId deviceId) {
MastershipService mastershipService =
vnaService.get(networkId, MastershipService.class);
NodeId master = mastershipService.getMasterFor(deviceId);
if (master == null) {
log.debug("Failed to getFlowEntries: No master for {}, vnet {}", deviceId, networkId);
return Collections.emptyList();
}
if (Objects.equals(local, master)) {
return flowTable.getFlowEntries(networkId, deviceId);
}
log.trace("Forwarding getFlowEntries to {}, which is the primary (master) for device {}",
master, deviceId);
return Tools.futureGetOrElse(
clusterCommunicator.sendAndReceive(deviceId,
GET_DEVICE_FLOW_ENTRIES,
serializer::encode,
serializer::decode,
master),
FLOW_RULE_STORE_TIMEOUT_MILLIS,
TimeUnit.MILLISECONDS,
Collections.emptyList());
}
示例11: getLoadSync
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Synchronous version of getLoad.
* Obtains snapshot of control plane load of a specific device.
* The metrics range from control messages and system metrics
* (e.g., CPU and memory info).
* If the device id is not specified, it returns system metrics, otherwise,
* it returns control message stats of the given device.
*
* @param nodeId node identifier
* @param type control metric type
* @param deviceId device identifier
* @return control load snapshot
*/
default ControlLoadSnapshot getLoadSync(NodeId nodeId,
ControlMetricType type,
Optional<DeviceId> deviceId) {
return Tools.futureGetOrElse(getLoad(nodeId, type, deviceId),
TIMEOUT_MILLIS, TimeUnit.MILLISECONDS, null);
}
示例12: availableResourcesSync
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Synchronous version of availableResource.
* Obtains a list of names of available resources.
*
* @param nodeId node identifier
* @param resourceType resource type
* @return a collection of available resource names
*/
default Set<String> availableResourcesSync(NodeId nodeId, Type resourceType) {
return Tools.futureGetOrElse(availableResources(nodeId, resourceType),
TIMEOUT_MILLIS, TimeUnit.MILLISECONDS, ImmutableSet.of());
}
示例13: setRoleSync
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Synchronous version of setRole.
* Applies the current mastership role for the specified device.
*
* @param instance controller instance identifier
* @param deviceId device identifier
* @param role requested role
*/
default void setRoleSync(NodeId instance, DeviceId deviceId, MastershipRole role) {
Tools.futureGetOrElse(setRole(instance, deviceId, role), TIMEOUT_MILLIS, TimeUnit.MILLISECONDS, null);
}
示例14: requestRoleForSync
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Synchronous version of requestRoleFor. Returns the mastership status of
* the local controller for a given device forcing master selection if necessary.
*
* @param deviceId the identifier of the device
* @return the role of this controller instance
*/
default MastershipRole requestRoleForSync(DeviceId deviceId) {
return Tools.futureGetOrElse(requestRoleFor(deviceId),
TIMEOUT_MILLIS, TimeUnit.MILLISECONDS, NONE);
}
示例15: relinquishMastershipSync
import org.onlab.util.Tools; //导入方法依赖的package包/类
/**
* Synchronous version of relinquishMastership. Abandons mastership of the
* specified device on the local node thus forcing selection of a new master.
* If the local node is not a master for this device, no master selection will occur.
*
* @param deviceId the identifier of the device
*/
default void relinquishMastershipSync(DeviceId deviceId) {
Tools.futureGetOrElse(relinquishMastership(deviceId),
TIMEOUT_MILLIS, TimeUnit.MILLISECONDS, null);
}