*/
package org.opendaylight.mdsal.singleton.common.api;
+import org.opendaylight.yangtools.concepts.Registration;
+
/**
* {@link ClusterSingletonServiceProvider} provides a functionality to register and group services
* {@link ClusterSingletonService} by service group identifier. Services could be Applications or RPCs.
* RuntimeException implementation is a hotfix for an unwanted API contract changes in boron release only.
*
* @param service ClusterSingletonService instance
- * @return {@link AutoCloseable} registration
+ * @return {@link Registration} registration
*/
- ClusterSingletonServiceRegistration registerClusterSingletonService(ClusterSingletonService service);
+ Registration registerClusterSingletonService(ClusterSingletonService service);
}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.singleton.common.api;
-
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
-
-/**
- * An {@link ObjectRegistration} of a {@link ClusterSingletonService} instance.
- */
-public interface ClusterSingletonServiceRegistration extends ObjectRegistration<ClusterSingletonService> {
-
-}
import org.opendaylight.mdsal.eos.common.api.EntityOwnershipStateChange;
import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.yangtools.concepts.Identifiable;
/**
// FIXME: rename to ServiceGroup and seal
abstract class ClusterSingletonServiceGroup implements Identifiable<String> {
/**
- * This method must be called once on startup to initialize this group and
- * register the relevant group entity candidate. It means create relevant
- * Group Entity Candidate Registration.
+ * This method must be called once on startup to initialize this group and register the relevant group entity
+ * candidate. It means create relevant Group Entity Candidate Registration.
*/
abstract void initialize() throws CandidateAlreadyRegisteredException;
/**
- * This method registers a service instance for this service group. If the local node has
- * ownership of the service group, the {@link ClusterSingletonService#instantiateServiceInstance()}
- * method is called. Otherwise, the method is called once the local node gains ownership.
+ * This method registers a service instance for this service group. If the local node has ownership of the service
+ * group, the {@link ClusterSingletonService#instantiateServiceInstance()} method is called. Otherwise, the method
+ * is called once the local node gains ownership.
*
* @param service instance
*/
- abstract void registerService(ClusterSingletonServiceRegistration reg);
+ abstract void registerService(ServiceRegistration reg);
/**
- * Method provides possibility to restart some service from group without change
- * leadership for whole group. {@link ClusterSingletonServiceRegistration#close()}
- * implementation has to call this service.
- * Candidates are signed for group, so unregistration for group with one service
- * has to trigger new election only otherwise we can see same behavior as on server
- * without clustering.
+ * Method provides possibility to restart some service from group without change leadership for whole group.
+ * {@link ServiceRegistration#removeRegistration()} implementation has to call this service.
+ *
+ * <p>
+ * Candidates are signed for group, so unregistration for group with one service has to trigger new election only
+ * otherwise we can see same behavior as on server without clustering.
*
* @param service instance
* @return Future which completes when this instance is shutdown if this was the last registration, null otherwise
*/
- abstract @Nullable ListenableFuture<?> unregisterService(ClusterSingletonServiceRegistration reg);
+ abstract @Nullable ListenableFuture<?> unregisterService(ServiceRegistration reg);
/**
* Method implementation has to apply ownershipChange for all registered services.
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
-import java.util.Collection;
import java.util.HashMap;
-import java.util.Iterator;
+import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final @NonNull DOMEntity serviceEntity;
private final @NonNull DOMEntity cleanupEntity;
- private final Set<ClusterSingletonServiceRegistration> members = ConcurrentHashMap.newKeySet();
+ private final Set<ServiceRegistration> members = ConcurrentHashMap.newKeySet();
// Guarded by lock
- private final Map<ClusterSingletonServiceRegistration, ServiceInfo> services = new HashMap<>();
+ private final Map<ServiceRegistration, ServiceInfo> services = new HashMap<>();
// Marker for when any state changed
private static final AtomicIntegerFieldUpdater<ClusterSingletonServiceGroupImpl> DIRTY_UPDATER =
* @param services Services list
*/
ClusterSingletonServiceGroupImpl(final String identifier, final DOMEntityOwnershipService entityOwnershipService,
- final DOMEntity serviceEntity, final DOMEntity cleanupEntity,
- final Collection<ClusterSingletonServiceRegistration> services) {
+ final DOMEntity serviceEntity, final DOMEntity cleanupEntity, final List<ServiceRegistration> services) {
checkArgument(!identifier.isEmpty(), "Identifier may not be empty");
this.identifier = identifier;
this.entityOwnershipService = requireNonNull(entityOwnershipService);
}
@Override
- void registerService(final ClusterSingletonServiceRegistration reg) {
+ void registerService(final ServiceRegistration reg) {
final ClusterSingletonService service = verifyRegistration(reg);
checkNotClosed();
}
@Override
- ListenableFuture<?> unregisterService(final ClusterSingletonServiceRegistration reg) {
+ ListenableFuture<?> unregisterService(final ServiceRegistration reg) {
verifyRegistration(reg);
checkNotClosed();
return null;
}
- private ClusterSingletonService verifyRegistration(final ClusterSingletonServiceRegistration reg) {
+ private ClusterSingletonService verifyRegistration(final ServiceRegistration reg) {
final ClusterSingletonService service = reg.getInstance();
verify(identifier.equals(service.getIdentifier().getName()));
return service;
}
private synchronized @NonNull ListenableFuture<?> destroyGroup() {
- final SettableFuture<Void> future = SettableFuture.create();
+ final var future = SettableFuture.<Void>create();
if (!closeFuture.compareAndSet(null, future)) {
return verifyNotNull(closeFuture.get());
}
// Has to be called with lock asserted
private void tryReconcileState() {
// First take a safe snapshot of current state on which we will base our decisions.
- final Set<ClusterSingletonServiceRegistration> localMembers;
+ final Set<ServiceRegistration> localMembers;
final boolean haveCleanup;
final boolean haveService;
synchronized (this) {
// Has to be called with lock asserted
@SuppressWarnings("illegalCatch")
- private void ensureServicesStarting(final Set<ClusterSingletonServiceRegistration> localConfig) {
+ private void ensureServicesStarting(final Set<ServiceRegistration> localConfig) {
LOG.debug("Service group {} starting services", identifier);
// This may look counter-intuitive, but the localConfig may be missing some services that are started -- for
// example when this method is executed as part of unregisterService() call. In that case we need to ensure
// services in the list are stopping
- final Iterator<Entry<ClusterSingletonServiceRegistration, ServiceInfo>> it = services.entrySet().iterator();
+ final var it = services.entrySet().iterator();
while (it.hasNext()) {
- final Entry<ClusterSingletonServiceRegistration, ServiceInfo> entry = it.next();
- final ClusterSingletonServiceRegistration reg = entry.getKey();
+ final var entry = it.next();
+ final var reg = entry.getKey();
if (!localConfig.contains(reg)) {
- final ServiceInfo newInfo = ensureStopping(reg, entry.getValue());
+ final var newInfo = ensureStopping(reg, entry.getValue());
if (newInfo != null) {
entry.setValue(newInfo);
} else {
}
// Now make sure member services are being juggled around
- for (ClusterSingletonServiceRegistration reg : localConfig) {
+ for (var reg : localConfig) {
if (!services.containsKey(reg)) {
- final ClusterSingletonService service = reg.getInstance();
+ final var service = reg.getInstance();
LOG.debug("Starting service {}", service);
try {
// Has to be called with lock asserted
private void ensureServicesStopping() {
- final Iterator<Entry<ClusterSingletonServiceRegistration, ServiceInfo>> it = services.entrySet().iterator();
+ final var it = services.entrySet().iterator();
while (it.hasNext()) {
- final Entry<ClusterSingletonServiceRegistration, ServiceInfo> entry = it.next();
- final ServiceInfo newInfo = ensureStopping(entry.getKey(), entry.getValue());
+ final var entry = it.next();
+ final var newInfo = ensureStopping(entry.getKey(), entry.getValue());
if (newInfo != null) {
entry.setValue(newInfo);
} else {
}
@SuppressWarnings("illegalCatch")
- private ServiceInfo ensureStopping(final ClusterSingletonServiceRegistration reg, final ServiceInfo info) {
+ private ServiceInfo ensureStopping(final ServiceRegistration reg, final ServiceInfo info) {
switch (info.getState()) {
case STARTED:
- final ClusterSingletonService service = reg.getInstance();
+ final var service = reg.getInstance();
LOG.debug("Service group {} stopping service {}", identifier, service);
final @NonNull ListenableFuture<?> future;
import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
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.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.osgi.service.component.annotations.Activate;
}
@Override
- public synchronized ClusterSingletonServiceRegistration registerClusterSingletonService(
- final ClusterSingletonService service) {
+ public synchronized Registration registerClusterSingletonService(final ClusterSingletonService service) {
LOG.debug("Call registrationService {} method for ClusterSingletonService Provider {}", service, this);
final String serviceIdentifier = service.getIdentifier().getName();
serviceGroup = existing;
}
- final var reg = new AbstractClusterSingletonServiceRegistration(service) {
+ final var reg = new ServiceRegistration(service) {
@Override
protected void removeRegistration() {
// We need to bounce the unregistration through a ordered lock in order not to deal with asynchronous
}
private ClusterSingletonServiceGroup createGroup(final String serviceIdentifier,
- final List<ClusterSingletonServiceRegistration> services) {
+ final List<ServiceRegistration> services) {
return new ClusterSingletonServiceGroupImpl(serviceIdentifier, entityOwnershipService,
createEntity(SERVICE_ENTITY_TYPE, serviceIdentifier),
createEntity(CLOSE_SERVICE_ENTITY_TYPE, serviceIdentifier), services);
}
}
- private void removeRegistration(final String serviceIdentifier, final ClusterSingletonServiceRegistration reg) {
+ private void removeRegistration(final String serviceIdentifier, final ServiceRegistration reg) {
final PlaceholderGroup placeHolder;
final ListenableFuture<?> future;
synchronized (this) {
import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException;
import org.opendaylight.mdsal.eos.common.api.EntityOwnershipStateChange;
import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final class PlaceholderGroup extends ClusterSingletonServiceGroup {
private static final Logger LOG = LoggerFactory.getLogger(PlaceholderGroup.class);
- private final List<ClusterSingletonServiceRegistration> services = new ArrayList<>(0);
+ private final List<ServiceRegistration> services = new ArrayList<>(0);
private final ClusterSingletonServiceGroup previous;
private final ListenableFuture<?> closeFuture;
}
@Override
- void registerService(final ClusterSingletonServiceRegistration reg) {
+ void registerService(final ServiceRegistration reg) {
verifyNoSuccessor();
services.add(reg);
LOG.debug("{}: added service {}", this, reg.getInstance());
}
@Override
- ListenableFuture<?> unregisterService(final ClusterSingletonServiceRegistration reg) {
+ ListenableFuture<?> unregisterService(final ServiceRegistration reg) {
verifyNoSuccessor();
services.remove(reg);
LOG.debug("{}: removed service {}", this, reg.getInstance());
}
// Note: this is a leaked structure, the caller can reuse it at will, but has to regard
- List<ClusterSingletonServiceRegistration> getServices() {
+ List<ServiceRegistration> getServices() {
verifyNoSuccessor();
LOG.trace("{}: returning services {}", this, services);
return services;
package org.opendaylight.mdsal.singleton.dom.impl;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
-abstract class AbstractClusterSingletonServiceRegistration extends AbstractObjectRegistration<ClusterSingletonService>
- implements ClusterSingletonServiceRegistration {
-
- AbstractClusterSingletonServiceRegistration(final ClusterSingletonService instance) {
+abstract class ServiceRegistration extends AbstractObjectRegistration<ClusterSingletonService> {
+ ServiceRegistration(final ClusterSingletonService instance) {
super(instance);
}
}
import org.opendaylight.mdsal.eos.dom.api.DOMEntity;
import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
import org.opendaylight.yangtools.concepts.Registration;
assertEquals(TestClusterSingletonServiceState.INITIALIZED, clusterSingletonService.getServiceState());
clusterSingletonServiceProvider.ownershipChanged(DOUBLE_ENTITY, LOCAL_OWNERSHIP_GRANTED, false);
assertEquals(TestClusterSingletonServiceState.STARTED, clusterSingletonService.getServiceState());
- final ClusterSingletonServiceRegistration reg2 = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService2);
+ final var reg2 = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService2);
assertNotNull(reg2);
assertEquals(TestClusterSingletonServiceState.STARTED, clusterSingletonService2.getServiceState());
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*/
@Test
public void closeClusterSingletonServiceRegistrationNoRoleTest() throws Exception {
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*/
@Test
public void closeClusterSingletonServiceRegistrationNoRoleTwoServicesTest() throws Exception {
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*/
@Test
public void closeClusterSingletonServiceRegistrationSlaveTest() throws Exception {
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*/
@Test
public void closeClusterSingletonServiceRegistrationSlaveTwoServicesTest() throws Exception {
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterTwoServicesTest() throws Exception {
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
/*
* Testing {@link DOMClusterSingletonServiceProviderImpl} implementation
*/
@Test
public void takeDoubleLeadershipClusterSingletonServiceTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
verify(mockEos).registerCandidate(ENTITY);
clusterSingletonServiceProvider.ownershipChanged(ENTITY, LOCAL_OWNERSHIP_GRANTED, false);
*/
@Test
public void unexpectedLostLeadershipDoubleCandidateTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
verify(mockEos).registerCandidate(ENTITY);
clusterSingletonServiceProvider.ownershipChanged(ENTITY, LOCAL_OWNERSHIP_GRANTED, false);
*/
@Test
public void inJeopardyMasterTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
verify(mockEos).registerCandidate(ENTITY);
clusterSingletonServiceProvider.ownershipChanged(ENTITY, LOCAL_OWNERSHIP_GRANTED, false);
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*
* @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
assertEquals(TestClusterSingletonServiceState.INITIALIZED, clusterSingletonService.getServiceState());
verify(mockEos).registerCandidate(ENTITY);
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*
* @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterCloseWithNotificationTimesTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
assertEquals(TestClusterSingletonServiceState.INITIALIZED, clusterSingletonService.getServiceState());
verify(mockEos).registerCandidate(ENTITY);
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*
* @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterCloseCoupleTimesTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
assertEquals(TestClusterSingletonServiceState.INITIALIZED, clusterSingletonService.getServiceState());
verify(mockEos).registerCandidate(ENTITY);
import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener;
import org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipService;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
import org.opendaylight.yangtools.concepts.Registration;
public ClusterSingletonServiceGroupImpl singletonServiceGroup;
- public ClusterSingletonServiceRegistration firstReg;
- public ClusterSingletonServiceRegistration secondReg;
+ public ServiceRegistration firstReg;
+ public ServiceRegistration secondReg;
/**
* Initialization functionality for every Tests in this suite.
doReturn(SERVICE_GROUP_IDENT).when(mockClusterSingletonService).getIdentifier();
doReturn(SERVICE_GROUP_IDENT).when(mockClusterSingletonServiceSecond).getIdentifier();
- firstReg = new AbstractClusterSingletonServiceRegistration(mockClusterSingletonService) {
+ firstReg = new ServiceRegistration(mockClusterSingletonService) {
@Override
protected void removeRegistration() {
// No-op
}
};
- secondReg = new AbstractClusterSingletonServiceRegistration(mockClusterSingletonServiceSecond) {
+ secondReg = new ServiceRegistration(mockClusterSingletonServiceSecond) {
@Override
protected void removeRegistration() {
// No-op
}
/**
- * Test checks closing processing for close {@link ClusterSingletonServiceRegistration}.
+ * Test checks closing processing for close {@link ServiceRegistration}.
*
* @throws CandidateAlreadyRegisteredException - unexpected exception
*/
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.mdsal.singleton.dom.impl;
import static org.junit.Assert.assertEquals;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
/**
* Synchronous test suite.
*/
@Test
public void takeDoubleLeadershipClusterSingletonServiceTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
verify(mockEos).registerCandidate(ENTITY);
clusterSingletonServiceProvider.ownershipChanged(ENTITY, LOCAL_OWNERSHIP_GRANTED, false);
*/
@Test
public void unexpectedLostLeadershipDoubleCandidateTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
verify(mockEos).registerCandidate(ENTITY);
clusterSingletonServiceProvider.ownershipChanged(ENTITY, LOCAL_OWNERSHIP_GRANTED, false);
*/
@Test
public void inJeopardyMasterTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
verify(mockEos).registerCandidate(ENTITY);
clusterSingletonServiceProvider.ownershipChanged(ENTITY, LOCAL_OWNERSHIP_GRANTED, false);
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*
* @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
assertEquals(TestClusterSingletonServiceState.INITIALIZED, clusterSingletonService.getServiceState());
verify(mockEos).registerCandidate(ENTITY);
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*
* @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterCloseWithNotificationTimesTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
assertEquals(TestClusterSingletonServiceState.INITIALIZED, clusterSingletonService.getServiceState());
verify(mockEos).registerCandidate(ENTITY);
}
/**
- * Test checks close processing for {@link ClusterSingletonServiceRegistration}.
+ * Test checks close processing for {@link ServiceRegistration}.
*
* @throws Exception if the condition does not meet
*/
@Test
public void closeClusterSingletonServiceRegistrationMasterCloseCoupleTimesTest() throws Exception {
- final ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ final var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
assertEquals(TestClusterSingletonServiceState.INITIALIZED, clusterSingletonService.getServiceState());
verify(mockEos).registerCandidate(ENTITY);
*/
@Test
public void testTwoIncarnations() throws Exception {
- ClusterSingletonServiceRegistration reg = clusterSingletonServiceProvider
- .registerClusterSingletonService(clusterSingletonService);
+ var reg = clusterSingletonServiceProvider.registerClusterSingletonService(clusterSingletonService);
assertNotNull(reg);
assertEquals(TestClusterSingletonServiceState.INITIALIZED, clusterSingletonService.getServiceState());
verify(mockEos).registerCandidate(ENTITY);