class CDSShardAccessImpl implements CDSShardAccess, LeaderLocationListener, AutoCloseable {

    @Override
    public <L extends LeaderLocationListener> LeaderLocationListenerRegistration<L>
            registerLeaderLocationListener(final L listener) {
        checkNotClosed();
        requireNonNull(listener);
        checkArgument(!listeners.contains(listener), "Listener %s is already registered with ShardAccess %s", listener,
            this);

        LOG.debug("Registering LeaderLocationListener {}", listener);

        listeners.add(listener);

        return new LeaderLocationListenerRegistration<L>() {
            @Override
            public L getInstance() {
                return listener;
            }

            @Override
            public void close() {
                listeners.remove(listener);
            }
        };
    }

      CDSShardAccessImpl(final DOMDataTreeIdentifier prefix, final ActorUtils actorUtils);

}