当前位置: 首页>>代码示例>>Java>>正文


Java ProviderId.isAncillary方法代码示例

本文整理汇总了Java中org.onosproject.net.provider.ProviderId.isAncillary方法的典型用法代码示例。如果您正苦于以下问题:Java ProviderId.isAncillary方法的具体用法?Java ProviderId.isAncillary怎么用?Java ProviderId.isAncillary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.onosproject.net.provider.ProviderId的用法示例。


在下文中一共展示了ProviderId.isAncillary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDevice

import org.onosproject.net.provider.ProviderId; //导入方法依赖的package包/类
private DeviceEvent createDevice(ProviderId providerId, Device newDevice) {
    // update composed device cache
    Device oldDevice = devices.putIfAbsent(newDevice.id(), newDevice);
    verify(oldDevice == null,
           "Unexpected Device in cache. PID:%s [old=%s, new=%s]",
           providerId, oldDevice, newDevice);

    if (!providerId.isAncillary()) {
        availableDevices.add(newDevice.id());
    }

    return new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, newDevice, null);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:14,代码来源:SimpleDeviceStore.java

示例2: updateDevice

import org.onosproject.net.provider.ProviderId; //导入方法依赖的package包/类
private DeviceEvent updateDevice(ProviderId providerId, Device oldDevice, Device newDevice) {
    // We allow only certain attributes to trigger update
    boolean propertiesChanged =
            !Objects.equals(oldDevice.hwVersion(), newDevice.hwVersion()) ||
                    !Objects.equals(oldDevice.swVersion(), newDevice.swVersion());
    boolean annotationsChanged =
            !AnnotationsUtil.isEqual(oldDevice.annotations(), newDevice.annotations());

    // Primary providers can respond to all changes, but ancillary ones
    // should respond only to annotation changes.
    if ((providerId.isAncillary() && annotationsChanged) ||
            (!providerId.isAncillary() && (propertiesChanged || annotationsChanged))) {

        boolean replaced = devices.replace(newDevice.id(), oldDevice, newDevice);
        if (!replaced) {
            // FIXME: Is the enclosing if required here?
            verify(replaced,
                   "Replacing devices cache failed. PID:%s [expected:%s, found:%s, new=%s]",
                   providerId, oldDevice, devices.get(newDevice.id()), newDevice);
        }
        if (!providerId.isAncillary()) {
            availableDevices.add(newDevice.id());
        }
        return new DeviceEvent(DeviceEvent.Type.DEVICE_UPDATED, newDevice, null);
    }

    // Otherwise merely attempt to change availability if primary provider
    if (!providerId.isAncillary()) {
        boolean added = availableDevices.add(newDevice.id());
        return !added ? null :
                new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, newDevice, null);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:35,代码来源:SimpleDeviceStore.java

示例3: refreshDeviceCache

import org.onosproject.net.provider.ProviderId; //导入方法依赖的package包/类
private DeviceEvent refreshDeviceCache(ProviderId providerId, DeviceId deviceId) {
    AtomicReference<DeviceEvent.Type> eventType = new AtomicReference<>();
    Device device = devices.compute(deviceId, (k, existingDevice) -> {
        Device newDevice = composeDevice(deviceId);
        if (existingDevice == null) {
            eventType.set(DEVICE_ADDED);
        } else {
            // We allow only certain attributes to trigger update
            boolean propertiesChanged =
                    !Objects.equals(existingDevice.hwVersion(), newDevice.hwVersion()) ||
                            !Objects.equals(existingDevice.swVersion(), newDevice.swVersion()) ||
                            !Objects.equals(existingDevice.providerId(), newDevice.providerId());
            boolean annotationsChanged =
                    !AnnotationsUtil.isEqual(existingDevice.annotations(), newDevice.annotations());

            // Primary providers can respond to all changes, but ancillary ones
            // should respond only to annotation changes.
            if ((providerId.isAncillary() && annotationsChanged) ||
                    (!providerId.isAncillary() && (propertiesChanged || annotationsChanged))) {
                boolean replaced = devices.replace(deviceId, existingDevice, newDevice);
                verify(replaced, "Replacing devices cache failed. PID:%s [expected:%s, found:%s, new=%s]",
                        providerId, existingDevice, devices.get(deviceId), newDevice);
                eventType.set(DEVICE_UPDATED);
            }
        }
        return newDevice;
    });
    if (eventType.get() != null && !providerId.isAncillary()) {
        markOnline(deviceId);
    }
    return eventType.get() != null ? new DeviceEvent(eventType.get(), device) : null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:ECDeviceStore.java

示例4: createDevice

import org.onosproject.net.provider.ProviderId; //导入方法依赖的package包/类
private DeviceEvent createDevice(ProviderId providerId,
                                 Device newDevice, Timestamp timestamp) {

    // update composed device cache
    Device oldDevice = devices.putIfAbsent(newDevice.id(), newDevice);
    verify(oldDevice == null,
           "Unexpected Device in cache. PID:%s [old=%s, new=%s]",
           providerId, oldDevice, newDevice);

    if (!providerId.isAncillary()) {
        markOnline(newDevice.id(), timestamp);
    }

    return new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, newDevice, null);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:GossipDeviceStore.java


注:本文中的org.onosproject.net.provider.ProviderId.isAncillary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。