public void update(InputContext context) {
log.info(String.format("%s - Input configuration has changed, updating ports", this));
// Copy the context in order to ensure that future changes via the
// observer will not effect this update.
final InputContext update = context.copy();
// All updates are run sequentially to prevent race conditions
// during configuration changes. Without essentially locking the
// object, it could be possible that connections are simultaneously
// added and removed or opened and closed on the object.
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
final List<InputPort> newPorts = new ArrayList<>();
for (InputPortContext input : update.ports()) {
if (!ports.containsKey(input.name())) {
InputPortContext port = DefaultInputCollector.this.context.port(input.name());
if (port != null) {
log.debug(String.format("%s - Adding in port: %s", DefaultInputCollector.this, input));
newPorts.add(new DefaultInputPort(vertx, port));