|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.makumba.commons.NamedResources
public class NamedResources
An instance of this class holds a cache of resources. If a resource is requested but is not present, it is produced using the associated NamedResourceFactory, in a thread-safe way
NamedResourceFactory
,
Serialized FormField Summary | |
---|---|
(package private) static Vector<WeakReference<NamedResources>> |
allCaches
|
(package private) NamedResourceFactory |
f
|
(package private) int |
hits
|
(package private) int |
misses
|
(package private) String |
name
|
(package private) static boolean |
soft_static_caches
|
(package private) static List<NamedResources> |
staticCaches
|
(package private) Map |
values
|
Constructor Summary | |
---|---|
NamedResources(String name,
NamedResourceFactory f)
Initializes using the given factory |
Method Summary | |
---|---|
static void |
cleanStaticCache(int n)
Cleans the given cache. |
static void |
cleanStaticCache(String name)
|
static void |
cleanup()
Cleans-up all the static and soft caches |
static void |
cleanupStaticCache(String cacheName)
Cleans the cache with the specified name |
static void |
cleanupStaticCaches()
Clean all static caches, so their content will be re-initialized when needed. |
void |
close()
Closes each contained object by calling its close() method, if any, then de-references all contained objects so they can be garbage collected. |
(package private) void |
closeContent()
Closes each contained object by calling its close() method, if any |
static ArrayList<String> |
getActiveCacheNames()
Returns the names of the currently used caches |
static Map<String,int[]> |
getCacheInfo()
Wraps information about the cache into a Map |
String |
getName()
|
protected NameValue |
getNameValue(Object name,
Object hash)
|
Object |
getResource(Object name)
Gets a specific resource. |
static NamedResources |
getStaticCache(int n)
Gets the static cache identified by n |
Object |
getSupplementary()
Whatever supplementary stuff the factory wants to keep |
boolean |
knowResource(Object name)
Checks if a resource is known |
static int |
makeStaticCache(String name,
NamedResourceFactory fact)
Creates a static cache |
static int |
makeStaticCache(String name,
NamedResourceFactory fact,
boolean soft)
Creates a static cache |
int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static boolean soft_static_caches
NamedResourceFactory f
String name
Map values
int hits
int misses
static List<NamedResources> staticCaches
static Vector<WeakReference<NamedResources>> allCaches
Constructor Detail |
---|
public NamedResources(String name, NamedResourceFactory f)
name
- the name of the NamedResources object to initalisef
- the NamedResourceFactory
used to construct the NamedResourceMethod Detail |
---|
public static void cleanup()
public static void cleanupStaticCaches()
public static void cleanupStaticCache(String cacheName)
public static ArrayList<String> getActiveCacheNames()
public static int makeStaticCache(String name, NamedResourceFactory fact, boolean soft)
name
- the name of the cachefact
- the NamedResourceFactory
used to create the cachesoft
- true
if this should be a soft cache
public static int makeStaticCache(String name, NamedResourceFactory fact)
name
- the name of the cachefact
- the NamdedResourceFactory used to create the cache
public static NamedResources getStaticCache(int n)
n
- the index of the cached object in the cache
public static void cleanStaticCache(int n)
n
- the index of the cache to be cleanedpublic static void cleanStaticCache(String name)
public static Map<String,int[]> getCacheInfo()
public boolean knowResource(Object name)
name
- the name of the resource to be checked
true
if the resource is known, false
otherwisepublic Object getSupplementary()
public Object getResource(Object name)
name
- the name of the resource to get
protected NameValue getNameValue(Object name, Object hash)
public int size()
public String getName()
void closeContent()
public void close()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |