Class ConnectionCustomizer
- java.lang.Object
-
- org.eclipse.persistence.internal.databaseaccess.ConnectionCustomizer
-
- All Implemented Interfaces:
java.lang.Cloneable
public abstract class ConnectionCustomizer extends java.lang.Object implements java.lang.CloneablePUBLIC: The base class for connection customization. The extending class must not alter the attributes defined in this class. Consider implementing equals method on the extending class so that the two instances are consider equal if they apply exactly the same customizations. This allows to skip unnecessary work when overriding customizer defined by ServerSession by the one defined by ClientSession: in case the two customizers are equal the old (ServerSession's) customizer is kept. That may save considerable effort in internal connection pooling case: if both ServerSession and ClientSession have exactly the same proxy properties (that happens if ClientSession doesn't have any proxy properties at all and just "inherits" all the properties from its parent ServerSession) then without correct customizer equality check the proxy session opened by ServerSession would have been closed, only to be re-opened again by ClientSession customizer using exactly the same proxy properties (and then the same happens again when ClientSession releases connection).
-
-
Constructor Summary
Constructors Constructor Description ConnectionCustomizer(Accessor accessor, Session session)INTERNAL: Constructor accepts the accessor to which the customizer will be applied and the session that used for customization.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclear()INTERNAL: Clears customization from connection.static ConnectionCustomizercreateEmptyCustomizer(Session session)abstract voidcustomize()INTERNAL: Applies customization to connection.AccessorgetAccessor()INTERNAL:ConnectionCustomizergetPrevCustomizer()INTERNAL:SessiongetSession()INTERNAL:abstract booleanisActive()INTERNAL: Indicated whether the connection is currently customized.voidsetPrevCustomizer(ConnectionCustomizer prevCustomizer)INTERNAL:
-
-
-
Constructor Detail
-
ConnectionCustomizer
public ConnectionCustomizer(Accessor accessor, Session session)
INTERNAL: Constructor accepts the accessor to which the customizer will be applied and the session that used for customization. The accessor and the session couldn't be altered during the connector's lifetime, the only exception is of the new accessor by DatasourceAccessor.clone method.
-
-
Method Detail
-
getAccessor
public Accessor getAccessor()
INTERNAL:
-
getSession
public Session getSession()
INTERNAL:
-
getPrevCustomizer
public ConnectionCustomizer getPrevCustomizer()
INTERNAL:
-
setPrevCustomizer
public void setPrevCustomizer(ConnectionCustomizer prevCustomizer)
INTERNAL:
-
createEmptyCustomizer
public static ConnectionCustomizer createEmptyCustomizer(Session session)
-
customize
public abstract void customize()
INTERNAL: Applies customization to connection. Called only if connection is not already customized (isActive()==false). The method may throw SQLException wrapped into DatabaseException. isActive method called after this method should return true only in case the connection was actually customized.
-
isActive
public abstract boolean isActive()
INTERNAL: Indicated whether the connection is currently customized.
-
clear
public abstract void clear()
INTERNAL: Clears customization from connection. Called only if connection is customized (isActive()==true). If the method fails due to SQLException it should "eat" it (just like DatasourceAccessor.closeConnection method). isActive method called after this method should always return false.
-
-