@Test() public void handleGetDataFromCacheTest() { IslRoundTripLatency forward = new IslRoundTripLatency(SWITCH_ID_1, PORT_1, 1, 0L); IslRoundTripLatency reverse = new IslRoundTripLatency(SWITCH_ID_2, PORT_2, 1, 0L); checkHandleGetDataFromCache(forward, SWITCH_ID_2, PORT_2); checkHandleGetDataFromCache(reverse, SWITCH_ID_1, PORT_1); }
public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedData(roundTripLatency, destination); } catch (IslNotFoundException e) { log.debug(String.format("Could not update ISL cache: %s", e.getMessage()), e); } catch (IllegalIslStateException e) { log.error(String.format("Could not update ISL cache: %s", e.getMessage()), e); } }
CacheService { public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedData(roundTripLatency, destination); } catch (IslNotFoundException e) { log.debug(String.format("Could not update ISL cache: %s", e.getMessage()), e); } catch (IllegalIslStateException e) { log.error(String.format("Could not update ISL cache: %s", e.getMessage()), e); } } }
CacheService { public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedData(roundTripLatency, destination); } catch (IslNotFoundException e) { log.debug(String.format("Could not update ISL cache: %s", e.getMessage()), e); } catch (IllegalIslStateException e) { log.error(String.format("Could not update ISL cache: %s", e.getMessage()), e); } } CacheService(CacheCarrier carrier, RepositoryFactory repositoryFactory); }
CacheService { public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedData(roundTripLatency, destination); } catch (IslNotFoundException e) { log.debug(String.format("Could not update ISL cache: %s", e.getMessage()), e); } catch (IllegalIslStateException e) { log.error(String.format("Could not update ISL cache: %s", e.getMessage()), e); } } CacheService(CacheCarrier carrier, RepositoryFactory repositoryFactory); void handleUpdateCache(IslStatusUpdateNotification notification); void handleGetDataFromCache(IslRoundTripLatency roundTripLatency); }
CacheService { public void handleGetDataFromCache(IslRoundTripLatency roundTripLatency) { Endpoint source = Endpoint.of(roundTripLatency.getSrcSwitchId(), roundTripLatency.getSrcPortNo()); Endpoint destination = cache.get(source); try { if (destination == null) { destination = updateCache(source); } carrier.emitCachedData(roundTripLatency, destination); } catch (IslNotFoundException e) { log.debug(String.format("Could not update ISL cache: %s", e.getMessage()), e); } catch (IllegalIslStateException e) { log.error(String.format("Could not update ISL cache: %s", e.getMessage()), e); } } CacheService(CacheCarrier carrier, RepositoryFactory repositoryFactory); void handleUpdateCache(IslStatusUpdateNotification notification); void handleGetDataFromCache(IslRoundTripLatency roundTripLatency);  }