From c6317cc5315f4f9da99ea50239b9f26bdce82750 Mon Sep 17 00:00:00 2001 From: shadowislord Date: Sat, 28 Feb 2015 16:38:11 -0500 Subject: [PATCH] com.jme3.asset.cache: javadoc fixes --- .../jme3/asset/cache/WeakRefAssetCache.java | 5 ---- .../asset/cache/WeakRefCloneAssetCache.java | 2 +- .../java/com/jme3/asset/cache/package.html | 30 +++++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 jme3-core/src/main/java/com/jme3/asset/cache/package.html diff --git a/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java b/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java index 672412870..42f73f4a5 100644 --- a/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java +++ b/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefAssetCache.java @@ -77,7 +77,6 @@ public class WeakRefAssetCache implements AssetCache { // might not even have this asset anymore, it is OK. if (assetCache.remove(ref.assetKey) != null){ removedAssets ++; - //System.out.println("WeakRefAssetCache: The asset " + ref.assetKey + " was purged from the cache"); } } if (removedAssets >= 1) { @@ -92,10 +91,6 @@ public class WeakRefAssetCache implements AssetCache { // thread is loading an asset with the same key .. AssetRef ref = new AssetRef(key, obj, refQueue); assetCache.put(key, ref); - -// Texture t = (Texture) obj; -// Image i = t.getImage(); -// System.out.println("add to cache " + System.identityHashCode(i)); } public T getFromCache(AssetKey key) { diff --git a/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java b/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java index 46ddfd199..e3566d22c 100644 --- a/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java +++ b/jme3-core/src/main/java/com/jme3/asset/cache/WeakRefCloneAssetCache.java @@ -42,7 +42,7 @@ import java.util.logging.Level; import java.util.logging.Logger; /** - * caches cloneable assets in a weak-key + * WeakRefCloneAssetCache caches cloneable assets in a weak-key * cache, allowing them to be collected when memory is low. * The cache stores weak references to the asset keys, so that * when all clones of the original asset are collected, will cause the diff --git a/jme3-core/src/main/java/com/jme3/asset/cache/package.html b/jme3-core/src/main/java/com/jme3/asset/cache/package.html new file mode 100644 index 000000000..4aca0c878 --- /dev/null +++ b/jme3-core/src/main/java/com/jme3/asset/cache/package.html @@ -0,0 +1,30 @@ + + + + + + + + + +com.jme3.asset.cache contains the {@link com.jme3.asset.cache.AssetCache} +interface as well as its implementations.
+ +

+ +

AssetCaches

+The asset cache implementations are used by {@link com.jme3.asset.AssetManager} +to cache loaded assets for faster access if they are requested again. +

+Assets in jME3 are cached in such a way that if there are no instances of +that asset anymore in memory, then jME3 is likely to reclaim them. +Some asset types must be cloned prior to being used, for example, 3D models +cannot be stored in the cache as-is, because the user is likely to modify them +after loading them. To handle this, a copy of the asset is stored in the +cache instead. The asset cache that implements these rules is the +{@link com.jme3.asset.cache.WeakRefCloneAssetCache} and it is used +for caching most asset types. + + + +