@ -51,6 +51,9 @@ public class ImplHandler {
private final AssetManager owner ;
private final AssetManager owner ;
private final ThreadLocal < AssetKey > parentAssetKey
= new ThreadLocal < AssetKey > ( ) ;
private final ArrayList < ImplThreadLocal > genericLocators =
private final ArrayList < ImplThreadLocal > genericLocators =
new ArrayList < ImplThreadLocal > ( ) ;
new ArrayList < ImplThreadLocal > ( ) ;
@ -103,6 +106,30 @@ public class ImplHandler {
}
}
}
}
/ * *
* Establishes the asset key that is used for tracking dependent assets
* that have failed to load . When set , the { @link DesktopAssetManager }
* gets a hint that it should suppress { @link AssetNotFoundException } s
* and instead call the listener callback ( if set ) .
*
* @param key The parent key
* /
public void establishParentKey ( AssetKey parentKey ) {
if ( parentAssetKey . get ( ) = = null ) {
parentAssetKey . set ( parentKey ) ;
}
}
public void releaseParentKey ( AssetKey parentKey ) {
if ( parentAssetKey . get ( ) = = parentKey ) {
parentAssetKey . set ( null ) ;
}
}
public AssetKey getParentKey ( ) {
return parentAssetKey . get ( ) ;
}
/ * *
/ * *
* Attempts to locate the given resource name .
* Attempts to locate the given resource name .
* @param name The full name of the resource .
* @param name The full name of the resource .
@ -111,7 +138,7 @@ public class ImplHandler {
* /
* /
public AssetInfo tryLocate ( AssetKey key ) {
public AssetInfo tryLocate ( AssetKey key ) {
synchronized ( genericLocators ) {
synchronized ( genericLocators ) {
if ( genericLocators . size ( ) = = 0 )
if ( genericLocators . isEmpty ( ) )
return null ;
return null ;
for ( ImplThreadLocal local : genericLocators ) {
for ( ImplThreadLocal local : genericLocators ) {