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 RebindManager
public void setPersister(BrooklynMementoPersister val, PersistenceExceptionHandler exceptionHandler)
setPersister
in interface RebindManager
public BrooklynMementoPersister getPersister()
getPersister
in interface RebindManager
public void startPersistence()
RebindManager
startPersistence
in interface RebindManager
public void stopPersistence()
RebindManager
stopPersistence
in interface RebindManager
public void startReadOnly(ManagementNodeState mode)
RebindManager
startReadOnly
in interface RebindManager
public void stopReadOnly()
RebindManager
stopReadOnly
in interface RebindManager
public void start()
RebindManager
RebindManager.startPersistence()
if ManagementNodeState.MASTER
,
#startReadOnly()
if ManagementNodeState.HOT_STANDBY
or ManagementNodeState.HOT_BACKUP
start
in interface RebindManager
public void stop()
RebindManager
RebindManager.stopPersistence()
or RebindManager.stopReadOnly()
,
waiting for activity there to cease (interrupting in the case of RebindManager.stopReadOnly()
).stop
in interface RebindManager
public 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 RebindManager
java.lang.InterruptedException
java.util.concurrent.TimeoutException
public void forcePersistNow()
RebindManager
forcePersistNow
in interface RebindManager
public void forcePersistNow(boolean full, PersistenceExceptionHandler exceptionHandler)
RebindManager
Note 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 RebindManager
public ChangeListener getChangeListener()
getChangeListener
in interface RebindManager
public java.util.List<Application> rebind()
rebind
in interface RebindManager
public java.util.List<Application> rebind(java.lang.ClassLoader classLoader)
rebind
in interface RebindManager
public java.util.List<Application> rebind(java.lang.ClassLoader classLoader, RebindExceptionHandler exceptionHandler)
rebind
in interface RebindManager
public java.util.List<Application> rebind(java.lang.ClassLoader classLoaderO, RebindExceptionHandler exceptionHandlerO, ManagementNodeState modeO)
RebindManager
ManagementNodeState.MASTER
or periodically for a node in ManagementNodeState.HOT_STANDBY
or ManagementNodeState.HOT_BACKUP
.rebind
in interface RebindManager
public BrooklynMementoRawData retrieveMementoRawData()
retrieveMementoRawData
in interface RebindManager
public boolean isAwaitingInitialRebind()
RebindManager
isAwaitingInitialRebind
in interface RebindManager
public void setAwaitingInitialRebind(boolean isAwaitingInitialRebind)
public int getReadOnlyRebindCount()
public java.util.Map<java.lang.String,java.lang.Object> getMetrics()
RebindManager
getMetrics
in interface RebindManager
public java.lang.String toString()
toString
in class java.lang.Object