public final class UpdateSuspender extends DisposableBase implements IUpdateSuspender
ISuspendable
targetConstructor and Description |
---|
UpdateSuspender(ISuspendable target)
Initializes a new instance of the
UpdateSuspender class. |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Closes this instance and releases all allocated resources
|
static boolean |
getIsSuspended(ISuspendable target)
Gets a value indicating whether updates for this instance are currently suspended
|
boolean |
getResumeTargetOnClose()
Gets a value indicating whether the target will resume when the
IUpdateSuspender is disposed. |
boolean |
isSuspended()
Gets a value indicating whether updates for this instance are currently suspended
|
void |
setResumeTargetOnClose(boolean resumeTargetOnDispose)
Sets a value indicating whether the target will resume when the
IUpdateSuspender is disposed. |
static void |
using(ISuspendable suspendable,
java.lang.Runnable runnable)
Helper method which suspend updates on target instance while runnable is executing
|
close, tryDispose, tryDispose, tryDispose, tryDispose
public UpdateSuspender(ISuspendable target)
UpdateSuspender
class.target
- The target instancepublic static boolean getIsSuspended(ISuspendable target)
target
- Target to checkpublic final boolean getResumeTargetOnClose()
IUpdateSuspender
is disposed. Default is true
getResumeTargetOnClose
in interface IUpdateSuspender
ISuspendable.resumeUpdates(IUpdateSuspender)
after the IUpdateSuspender
is disposedpublic final void setResumeTargetOnClose(boolean resumeTargetOnDispose)
IUpdateSuspender
is disposed. Default is true
setResumeTargetOnClose
in interface IUpdateSuspender
resumeTargetOnDispose
- New resumeTargetOnDispose valuepublic boolean isSuspended()
isSuspended
in interface IUpdateSuspender
public void dispose()
dispose
in interface IDisposable
public static void using(ISuspendable suspendable, java.lang.Runnable runnable)
suspendable
- The ISuspendable
which need to suspend before running runnablerunnable
- The Runnable
to run which target is suspended