public class RebindManagerImpl extends java.lang.Object implements RebindManager
Lifecycle is to create an instance of this, set it up (e.g. setPeriodicPersistPeriod(Duration),
setPersister(BrooklynMementoPersister); however noting that persist period must be set before the persister).
Usually done for you by the conveniences (such as the launcher).
| Modifier and Type | Class and Description |
|---|---|
static class |
RebindManagerImpl.RebindTracker
For tracking if rebinding, for
AbstractBrooklynObject.isRebinding() etc. |
RebindManager.RebindFailureMode| Modifier and Type | Field and Description |
|---|---|
static ConfigKey<RebindManager.RebindFailureMode> |
ADD_POLICY_FAILURE_MODE |
static ConfigKey<RebindManager.RebindFailureMode> |
DANGLING_REFERENCE_FAILURE_MODE |
static ConfigKey<QuorumCheck> |
DANGLING_REFERENCES_MIN_REQUIRED_HEALTHY |
static ConfigKey<RebindManager.RebindFailureMode> |
LOAD_POLICY_FAILURE_MODE |
static org.slf4j.Logger |
LOG |
static ConfigKey<RebindManager.RebindFailureMode> |
REBIND_FAILURE_MODE |
| Constructor and Description |
|---|
RebindManagerImpl(ManagementContextInternal managementContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
forcePersistNow()
Forcibly performs persistence, in the foreground
|
void |
forcePersistNow(boolean full,
PersistenceExceptionHandler exceptionHandler)
Forcibly performs persistence, in the foreground, either full (all entities) or incremental;
if no exception handler specified, the default one from the persister is used.
|
ChangeListener |
getChangeListener() |
ManagementContextInternal |
getManagementContext() |
java.util.Map<java.lang.String,java.lang.Object> |
getMetrics()
Metrics about rebind, last success, etc.
|
BrooklynMementoPersister |
getPersister() |
int |
getReadOnlyRebindCount() |
boolean |
isAwaitingInitialRebind()
Whether the management state has changed to a state where a rebind is needed
but we are still awaiting the first run;
ie state is master or hot, but list of apps is not yet accurate
|
boolean |
isPersistenceRunning() |
boolean |
isReadOnlyRunning() |
java.util.List<Application> |
rebind() |
java.util.List<Application> |
rebind(java.lang.ClassLoader classLoader) |
java.util.List<Application> |
rebind(java.lang.ClassLoader classLoader,
RebindExceptionHandler exceptionHandler) |
java.util.List<Application> |
rebind(java.lang.ClassLoader classLoaderO,
RebindExceptionHandler exceptionHandlerO,
ManagementNodeState modeO)
Causes this management context to rebind, loading data from the given backing store.
|
void |
rebindPartialActive(CompoundTransformer transformer,
java.util.Iterator<BrooklynObject> objectsToRebind) |
void |
rebindPartialActive(CompoundTransformer transformer,
java.lang.String... objectsToRebindIds) |
BrooklynMementoRawData |
retrieveMementoRawData() |
void |
setAwaitingInitialRebind(boolean isAwaitingInitialRebind) |
void |
setPeriodicPersistPeriod(Duration period)
Must be called before setPerister()
|
void |
setPeriodicPersistPeriod(long periodMillis)
Deprecated.
since 0.7.0; use
setPeriodicPersistPeriod(Duration) |
void |
setPersister(BrooklynMementoPersister val) |
void |
setPersister(BrooklynMementoPersister val,
PersistenceExceptionHandler exceptionHandler) |
void |
start()
Starts the appropriate background processes,
RebindManager.startPersistence() if ManagementNodeState.MASTER,
#startReadOnly() if ManagementNodeState.HOT_STANDBY or ManagementNodeState.HOT_BACKUP |
void |
startPersistence()
Starts the background persisting of state
(if persister is set; otherwise will start persisting as soon as persister is set).
|
void |
startReadOnly(ManagementNodeState mode)
Perform an initial load of state read-only and starts a background process
reading (mirroring) state periodically.
|
void |
stop()
Stops the appropriate background processes,
RebindManager.stopPersistence() or RebindManager.stopReadOnly(),
waiting for activity there to cease (interrupting in the case of RebindManager.stopReadOnly()). |
void |
stopPersistence()
Stops the background persistence of state.
|
void |
stopReadOnly()
Stops the background reading (mirroring) of state.
|
java.lang.String |
toString() |
void |
waitForPendingComplete(Duration timeout,
boolean canTrigger) |
public static final ConfigKey<RebindManager.RebindFailureMode> DANGLING_REFERENCE_FAILURE_MODE
public static final ConfigKey<RebindManager.RebindFailureMode> REBIND_FAILURE_MODE
public static final ConfigKey<RebindManager.RebindFailureMode> ADD_POLICY_FAILURE_MODE
public static final ConfigKey<RebindManager.RebindFailureMode> LOAD_POLICY_FAILURE_MODE
public static final ConfigKey<QuorumCheck> DANGLING_REFERENCES_MIN_REQUIRED_HEALTHY
public static final org.slf4j.Logger LOG
public RebindManagerImpl(ManagementContextInternal managementContext)
public ManagementContextInternal getManagementContext()
public void setPeriodicPersistPeriod(Duration period)
public void setPeriodicPersistPeriod(long periodMillis)
setPeriodicPersistPeriod(Duration)public boolean isPersistenceRunning()
public boolean isReadOnlyRunning()
public void setPersister(BrooklynMementoPersister val)
setPersister in interface RebindManagerpublic void setPersister(BrooklynMementoPersister val, PersistenceExceptionHandler exceptionHandler)
setPersister in interface RebindManagerpublic BrooklynMementoPersister getPersister()
getPersister in interface RebindManagerpublic void startPersistence()
RebindManagerstartPersistence in interface RebindManagerpublic void stopPersistence()
RebindManagerstopPersistence in interface RebindManagerpublic void startReadOnly(ManagementNodeState mode)
RebindManagerstartReadOnly in interface RebindManagerpublic void stopReadOnly()
RebindManagerstopReadOnly in interface RebindManagerpublic void start()
RebindManagerRebindManager.startPersistence() if ManagementNodeState.MASTER,
#startReadOnly() if ManagementNodeState.HOT_STANDBY or ManagementNodeState.HOT_BACKUPstart in interface RebindManagerpublic void stop()
RebindManagerRebindManager.stopPersistence() or RebindManager.stopReadOnly(),
waiting for activity there to cease (interrupting in the case of RebindManager.stopReadOnly()).stop in interface RebindManagerpublic void rebindPartialActive(CompoundTransformer transformer, java.util.Iterator<BrooklynObject> objectsToRebind)
public void rebindPartialActive(CompoundTransformer transformer, java.lang.String... objectsToRebindIds)
public void waitForPendingComplete(Duration timeout, boolean canTrigger) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException
waitForPendingComplete in interface RebindManagerjava.lang.InterruptedExceptionjava.util.concurrent.TimeoutExceptionpublic void forcePersistNow()
RebindManagerforcePersistNow in interface RebindManagerpublic void forcePersistNow(boolean full,
PersistenceExceptionHandler exceptionHandler)
RebindManagerNote that full persistence does *not* delete items; incremental should normally be sufficient. (A clear then full persistence would have the same effect, but that is risky in a production setting if the process fails after the clear!)
forcePersistNow in interface RebindManagerpublic ChangeListener getChangeListener()
getChangeListener in interface RebindManagerpublic java.util.List<Application> rebind()
rebind in interface RebindManagerpublic java.util.List<Application> rebind(java.lang.ClassLoader classLoader)
rebind in interface RebindManagerpublic java.util.List<Application> rebind(java.lang.ClassLoader classLoader, RebindExceptionHandler exceptionHandler)
rebind in interface RebindManagerpublic java.util.List<Application> rebind(java.lang.ClassLoader classLoaderO, RebindExceptionHandler exceptionHandlerO, ManagementNodeState modeO)
RebindManagerManagementNodeState.MASTER
or periodically for a node in ManagementNodeState.HOT_STANDBY or ManagementNodeState.HOT_BACKUP.rebind in interface RebindManagerpublic BrooklynMementoRawData retrieveMementoRawData()
retrieveMementoRawData in interface RebindManagerpublic boolean isAwaitingInitialRebind()
RebindManagerisAwaitingInitialRebind in interface RebindManagerpublic void setAwaitingInitialRebind(boolean isAwaitingInitialRebind)
public int getReadOnlyRebindCount()
public java.util.Map<java.lang.String,java.lang.Object> getMetrics()
RebindManagergetMetrics in interface RebindManagerpublic java.lang.String toString()
toString in class java.lang.Object