private void sendFilteringObjective(boolean install, FilteringObjective.Builder fob, Interface intf) { ObjectiveContext context = new DefaultObjectiveContext( (objective) -> log.info("Installed filter for interface {}", intf), (objective, error) -> log.error("Failed to install filter for interface {}: {}", intf, error)); FilteringObjective filter = install ? fob.add(context) : fob.remove(context); flowObjectiveService.filter(deviceId, filter); }