Tabnine Logo
GenericObjectPool.setFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
setFactory
method
in
org.apache.commons.pool.impl.GenericObjectPool

Best Java code snippets using org.apache.commons.pool.impl.GenericObjectPool.setFactory (Showing top 3 results out of 315)

origin: org.apache.directory.client.ldap/ldap-client-api

/**
 * {@inheritDoc}
 */
public void setFactory( PoolableLdapConnectionFactory factory )
{
  this.factory = factory;
  super.setFactory( factory );
}
origin: uk.org.mygrid.resources/boca-model

private void setupPool(GenericObjectPool pool, RepositoryConnectionFactory factory, int maxActive, int maxIdle, long blockWait) {
  pool.setFactory(factory);
  pool.setMaxActive(maxActive);
  pool.setMaxIdle(maxIdle);
  pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
  pool.setMaxWait(blockWait);
}
origin: shunyang/thrift-all

@Override
public void afterPropertiesSet() throws Exception {
  // 对象池
  objectPool = new GenericObjectPool<TTransport>();
  //
  ((GenericObjectPool<TTransport>) objectPool).setMaxActive(maxActive);
  ((GenericObjectPool<TTransport>) objectPool).setMaxIdle(maxIdle);
  ((GenericObjectPool<TTransport>) objectPool).setMinIdle(minIdle);
  ((GenericObjectPool<TTransport>) objectPool).setMaxWait(maxWait);
  ((GenericObjectPool<TTransport>) objectPool).setTestOnBorrow(testOnBorrow);
  ((GenericObjectPool<TTransport>) objectPool).setTestOnReturn(testOnReturn);
  ((GenericObjectPool<TTransport>) objectPool).setTestWhileIdle(testWhileIdle);
  ((GenericObjectPool<TTransport>) objectPool).setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
  // 设置factory
  ThriftPoolableObjectFactory thriftPoolableObjectFactory = new ThriftPoolableObjectFactory(serviceIP, servicePort, conTimeOut);
  ((GenericObjectPool<TTransport>) objectPool).setFactory(thriftPoolableObjectFactory);
}
org.apache.commons.pool.implGenericObjectPoolsetFactory

Javadoc

Sets the PoolableObjectFactory this pool uses to create new instances. Trying to change the factory while there are borrowed objects will throw an IllegalStateException.

Popular methods of GenericObjectPool

  • <init>
    Create a new GenericObjectPool using the specified values.
  • returnObject
    Returns an object instance to the pool. If #getMaxIdle() is set to a positive value and the number
  • borrowObject
    Borrows an object from the pool. If there is an idle instance available in the pool, then either th
  • setMaxActive
    Sets the cap on the number of objects that can be allocated by the pool (checked out to clients, or
  • close
    Closes the pool. Once the pool is closed, #borrowObject()will fail with IllegalStateException, but #
  • setMaxIdle
    Sets the cap on the number of "idle" instances in the pool. If maxIdle is set too low on heavily loa
  • setMinIdle
    Sets the minimum number of objects allowed in the pool before the evictor thread (if active) spawns
  • setTimeBetweenEvictionRunsMillis
    Sets the number of milliseconds to sleep between runs of the idle object evictor thread. When non-po
  • setMinEvictableIdleTimeMillis
    Sets the minimum amount of time an object may sit idle in the pool before it is eligible for evictio
  • setMaxWait
    Sets the maximum amount of time (in milliseconds) the #borrowObject method should block before throw
  • setTestOnBorrow
    When true, objects will be PoolableObjectFactory#validateObjectbefore being returned by the #borrowO
  • setWhenExhaustedAction
    Sets the action to take when the #borrowObject method is invoked when the pool is exhausted (the max
  • setTestOnBorrow,
  • setWhenExhaustedAction,
  • getNumActive,
  • getNumIdle,
  • setTestWhileIdle,
  • setNumTestsPerEvictionRun,
  • setTestOnReturn,
  • invalidateObject,
  • clear,
  • addObject

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • getSupportFragmentManager (FragmentActivity)
  • requestLocationUpdates (LocationManager)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Notification (javax.management)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now