Interface AssetLatch
-
- All Known Implementing Classes:
AssetLatchImpl
public interface AssetLatchLatch on an
Assetto only allow theThreadStateinstances proceed whenAssetis ready.May be used as a
LinkedListSetEntryin a list ofAssetLatchinstances for anAssetManager.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FunctionStateawaitOnAsset(FunctionState function)Flags for theFunctionState(and more specifically theThreadStateof theFunctionState) to wait until theAssetis ready.voidfailFunctions(java.lang.Throwable failure, boolean isPermanent)Fails theFunctionStateinstances waiting on thisAsset.AssetgetAsset()Obtains theAssetfor thisAssetLatch.voidreleaseFunctions(boolean isPermanent)Releases theFunctionStateinstances waiting on theAsset.voidreleaseFunctions(boolean isPermanent, FunctionState functionState)Releases theFunctionStateinstances waiting on theAsset.
-
-
-
Method Detail
-
getAsset
Asset getAsset()
Obtains theAssetfor thisAssetLatch.- Returns:
Assetfor thisAssetLatch.
-
awaitOnAsset
FunctionState awaitOnAsset(FunctionState function)
Flags for the
FunctionState(and more specifically theThreadStateof theFunctionState) to wait until theAssetis ready.This is typically because the
Assetis doing some processing that theFunctionStaterequires completed before proceeding.- Parameters:
function-FunctionStateto be released when theAssetis ready.- Returns:
- Optional
FunctionStateto execute to wait on theAsset.
-
releaseFunctions
void releaseFunctions(boolean isPermanent)
Releases theFunctionStateinstances waiting on theAsset.- Parameters:
isPermanent-trueindicates that allFunctionStateinstances added to theAssetLatchfrom now on are activated immediately. It is useful to flag anAssetLatchin this state when theAssetis no longer being used to stop aFunctionStatefrom waiting forever.
-
releaseFunctions
void releaseFunctions(boolean isPermanent, FunctionState functionState)Releases theFunctionStateinstances waiting on theAsset.- Parameters:
isPermanent-trueindicates that allFunctionStateinstances added to theAssetLatchfrom now on are activated immediately. It is useful to flag anAssetLatchin this state when theAssetis no longer being used to stop aFunctionStatefrom waiting forever.functionState-FunctionStateto be executed first before each currently waitingFunctionState.
-
failFunctions
void failFunctions(java.lang.Throwable failure, boolean isPermanent)Fails theFunctionStateinstances waiting on thisAsset.- Parameters:
failure- Failure to propagate to theThreadStateof theFunctionStateinstances waiting on theAsset.isPermanent-trueindicates that allFunctionStateinstances added to theAssetLatchfrom now on are activated immediately with the input failure. It is useful to flag anAssetLatchin this state when theAssetis in a failed state that can not be recovered from.
-
-