Class MastershipChangeServiceManagerImpl
- java.lang.Object
-
- org.opendaylight.openflowplugin.impl.mastership.MastershipChangeServiceManagerImpl
-
- All Implemented Interfaces:
AutoCloseable
,OwnershipChangeListener
,ReconciliationFrameworkRegistrar
,MastershipChangeServiceManager
@Singleton public final class MastershipChangeServiceManagerImpl extends Object implements MastershipChangeServiceManager
-
-
Constructor Summary
Constructors Constructor Description MastershipChangeServiceManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
becomeMaster(@NonNull DeviceInfo deviceInfo)
This event is called when device is fully mastered.com.google.common.util.concurrent.ListenableFuture<ResultState>
becomeMasterBeforeSubmittedDS(@NonNull DeviceInfo deviceInfo)
Should be called when device is being mastered as inOwnershipChangeListener.becomeMaster(DeviceInfo)
.void
becomeSlaveOrDisconnect(@NonNull DeviceInfo deviceInfo)
Should be called when device is disconnected or going to be slaved.void
close()
boolean
isReconciliationFrameworkRegistered()
Check if reconciliation framework is registered.ReconciliationFrameworkRegistration
reconciliationFrameworkRegistration(@NonNull ReconciliationFrameworkEvent reconciliationFrameworkEvent)
Setter for reconciliation framework event listener.@NonNull MastershipChangeRegistration
register(@NonNull MastershipChangeService service)
Register of mastership change listener.void
setMasterChecker(@NonNull MasterChecker masterChecker)
Set the device mastership checker.
-
-
-
Method Detail
-
register
public @NonNull MastershipChangeRegistration register(@NonNull MastershipChangeService service)
Description copied from interface:MastershipChangeServiceManager
Register of mastership change listener. Returned registration need to be closed by client. It doesn't contain event for reconciliation framework event.- Specified by:
register
in interfaceMastershipChangeServiceManager
- Parameters:
service
- implementation ofMastershipChangeService
- Returns:
- registration
- See Also:
ReconciliationFrameworkEvent
-
reconciliationFrameworkRegistration
public ReconciliationFrameworkRegistration reconciliationFrameworkRegistration(@NonNull ReconciliationFrameworkEvent reconciliationFrameworkEvent) throws MastershipChangeException
Description copied from interface:MastershipChangeServiceManager
Setter for reconciliation framework event listener. It can be registered only once. Another registrations will throw an exception- Specified by:
reconciliationFrameworkRegistration
in interfaceMastershipChangeServiceManager
- Parameters:
reconciliationFrameworkEvent
- reconciliation framework- Returns:
- registration object, which can be closed to unregister
- Throws:
MastershipChangeException
- if already reconciliation framework registered
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceMastershipChangeServiceManager
-
becomeMaster
public void becomeMaster(@NonNull DeviceInfo deviceInfo)
Description copied from interface:OwnershipChangeListener
This event is called when device is fully mastered. All condition have to been done successful.- Transaction chain created
- RPC services started
- Initial statistics gathering.
- Initial DS submit.
- Flow registry filled. - this step is not mandatory
- Specified by:
becomeMaster
in interfaceOwnershipChangeListener
- Parameters:
deviceInfo
- connected switch identification
-
becomeSlaveOrDisconnect
public void becomeSlaveOrDisconnect(@NonNull DeviceInfo deviceInfo)
Description copied from interface:OwnershipChangeListener
Should be called when device is disconnected or going to be slaved.- Specified by:
becomeSlaveOrDisconnect
in interfaceOwnershipChangeListener
- Parameters:
deviceInfo
- connected switch identification
-
becomeMasterBeforeSubmittedDS
public com.google.common.util.concurrent.ListenableFuture<ResultState> becomeMasterBeforeSubmittedDS(@NonNull DeviceInfo deviceInfo)
Description copied from interface:OwnershipChangeListener
Should be called when device is being mastered as inOwnershipChangeListener.becomeMaster(DeviceInfo)
.But before: Initial DS submit
This is special call designed only for reconciliation framework.- Specified by:
becomeMasterBeforeSubmittedDS
in interfaceOwnershipChangeListener
- Parameters:
deviceInfo
- connected switch identification- Returns:
- future to be able handle device after reconciliation
- See Also:
OwnershipChangeListener.becomeMaster(DeviceInfo)
,ReconciliationFrameworkRegistrar.isReconciliationFrameworkRegistered()
-
setMasterChecker
public void setMasterChecker(@NonNull MasterChecker masterChecker)
Description copied from interface:OwnershipChangeListener
Set the device mastership checker.- Specified by:
setMasterChecker
in interfaceOwnershipChangeListener
- Parameters:
masterChecker
-MasterChecker
-
isReconciliationFrameworkRegistered
public boolean isReconciliationFrameworkRegistered()
Description copied from interface:ReconciliationFrameworkRegistrar
Check if reconciliation framework is registered. If not the eventOwnershipChangeListener.becomeMasterBeforeSubmittedDS(DeviceInfo)
will not be triggered.- Specified by:
isReconciliationFrameworkRegistered
in interfaceReconciliationFrameworkRegistrar
- Returns:
- true if there exists any reconciliation framework registration
-
-