APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.naming.internal

public final Class FactoryEnumeration

extends Object
Class Inheritance
Imports
java.util.List, javax.naming.NamingException

The FactoryEnumeration is used for returning factory instances.
Authors
Rosanna Lee, Scott Seligman

Field Summary

Modifier and TypeField and Description
private List<NamedWeakReference<Object>>
private ClassLoader
private int

Constructor Summary

AccessConstructor and Description
pack-priv
FactoryEnumeration(List<NamedWeakReference<Object>>
A non-null list
factories
,
ClassLoader
The class loader of the list's contents This internal method is used with Thread Context Class Loader (TCCL), please don't expose this method as public.
loader
)

Records the input list and uses it directly to satisfy hasMore()/next() requests.

Method Summary

Modifier and TypeMethod and Description
public boolean
public Object
next()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

factoriesback to summary
private List<NamedWeakReference<Object>> factories
loaderback to summary
private ClassLoader loader
posnback to summary
private int posn

Constructor Detail

FactoryEnumerationback to summary
pack-priv FactoryEnumeration(List<NamedWeakReference<Object>> factories, ClassLoader loader)

Records the input list and uses it directly to satisfy hasMore()/next() requests. An alternative would have been to use an enumeration/iterator from the list, but we want to update the list so we keep the original list. The list initially contains Class objects. As each element is used, the Class object is replaced by an instance of the Class itself; eventually, the list contains only a list of factory instances and no more updates are required.

Both Class objects and factories are wrapped in weak references so as not to prevent GC of the class loader. Each weak reference is tagged with the factory's class name so the class can be reloaded if the reference is cleared.

Parameters
factories:List<NamedWeakReference<Object>>

A non-null list

loader:ClassLoader

The class loader of the list's contents This internal method is used with Thread Context Class Loader (TCCL), please don't expose this method as public.

Method Detail

hasMoreback to summary
public boolean hasMore()
nextback to summary
public Object next() throws NamingException