public class ConnectionPolicy
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Purpose: Used to specify how a client session's should be allocated.
Description: The ConnectionPolicy is used to indicate how a client session will interact with the internal or external JDBC connection pool/data source. The default ConnectionPolicy is held on the ServerSession but this can be overridden for any specific client session when it is acquired.
Modifier and Type | Class and Description |
---|---|
static class |
ConnectionPolicy.ExclusiveMode
Default value Transactional causes creation of ClientSession,
the other two values - ExclusiveIsolatedClientSession.
|
Modifier and Type | Field and Description |
---|---|
protected ConnectionPolicy.ExclusiveMode |
exclusiveMode
This attribute is used by the ServerSession to determine if a client
session with an exclusive connection should be built and how the exclusive
connection should be used.
|
protected boolean |
isLazy
Determines if the write/exclusive connection is acquired only when first
requested (lazy, this is the default) or immediately when the client
session is acquired.
|
protected Login |
login
The login information used to create a JDBC connection or acquire one
from an external pool/data-source.
|
protected java.lang.String |
poolName
Name of the pool to be used.
|
protected java.util.Map |
properties
This attribute will provide a mechanism by which customers will be able
to pass connection information to events to enable further customization.
|
Constructor and Description |
---|
ConnectionPolicy()
PUBLIC:
A connection policy is used to define how the client session connection should be acquired.
|
ConnectionPolicy(Login login)
PUBLIC:
A connection policy is used to define how the client session connection should be acquired.
|
ConnectionPolicy(java.lang.String poolName)
PUBLIC:
A connection policy is used to define how the client session connection should be acquired.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
INTERNAL:
Clone the query
|
void |
dontUseLazyConnection()
PUBLIC:
A lazy connection only acquires a physical connection
when a transaction is started and releases the connection when the transaction completes.
|
ConnectionPolicy.ExclusiveMode |
getExclusiveMode()
PUBLIC:
Returns exclusive mode.
|
Login |
getLogin()
PUBLIC:
Return the login to use for this connection.
|
java.lang.String |
getPoolName()
PUBLIC:
Return the pool name or null if not part of a pool.
|
java.util.Map |
getProperties()
ADVANCED:
This method will return the collection of custom properties set on the Connection
policy.
|
java.lang.Object |
getProperty(java.lang.Object object)
PUBLIC:
Returns the property associated with the corresponding key.
|
boolean |
hasLogin()
PUBLIC:
Return if a login is used, only one of login and pool can be used.
|
boolean |
hasProperties()
PUBLIC:
Returns true if properties are available on the Connection Policy
|
boolean |
isExclusive()
PUBLIC:
Indicates whether ExclusiveIsolatedClientSession should be created.
|
boolean |
isExclusiveAlways()
PUBLIC:
Indicates whether exclusiveMode is Always.
|
boolean |
isExclusiveIsolated()
PUBLIC:
Indicates whether exclusiveMode is Isolated.
|
boolean |
isLazy()
PUBLIC:
Return if a lazy connection should be used, a lazy connection only acquire a physical connection
when a transaction is started and releases the connection when the transaction completes.
|
boolean |
isPooled()
INTERNAL:
Return if part of a connection pool.
|
boolean |
isUserDefinedConnection()
INTERNAL:
Return if part of a connection pool.
|
java.lang.Object |
removeProperty(java.lang.Object key)
PUBLIC:
This method is used to remove a custom property from the Connection Policy.
|
void |
setExclusiveMode(ConnectionPolicy.ExclusiveMode exclusiveMode)
PUBLIC:
Sets exclusive mode, if null is passed sets the default value.
|
void |
setIsLazy(boolean isLazy)
PUBLIC:
Set if a lazy connection should be used, a lazy connection only acquire a physical connection
when a transaction is started and releases the connection when the transaction completes.
|
void |
setLogin(Login login)
PUBLIC:
Set the login to use for this connection.
|
void |
setPoolName(java.lang.String poolName)
PUBLIC:
Set the pool name or null if not part of a pool.
|
void |
setProperty(java.lang.Object key,
java.lang.Object property)
PUBLIC:
Use this method to set custom properties on the Connection Policy.
|
void |
setShouldUseExclusiveConnection(boolean useExclusiveConnection)
Deprecated.
|
boolean |
shouldUseExclusiveConnection()
Deprecated.
|
java.lang.String |
toString()
INTERNAL:
return a string representation of this ConnectionPolicy
|
void |
useLazyConnection()
PUBLIC:
A lazy connection only acquires a physical connection
when a transaction is started and releases the connection when the transaction completes.
|
protected Login login
protected java.lang.String poolName
protected boolean isLazy
protected ConnectionPolicy.ExclusiveMode exclusiveMode
protected java.util.Map properties
public ConnectionPolicy()
public ConnectionPolicy(java.lang.String poolName)
public ConnectionPolicy(Login login)
public java.lang.Object clone()
clone
in class java.lang.Object
public void dontUseLazyConnection()
public Login getLogin()
public java.lang.String getPoolName()
public java.util.Map getProperties()
public java.lang.Object getProperty(java.lang.Object object)
public boolean hasLogin()
public boolean hasProperties()
public boolean isExclusiveIsolated()
public boolean isExclusiveAlways()
public boolean isExclusive()
public boolean isLazy()
public boolean isPooled()
public boolean isUserDefinedConnection()
public java.lang.Object removeProperty(java.lang.Object key)
public void setIsLazy(boolean isLazy)
public void setLogin(Login login)
public void setPoolName(java.lang.String poolName)
public void setProperty(java.lang.Object key, java.lang.Object property)
public ConnectionPolicy.ExclusiveMode getExclusiveMode()
public void setExclusiveMode(ConnectionPolicy.ExclusiveMode exclusiveMode)
public void setShouldUseExclusiveConnection(boolean useExclusiveConnection)
public boolean shouldUseExclusiveConnection()
public java.lang.String toString()
toString
in class java.lang.Object
public void useLazyConnection()