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.
ServerSession#getDefaultConnectionPolicy(), ServerSession#acquireClientSession(ConnectionPolicy), ServerSession#acquireClientSession(ConnectionPolicy, Map), ClientSession#getConnectionPolicy()
| Modifier and Type | Class and Description |
|---|---|
| public static enum | ConnectionPolicy.ExclusiveMode
Default value Transactional causes creation of ClientSession, the other two values - ExclusiveIsolatedClientSession. |
| Modifier and Type | Field and Description |
|---|---|
| protected ConnectionPolicy. | 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 String | poolName
Name of the pool to be used. |
| protected Map | properties
This attribute will provide a mechanism by which customers will be able to pass connection information to events to enable further customization. |
| Access | Constructor and Description |
|---|---|
| public | ConnectionPolicy()
PUBLIC: A connection policy is used to define how the client session connection should be acquired. |
| public | ConnectionPolicy(String poolName)
PUBLIC: A connection policy is used to define how the client session connection should be acquired. |
| public | ConnectionPolicy(Login login)
PUBLIC: A connection policy is used to define how the client session connection should be acquired. |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| public void | dontUseLazyConnection()
PUBLIC: A lazy connection only acquires a physical connection when a transaction is started and releases the connection when the transaction completes. |
| public ConnectionPolicy. | |
| public Login | |
| public String | |
| public Map | getProperties()
ADVANCED: This method will return the collection of custom properties set on the Connection policy. |
| public Object | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public 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. |
| public boolean | |
| public boolean | |
| public Object | removeProperty(Object key)
PUBLIC: This method is used to remove a custom property from the Connection Policy. |
| public void | setExclusiveMode(ConnectionPolicy.
PUBLIC: Sets exclusive mode, if null is passed sets the default value. |
| public 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. |
| public void | |
| public void | |
| public void | setProperty(Object key, Object property)
PUBLIC: Use this method to set custom properties on the Connection Policy. |
| public String | toString()
Overrides java. |
| public void | useLazyConnection()
PUBLIC: A lazy connection only acquires a physical connection when a transaction is started and releases the connection when the transaction completes. |
| exclusiveMode | back to summary |
|---|---|
| protected ConnectionPolicy. 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. | |
| isLazy | back to summary |
|---|---|
| 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. After write/exclusive connection is acquired if isLazy is true and exclusiveMode is Transactional then it's held until transaction is committed or rolled back, otherwise until the client session is released. | |
| login | back to summary |
|---|---|
| protected Login login The login information used to create a JDBC connection or acquire one from an external pool/data-source. Typically this is constant within a single persistence unit but in some advanced usages users can customize connections for each client session. | |
| poolName | back to summary |
|---|---|
| protected String poolName Name of the pool to be used. If neither pool name nor login provided then default pool will be used. If no pool name is provided but there's a login then the login is used to create connection which the ClientSession will use. | |
| properties | back to summary |
|---|---|
| protected Map<K, V> properties This attribute will provide a mechanism by which customers will be able to pass connection information to events to enable further customization. | |
| ConnectionPolicy | back to summary |
|---|---|
| public ConnectionPolicy() PUBLIC: A connection policy is used to define how the client session connection should be acquired. | |
| ConnectionPolicy | back to summary |
|---|---|
| public ConnectionPolicy(String poolName) PUBLIC: A connection policy is used to define how the client session connection should be acquired. | |
| ConnectionPolicy | back to summary |
|---|---|
| public ConnectionPolicy(Login login) PUBLIC: A connection policy is used to define how the client session connection should be acquired. | |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. INTERNAL: Clone the query
| |
| dontUseLazyConnection | back to summary |
|---|---|
| public void dontUseLazyConnection() PUBLIC: A lazy connection only acquires a physical connection when a transaction is started and releases the connection when the transaction completes. | |
| getExclusiveMode | back to summary |
|---|---|
| public ConnectionPolicy. PUBLIC: Returns exclusive mode. | |
| getLogin | back to summary |
|---|---|
| public Login getLogin() PUBLIC: Return the login to use for this connection. Client sessions support using a separate user login for database modification. | |
| getPoolName | back to summary |
|---|---|
| public String getPoolName() PUBLIC: Return the pool name or null if not part of a pool. | |
| getProperties | back to summary |
|---|---|
| public Map ADVANCED: This method will return the collection of custom properties set on the Connection policy. Note that this will cause the lazy initialization of the HashMap. | |
| getProperty | back to summary |
|---|---|
| public Object getProperty(Object object) PUBLIC: Returns the property associated with the corresponding key. These properties will be available to connection events. | |
| hasLogin | back to summary |
|---|---|
| public boolean hasLogin() PUBLIC: Return if a login is used, only one of login and pool can be used. | |
| hasProperties | back to summary |
|---|---|
| public boolean hasProperties() PUBLIC: Returns true if properties are available on the Connection Policy | |
| isExclusive | back to summary |
|---|---|
| public boolean isExclusive() PUBLIC: Indicates whether ExclusiveIsolatedClientSession should be created. | |
| isExclusiveAlways | back to summary |
|---|---|
| public boolean isExclusiveAlways() PUBLIC: Indicates whether exclusiveMode is Always. | |
| isExclusiveIsolated | back to summary |
|---|---|
| public boolean isExclusiveIsolated() PUBLIC: Indicates whether exclusiveMode is Isolated. | |
| isLazy | back to summary |
|---|---|
| public 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. | |
| isPooled | back to summary |
|---|---|
| public boolean isPooled() INTERNAL: Return if part of a connection pool. | |
| isUserDefinedConnection | back to summary |
|---|---|
| public boolean isUserDefinedConnection() INTERNAL: Return if part of a connection pool. | |
| removeProperty | back to summary |
|---|---|
| public Object removeProperty(Object key) PUBLIC: This method is used to remove a custom property from the Connection Policy. This method will return the propery removed. If it was not found then null will be returned. | |
| setExclusiveMode | back to summary |
|---|---|
| public void setExclusiveMode(ConnectionPolicy. PUBLIC: Sets exclusive mode, if null is passed sets the default value. | |
| setIsLazy | back to summary |
|---|---|
| public 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. | |
| setLogin | back to summary |
|---|---|
| public void setLogin(Login login) PUBLIC: Set the login to use for this connection. Client sessions support using a separate user login for database modification. Pooled connections must use the pool's login and cannot define their own. | |
| setPoolName | back to summary |
|---|---|
| public void setPoolName(String poolName) PUBLIC: Set the pool name or null if not part of a pool. | |
| setProperty | back to summary |
|---|---|
| public void setProperty(Object key, Object property) PUBLIC: Use this method to set custom properties on the Connection Policy. These properties will be available from within connection events but have no effect on the connection directly. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. INTERNAL: return a string representation of this ConnectionPolicy
| |
| useLazyConnection | back to summary |
|---|---|
| public void useLazyConnection() PUBLIC: A lazy connection only acquires a physical connection when a transaction is started and releases the connection when the transaction completes. | |
ExclusiveConnectionMode
| Modifier and Type | Field and Description |
|---|---|
| public static final ConnectionPolicy. | |
| public static final ConnectionPolicy. | |
| public static final ConnectionPolicy. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ConnectionPolicy. | |
| public static ConnectionPolicy. |
| Always | back to summary |
|---|---|
| public static final ConnectionPolicy. | |
| Isolated | back to summary |
|---|---|
| public static final ConnectionPolicy. | |
| Transactional | back to summary |
|---|---|
| public static final ConnectionPolicy. | |
| ExclusiveMode | back to summary |
|---|---|
| private ExclusiveMode() | |
| valueOf | back to summary |
|---|---|
| public static ConnectionPolicy. | |
| values | back to summary |
|---|---|
| public static ConnectionPolicy. | |