import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableClassToInstanceMap;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.MapDifference;
@Override
public <T extends AvailabilityListener> ListenerRegistration<T> registerAvailabilityListener(final T listener) {
synchronized (DOMRpcRouter.this) {
- final ActionRegistration<T> ret = new ActionRegistration<>(DOMRpcRouter.this,
- listener, actionRoutingTable.getOperations(listener));
- final Builder<ActionRegistration<?>> b = ImmutableList.builder();
- b.addAll(actionListeners);
- b.add(ret);
- actionListeners = b.build();
+ final ActionRegistration<T> ret = new ActionRegistration<>(DOMRpcRouter.this, listener,
+ actionRoutingTable.getOperations(listener));
+ actionListeners = ImmutableList.<ActionRegistration<?>>builder()
+ .addAll(actionListeners)
+ .add(ret)
+ .build();
listenerNotifier.execute(ret::initialTable);
return ret;
synchronized (DOMRpcRouter.this) {
final Registration<T> ret = new Registration<>(DOMRpcRouter.this, listener,
routingTable.getOperations(listener));
- final Builder<Registration<?>> b = ImmutableList.builder();
- b.addAll(listeners);
- b.add(ret);
- listeners = b.build();
+ listeners = ImmutableList.<Registration<?>>builder().addAll(listeners).add(ret).build();
listenerNotifier.execute(ret::initialTable);
return ret;