public abstract class AuthClientFactory extends Object
AuthenticationClient
s.Constructor and Description |
---|
AuthClientFactory() |
Modifier and Type | Method and Description |
---|---|
static AuthClientFactory |
build(String host,
int port,
int timeout,
boolean clientAuth,
String keyStore,
String keyPass,
String trustStore,
String trustPass,
int maxActive,
int maxIdle,
long timeBetweenEvictionRunsMillis,
long minEvictableIdleTimeMillis,
String adminToken)
Builds an AuthClientFactory singleton instance.
|
static void |
destroy()
Destroy the previously built factory.
|
void |
discard(AuthenticationClient client)
Call this if the client is unusable, i.e.
|
AuthenticationClient |
getClient()
Get a client.
|
static AuthClientFactory |
instance()
Get the previously created instance.
|
protected abstract org.apache.commons.pool.PoolableObjectFactory |
objectFactory()
Returns an implementation-specific object factory so we can do object
pooling.
|
void |
recycle(AuthenticationClient client)
Recycle the client for next usage.
|
protected void |
shutdown()
Shut down this factory.
|
public static AuthClientFactory build(String host, int port, int timeout, boolean clientAuth, String keyStore, String keyPass, String trustStore, String trustPass, int maxActive, int maxIdle, long timeBetweenEvictionRunsMillis, long minEvictableIdleTimeMillis, String adminToken)
host
- Auth hostport
- Auth porttimeout
- Auth connection timeoutclientAuth
- 2-way SSL (if false, 1-way SSL is used)keyStore
- KeystorekeyPass
- Keystore passwordtrustStore
- TruststoretrustPass
- Truststore passwordmaxActive
- Maximum number of objects that can be allocated by the
pool (checked out to clients, or idle awaiting checkout) at a
given time. When non-positive, there is no limit to the number
of objects that can be managed by the pool at one time. When
maxActive is reached, the pool is said to be exhausted. The
default setting for this parameter is 8.maxIdle
- Maximum number of objects that can sit idle in the pool
at any time. When negative, there is no limit to the number of
objects that may be idle at one time. The default setting for
this parameter is 8.timeBetweenEvictionRunsMillis
- How long the eviction thread
should sleep before "runs" of examining idle objects. When
non-positive, no eviction thread will be launched. The default
setting for this parameter is -1 (i.e., idle object eviction is
disabled by default).minEvictableIdleTimeMillis
- Minimum amount of time that an object
may sit idle in the pool before it is eligible for eviction due
to idle time. When non-positive, no object will be dropped from
the pool due to idle time alone. This setting has no effect
unless timeBetweenEvictionRunsMillis > 0. The default setting
for this parameter is 30 minutes.adminToken
- Admin token for use with Keystone.public static AuthClientFactory instance()
protected abstract org.apache.commons.pool.PoolableObjectFactory objectFactory()
public AuthenticationClient getClient()
recycle(AuthenticationClient)
after you
are done using it, successfully or not.KeystoneConnectionException
- if a client cannot be borrowedpublic void recycle(AuthenticationClient client)
client
- client to recycleKeystoneConnectionException
- if a client cannot be recycledpublic void discard(AuthenticationClient client)
client
- client to discardKeystoneConnectionException
- if a client cannot be discardedprotected void shutdown()
KeystoneConnectionException
- if the factory cannot be shutdownpublic static void destroy()
Copyright © 2016. All Rights Reserved.