public class JNDIInitialContextPool extends ResourcePool
An InitialContext pool is useful in those cases when a connection to the JNDI service provider is expensive to establish. For example, if JNDI is used to connect to an LDAP directory service provider, creating an InitialContext automatically establishes a connection to the LDAP server, a potentially expensive operation. In such cases, using a JNDIInitialContextPool to manage connections to the JNDI service provider is analogous to using the JDBCConnectionPool for database access.
Note that any JNDI Context and NamingEnumeration objects obtained from an InitialContext share the InitialContext's connection to the service provider. Thus, after the InitialContext has been used and checked back in to the pool, one must be careful not to continue using any associated Context or NamingEnumeration objects.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
mBlocking, mCheckoutBlockTime, mCreatingResources, mCreationTimeLimit, mFreeResources, mHealthy, mMax, mMaxFree, mMaxPendingCreations, mMaxStartupAttempts, mMin, mPool, mResourceClassName, mStartupSleepTime, mUnusedPoolSlots
SERVICE_INFO_KEY
RESOURCE_BUNDLE, RSRC_blockTimeout, RSRC_ciCreateFailure, RSRC_ciForeignResource, RSRC_ciWrongResource, RSRC_coNonRunning, RSRC_creationLimit, RSRC_creationTimeout, RSRC_failedInitialPopulation, RSRC_hitPoolMax, RSRC_maxResourcePerThread, RSRC_maxThreads, RSRC_misconfiguration, RSRC_nestedCheckout, RSRC_nonOwningThread, RSRC_notImplemented, RSRC_poolDisabled, RSRC_startupFailure, RSRC_usingClosedConnection
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
JNDIInitialContextPool() |
Modifier and Type | Method and Description |
---|---|
ResourceObject |
checkOut(java.lang.String pCheckOutTag)
Checks a resource out of the pool.
|
java.lang.Object |
createResource()
Creates a new resource object for the pool.
|
void |
destroyResource(java.lang.Object pResource)
Destroys a resource object of this pool.
|
boolean |
getCreateDirContexts()
Returns true if the resource pool objects should be of type
InitialDirContext, false if InitialContext.
|
boolean |
getCreateMonitoredContexts()
Returns true if the resource pool InitialContext (or
InitialDirContext) objects should be wrapped in MonitoredContext
(or MonitoredDirContext) objects, false otherwise.
|
java.util.Hashtable |
getJNDIEnvironment()
Returns a JNDI environment which can be used to construct an
instance of InitialContext (or InitialDirContext).
|
java.lang.Object |
lookupUsingPool(java.lang.String pCallerName,
java.lang.String pName)
Lookup the name using the pool, if possible.
|
void |
setCreateDirContexts(boolean pCreateDirContexts)
Sets whether the resource pool objects should be of type
InitialDirContext (true) or InitialContext (false).
|
void |
setCreateMonitoredContexts(boolean pCreateMonitoredContexts)
Sets whether the resource pool InitialContext (or
InitialDirContext) objects should be wrapped in MonitoredContext
(or MonitoredDirContext) objects.
|
void |
setJNDIEnvironment(java.util.Hashtable pJNDIEnvironment)
Sets the JNDI environment copies of which will be used to
construct instances of InitialContext (or InitialDirContext).
|
addAdminInfo, block, checkIn, createAdminServlet, doStartService, doStopService, finalize, getAverageResourceCreationTime, getBlocking, getCheckoutBlockTime, getCreationTimeLimit, getCurrentStack, getDebugConnections, getLastError, getMax, getMaxConcurrentResourcesPerThread, getMaxConcurrentThreads, getMaxFree, getMaxIdleAge, getMaxPendingCreations, getMaxResourceAge, getMaxResourcesPerThread, getMaxSimultaneousResourcesOut, getMaxThreadsWithResourcesOut, getMin, getNumCheckedOutResources, getNumFreeResources, getNumTotalResources, getResourceClassName, getStartupAttempts, getStartupFailureSleepTime, invalidateAllResources, isEnabled, isWarnOnNestedCheckouts, populateSlot, pruneFreeResources, reclaimResource, resetMaxConcurrentResourcesPerThread, resetMaxConcurrentThreads, resetMaxSimultaneousResourcesOut, setBlocking, setCheckoutBlockTime, setCreationTimeLimit, setDebugConnections, setLastError, setMax, setMaxFree, setMaxIdleAge, setMaxPendingCreations, setMaxResourceAge, setMaxResourcesPerThread, setMaxThreadsWithResourcesOut, setMin, setResourceClassName, setStartupAttempts, setStartupFailureSleepTime, setWarnOnNestedCheckouts, unblock, verifyResourceValidity
addLogListener, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public java.util.Hashtable getJNDIEnvironment()
public void setJNDIEnvironment(java.util.Hashtable pJNDIEnvironment)
public boolean getCreateDirContexts()
public void setCreateDirContexts(boolean pCreateDirContexts)
public boolean getCreateMonitoredContexts()
public void setCreateMonitoredContexts(boolean pCreateMonitoredContexts)
public java.lang.Object createResource() throws ResourcePoolException
createResource
in class ResourcePool
ResourcePoolException
- if there was a problem creating
the resourcepublic void destroyResource(java.lang.Object pResource)
destroyResource
in class ResourcePool
pResource
- the Object to destroypublic ResourceObject checkOut(java.lang.String pCheckOutTag) throws ResourcePoolException
checkOut
in class ResourcePool
ResourcePoolException
- if an error occurred during the
operationpublic java.lang.Object lookupUsingPool(java.lang.String pCallerName, java.lang.String pName) throws javax.naming.NamingException
javax.naming.NamingException