Пример #1
0
  @Override
  public void storeSink(McastRoute route, ConnectPoint sink, Type operation) {
    MulticastData data =
        mcastRoutes.compute(
            route,
            (k, v) -> {
              switch (operation) {
                case ADD:
                  if (v == null) {
                    v = MulticastData.empty();
                  }
                  v.appendSink(sink);
                  break;
                case REMOVE:
                  if (v != null) {
                    v.removeSink(sink);
                  }
                  break;
                default:
                  log.warn("Unknown mcast operation type: {}", operation);
              }
              return v;
            });

    if (data != null) {
      switch (operation) {
        case ADD:
          delegate.notify(
              new McastEvent(
                  McastEvent.Type.SINK_ADDED,
                  McastRouteInfo.mcastRouteInfo(route, sink, data.source())));
          break;
        case REMOVE:
          if (data != null) {
            delegate.notify(
                new McastEvent(
                    McastEvent.Type.SINK_REMOVED,
                    McastRouteInfo.mcastRouteInfo(route, sink, data.source())));
          }
          break;
        default:
          log.warn("Unknown mcast operation type: {}", operation);
      }
    }
  }
Пример #2
0
 @Override
 public void storeRoute(McastRoute route, Type operation) {
   switch (operation) {
     case ADD:
       if (mcastRoutes.putIfAbsent(route, MulticastData.empty()) == null) {
         delegate.notify(
             new McastEvent(McastEvent.Type.ROUTE_ADDED, McastRouteInfo.mcastRouteInfo(route)));
       }
       break;
     case REMOVE:
       if (mcastRoutes.remove(route) != null) {
         delegate.notify(
             new McastEvent(McastEvent.Type.ROUTE_REMOVED, McastRouteInfo.mcastRouteInfo(route)));
       }
       break;
     default:
       log.warn("Unknown mcast operation type: {}", operation);
   }
 }
Пример #3
0
 @Override
 public Set<ConnectPoint> sinksFor(McastRoute route) {
   return mcastRoutes.getOrDefault(route, MulticastData.empty()).sinks();
 }
Пример #4
0
 @Override
 public ConnectPoint sourceFor(McastRoute route) {
   return mcastRoutes.getOrDefault(route, MulticastData.empty()).source();
 }