import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipListenerRegistration;
import org.opendaylight.mdsal.eos.common.api.GenericEntityOwnershipService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
+import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
-import org.opendaylight.mdsal.singleton.common.api.CommonClusterSingletonServiceProvider;
import org.opendaylight.yangtools.concepts.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Abstract class {@link AbstractClusterSingletonServiceProviderImpl} represents implementations of
- * {@link CommonClusterSingletonServiceProvider} and it implements {@link GenericEntityOwnershipListener}
+ * {@link ClusterSingletonServiceProvider} and it implements {@link GenericEntityOwnershipListener}
* for providing OwnershipChange for all registered {@link ClusterSingletonServiceGroup} entity
* candidate.
*
* @param <R> the GenericEntityOwnershipListenerRegistration type
*/
public abstract class AbstractClusterSingletonServiceProviderImpl<P extends Path<P>, E extends GenericEntity<P>,
- C extends GenericEntityOwnershipChange<P, E>,
- G extends GenericEntityOwnershipListener<P, C>,
- S extends GenericEntityOwnershipService<P, E, G>,
- R extends GenericEntityOwnershipListenerRegistration<P, G>>
- implements CommonClusterSingletonServiceProvider, GenericEntityOwnershipListener<P, C> {
+ C extends GenericEntityOwnershipChange<P, E>,
+ G extends GenericEntityOwnershipListener<P, C>,
+ S extends GenericEntityOwnershipService<P, E, G>,
+ R extends GenericEntityOwnershipListenerRegistration<P, G>>
+ implements ClusterSingletonServiceProvider, GenericEntityOwnershipListener<P, C> {
private static final Logger LOG = LoggerFactory
.getLogger(AbstractClusterSingletonServiceProviderImpl.class.getName());
private static final String CLOSE_SERVICE_ENTITY_TYPE = "org.opendaylight.mdsal.AsyncServiceCloseEntityType";
private final S entityOwnershipService;
- private final ConcurrentMap<String, ClusterSingletonServiceGroup<P, E, C>> serviceGroupMap = new ConcurrentHashMap<>();
+ private final ConcurrentMap<String, ClusterSingletonServiceGroup<P, E, C>> serviceGroupMap =
+ new ConcurrentHashMap<>();
/* EOS Entity Listeners Registration */
private R serviceEntityListenerReg;
private R asyncCloseEntityListenerReg;
/**
- * Class constructor
+ * Class constructor.
*
* @param entityOwnershipService relevant EOS
*/
}
@Override
- public void onFailure(final Throwable t) {
- cleaningProvider(t);
+ public void onFailure(final Throwable throwable) {
+ cleaningProvider(throwable);
}
});
}
* @param entityOwnershipServiceInst - EOS type
* @return instance of EntityOwnershipListenerRegistration
*/
- protected abstract R registerListener(final String entityType, final S entityOwnershipServiceInst);
+ protected abstract R registerListener(String entityType, S entityOwnershipServiceInst);
/**
* Creates an extended {@link GenericEntity} instance.
* @param entityIdentifier the identifier of the entity
* @return instance of Entity extended GenericEntity type
*/
- protected abstract E createEntity(final String entityType, final String entityIdentifier);
+ protected abstract E createEntity(String entityType, String entityIdentifier);
/**
* Method is responsible for parsing ServiceGroupIdentifier from E entity.
*
- * @param entity
+ * @param entity instance of GenericEntity type
* @return ServiceGroupIdentifier parsed from entity key value.
*/
- protected abstract String getServiceIdentifierFromEntity(final E entity);
+ protected abstract String getServiceIdentifierFromEntity(E entity);
/**
* Method is called async. from close method in end of Provider lifecycle.
*
- * @param t Throwable (needs for log)
+ * @param throwable Throwable (needs for log)
*/
- protected final void cleaningProvider(@Nullable final Throwable t) {
+ protected final void cleaningProvider(@Nullable final Throwable throwable) {
LOG.debug("Final cleaning ClusterSingletonServiceProvider {}", this.getClass().getName());
- if (t != null) {
- LOG.warn("Unexpected problem by closing ClusterSingletonServiceProvider {}", this.getClass().getName(), t);
+ if (throwable != null) {
+ LOG.warn("Unexpected problem by closing ClusterSingletonServiceProvider {}",
+ this.getClass().getName(), throwable);
}
if (asyncCloseEntityListenerReg != null) {
asyncCloseEntityListenerReg.close();