Class UpdateSuspender
A disposable class which allows nested suspend/resume operations on an ISuspendable target
Implements
Inherited Members
Namespace:
Assembly: .dll
Syntax
public final class UpdateSuspender extends DisposableBase implements IUpdateSuspender
Constructors
UpdateSuspender(ISuspendable target)
Initializes a new instance of the UpdateSuspender class.
Declaration
public UpdateSuspender(ISuspendable target)
Parameters
Type | Name | Description |
---|---|---|
ISuspendable | target | The target instance |
Methods
dispose()
Closes this instance and releases all allocated resources
Declaration
public void dispose()
getIsSuspended(ISuspendable target)
Gets a value indicating whether updates for this instance are currently suspended
Declaration
public static boolean getIsSuspended(ISuspendable target)
Parameters
Type | Name | Description |
---|---|---|
ISuspendable | target | Target to check |
Returns
Type | Description |
---|---|
boolean | True if target's updates are suspended |
getResumeTargetOnClose()
Gets a value indicating whether the target will resume when the IUpdateSuspender is disposed. Default is true
Declaration
public final boolean getResumeTargetOnClose()
Returns
Type | Description |
---|---|
boolean |
isSuspended()
Gets a value indicating whether updates for this instance are currently suspended
Declaration
public boolean isSuspended()
Returns
Type | Description |
---|---|
boolean |
setResumeTargetOnClose(boolean resumeTargetOnDispose)
Sets a value indicating whether the target will resume when the IUpdateSuspender is disposed. Default is true
Declaration
public final void setResumeTargetOnClose(boolean resumeTargetOnDispose)
Parameters
Type | Name | Description |
---|---|---|
boolean | resumeTargetOnDispose |
using(ISuspendable suspendable, Runnable runnable)
Helper method which suspend updates on target instance while runnable is executing
Declaration
public static void using(ISuspendable suspendable, Runnable runnable)
Parameters
Type | Name | Description |
---|---|---|
ISuspendable | suspendable | The ISuspendable which need to suspend before running runnable |
Runnable | runnable | The Runnable to run which target is suspended |
using(ISuspendableWithLock suspendable, Runnable runnable)
Helper method which suspend updates on target instance which also requires lock while runnable is executing
Declaration
public static void using(ISuspendableWithLock suspendable, Runnable runnable)
Parameters
Type | Name | Description |
---|---|---|
ISuspendableWithLock | suspendable | The ISuspendableWithLock which need to suspend and write lock before running runnable |
Runnable | runnable | The Runnable to run which target is suspended |