Interface AssetLatch
-
- All Known Implementing Classes:
AssetLatchImpl
public interface AssetLatch
Latch on an
Asset
to only allow theThreadState
instances proceed whenAsset
is ready.May be used as a
LinkedListSetEntry
in a list ofAssetLatch
instances for anAssetManager
.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FunctionState
awaitOnAsset(FunctionState function)
Flags for theFunctionState
(and more specifically theThreadState
of theFunctionState
) to wait until theAsset
is ready.void
failFunctions(java.lang.Throwable failure, boolean isPermanent)
Fails theFunctionState
instances waiting on thisAsset
.Asset
getAsset()
Obtains theAsset
for thisAssetLatch
.void
releaseFunctions(boolean isPermanent)
Releases theFunctionState
instances waiting on theAsset
.void
releaseFunctions(boolean isPermanent, FunctionState functionState)
Releases theFunctionState
instances waiting on theAsset
.
-
-
-
Method Detail
-
getAsset
Asset getAsset()
Obtains theAsset
for thisAssetLatch
.- Returns:
Asset
for thisAssetLatch
.
-
awaitOnAsset
FunctionState awaitOnAsset(FunctionState function)
Flags for the
FunctionState
(and more specifically theThreadState
of theFunctionState
) to wait until theAsset
is ready.This is typically because the
Asset
is doing some processing that theFunctionState
requires completed before proceeding.- Parameters:
function
-FunctionState
to be released when theAsset
is ready.- Returns:
- Optional
FunctionState
to execute to wait on theAsset
.
-
releaseFunctions
void releaseFunctions(boolean isPermanent)
Releases theFunctionState
instances waiting on theAsset
.- Parameters:
isPermanent
-true
indicates that allFunctionState
instances added to theAssetLatch
from now on are activated immediately. It is useful to flag anAssetLatch
in this state when theAsset
is no longer being used to stop aFunctionState
from waiting forever.
-
releaseFunctions
void releaseFunctions(boolean isPermanent, FunctionState functionState)
Releases theFunctionState
instances waiting on theAsset
.- Parameters:
isPermanent
-true
indicates that allFunctionState
instances added to theAssetLatch
from now on are activated immediately. It is useful to flag anAssetLatch
in this state when theAsset
is no longer being used to stop aFunctionState
from waiting forever.functionState
-FunctionState
to be executed first before each currently waitingFunctionState
.
-
failFunctions
void failFunctions(java.lang.Throwable failure, boolean isPermanent)
Fails theFunctionState
instances waiting on thisAsset
.- Parameters:
failure
- Failure to propagate to theThreadState
of theFunctionState
instances waiting on theAsset
.isPermanent
-true
indicates that allFunctionState
instances added to theAssetLatch
from now on are activated immediately with the input failure. It is useful to flag anAssetLatch
in this state when theAsset
is in a failed state that can not be recovered from.
-
-