public class URLConnectionFactory
extends java.lang.Object
implements javax.naming.spi.ObjectFactory
URLConnection
for a client.
The Connection Architecture instantiates this factory when a connection lookup is made. The Connection Architecture stores the Reference
instances which represent details for a connection such as the connection class, the factory that can create the connection, metadata information etc. When a look up is made the Connection Architecture instantiates this factory and calls the getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment)
to create an instance of the URLConnection
.
Every connection type has a ConnectionPool
of active connections at point of time in the system. The URLConnectionFactory is pool aware, when a request to create a new instance of the connection is received, the URLConnectionFactory contacts the pool to see if a URLConnection
instance corresponding to the Reference
instance is already available. If the connection is available, then the recycled instance of the connection is returned, else the factory proceeds to create a new URLConnection
instance and that is registered with the pool.
ConnectionPool.
, ObjectFactory
Constructor and Description |
---|
URLConnectionFactory()
Instantiate this URLConnection factory
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)
Creates an instance of
URLConnection using the location or reference information specified. |
public URLConnectionFactory()
public java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment) throws java.lang.Exception
URLConnection
using the location or reference information specified. Special requirements of this URLConnection
are supplied using environment. An example of such an environment property is user identity information.getObjectInstance
in interface javax.naming.spi.ObjectFactory
obj
- The possibly null object containing location or reference information that can be used in creating an object.name
- The name of this object relative to nameCtx, or null if no name is specified.nameCtx
- The context relative to which the name parameter is specified, or null if name is relative to the default initial context.environment
- The possibly null environment that is used in creating the object.URLConnection
created; null if an object cannot be created.{@link
- Exception} if an error was encountered while attempting to create the URLConnectionjava.lang.Exception