code
stringlengths
23
201k
docstring
stringlengths
17
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
72
path
stringlengths
11
317
url
stringlengths
57
377
license
stringclasses
7 values
public void setMaxLifeTime(int maxLifeTime) { this.maxLifeTime = maxLifeTime; }
Define the maximum lifetime (in seconds) that a connection can stay in the pool before getting closed. @param maxLifeTime the maximum lifetime (in seconds) that a connection can stay in the pool before getting closed.
setMaxLifeTime
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public int getAcquireIncrement() { return acquireIncrement; }
@return the amount of connections to be created at once when the pool needs to grow.
getAcquireIncrement
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setAcquireIncrement(int acquireIncrement) { this.acquireIncrement = acquireIncrement; }
Define the amount of connections to be created at once when the pool needs to grow. @param acquireIncrement the amount of connections to be created at once when the pool needs to grow.
setAcquireIncrement
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public int getAcquisitionTimeout() { return acquisitionTimeout; }
@return the amount of time in seconds a call to get a connection from the pool will wait when the pool is empty.
getAcquisitionTimeout
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setAcquisitionTimeout(int acquisitionTimeout) { this.acquisitionTimeout = acquisitionTimeout; }
Define the amount of time in seconds a call to get a connection from the pool will wait when the pool is empty. @param acquisitionTimeout the amount of time in seconds.
setAcquisitionTimeout
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public boolean getDeferConnectionRelease() { return deferConnectionRelease; }
@return false only if the database can run many transactions on the same connection.
getDeferConnectionRelease
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setDeferConnectionRelease(boolean deferConnectionRelease) { this.deferConnectionRelease = deferConnectionRelease; }
Define the transaction interleaving capability of the database. Should be true only if the database can run many transactions on the same connection. @param deferConnectionRelease false only if the database can run many transactions on the same connection.
setDeferConnectionRelease
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public int getAcquisitionInterval() { return acquisitionInterval; }
@return the amount of time between failed connection acquirements.
getAcquisitionInterval
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setAcquisitionInterval(int acquisitionInterval) { this.acquisitionInterval = acquisitionInterval; }
Set the amount of time in seconds the pool will wait before trying to acquire a connection again after an invalid connection has been attempted to be acquired. @param acquisitionInterval amount of time in seconds.
setAcquisitionInterval
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public boolean getAllowLocalTransactions() { return allowLocalTransactions; }
@return true if the transaction manager should allow mixing XA and non-XA transactions.
getAllowLocalTransactions
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setAllowLocalTransactions(boolean allowLocalTransactions) { this.allowLocalTransactions = allowLocalTransactions; }
Set if the transaction manager should allow mixing XA and non-XA transactions. If you know all your transactions should be executed within global (ie: XA) scope it is a good idea to set this property to false. @param allowLocalTransactions if the transaction manager should allow mixing XA and non-XA transactions.
setAllowLocalTransactions
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public boolean getApplyTransactionTimeout() { return applyTransactionTimeout; }
@return true if the transaction-timeout should be set on the XAResource.
getApplyTransactionTimeout
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setApplyTransactionTimeout(boolean applyTransactionTimeout) { this.applyTransactionTimeout = applyTransactionTimeout; }
Set if the transaction-timeout should be set on the XAResource when the XAResource is enlisted. @param applyTransactionTimeout true if the transaction-timeout should be set.
setApplyTransactionTimeout
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setShareTransactionConnections(boolean shareAccessibleConnections) { this.shareTransactionConnections = shareAccessibleConnections; }
Set whether connections in the ACCESSIBLE state can be shared within the context of a transaction. @param shareAccessibleConnections the shareAccessibleConnections to set.
setShareTransactionConnections
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public boolean getShareTransactionConnections() { return shareTransactionConnections; }
@return true if accessible connections can be shared.
getShareTransactionConnections
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setIgnoreRecoveryFailures(boolean ignoreRecoveryFailures) { this.ignoreRecoveryFailures = ignoreRecoveryFailures; }
Set whether XA recovery errors should quarantine the resource or be ignored. @param ignoreRecoveryFailures true if recovery errors should be ignored, false otherwise.
setIgnoreRecoveryFailures
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public boolean getIgnoreRecoveryFailures() { return ignoreRecoveryFailures; }
@return true if recovery errors should be ignored, false otherwise.
getIgnoreRecoveryFailures
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public void setDisabled(boolean disabled) { this.disabled = disabled; }
Set whether this resource is disabled, meaning it's temporarily forbidden to acquire a connection from its pool. @param disabled true to disable the resource, false to enable it.
setDisabled
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public boolean isDisabled() { return disabled; }
@return true if the resource is disabled, false if it is enabled.
isDisabled
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public int incCreatedResourcesCounter() { return this.createdResourcesCounter++; }
Increment a transient counter. This is used for assigning per-resource numbers to connections. @return the current value of the counter.
incCreatedResourcesCounter
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/ResourceBean.java
Apache-2.0
public static void enlistInCurrentTransaction(XAResourceHolder<? extends XAResourceHolder> xaResourceHolder) throws SystemException, RollbackException { BitronixTransaction currentTransaction = currentTransaction(); ResourceBean bean = xaResourceHolder.getResourceBean(); if (log.isDebugEnabled()...
Enlist the {@link XAResourceHolder} in the current transaction or do nothing if there is no global transaction context for this thread. @param xaResourceHolder the {@link XAResourceHolder} to enlist. @throws SystemException if an internal error happens. @throws RollbackException if the current transaction has been mark...
enlistInCurrentTransaction
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
public static void delistFromCurrentTransaction(XAResourceHolder<? extends XAResourceHolder> xaResourceHolder) throws SystemException { final BitronixTransaction currentTransaction = currentTransaction(); ResourceBean bean = xaResourceHolder.getResourceBean(); if (log.isDebugEnabled()) { log.deb...
Delist the {@link XAResourceHolder} from the current transaction or do nothing if there is no global transaction context for this thread. @param xaResourceHolder the {@link XAResourceHolder} to delist. @throws SystemException if an internal error happens.
delistFromCurrentTransaction
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
@Override public boolean visit(XAResourceHolderState xaResourceHolderState) { if (!xaResourceHolderState.isEnded()) { if (log.isDebugEnabled()) { log.debug("delisting resource " + xaResourceHolderState + " from " + currentTransaction); } ...
Delist the {@link XAResourceHolder} from the current transaction or do nothing if there is no global transaction context for this thread. @param xaResourceHolder the {@link XAResourceHolder} to delist. @throws SystemException if an internal error happens.
visit
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
public static BitronixTransaction currentTransaction() { if (!TransactionManagerServices.isTransactionManagerRunning()) return null; return TransactionManagerServices.getTransactionManager().getCurrentTransaction(); }
Get the transaction running on the current thead context. @return null if there is no transaction on the current context or if the transaction manager is not running.
currentTransaction
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
public static void requeue(XAStatefulHolder<? extends XAStatefulHolder> xaStatefulHolder, ResourceBean bean) throws BitronixSystemException { BitronixTransaction currentTransaction = currentTransaction(); if (log.isDebugEnabled()) { log.debug("requeuing " + xaStatefulHolder + " from " + currentTransacti...
Switch the {@link XAStatefulHolder}'s state appropriately after the acquired resource handle has been closed. The pooled resource will either be marked as closed or not accessible, depending on the value of the bean's <code>deferConnectionRelease</code> property and will be marked for release after 2PC execution in the...
requeue
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
public static void recycle(XAStatefulHolder<? extends XAStatefulHolder> xaStatefulHolder) { BitronixTransaction currentTransaction = currentTransaction(); if (log.isDebugEnabled()) { log.debug("marking " + xaStatefulHolder + " as recycled in " + currentTransaction); } Scheduler<Synchronization> ...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
recycle
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
private static boolean isAlreadyRegisteredForDeferredRelease(XAStatefulHolder<? extends XAStatefulHolder> xaStatefulHolder, BitronixTransaction currentTransaction) { boolean alreadyDeferred = findDeferredRelease(xaStatefulHolder, currentTransaction) != null; if (log.isDebugEnabled()) { log.debug(xaState...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
isAlreadyRegisteredForDeferredRelease
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
private static DeferredReleaseSynchronization findDeferredRelease(XAStatefulHolder<? extends XAStatefulHolder> xaStatefulHolder, BitronixTransaction currentTransaction) { Scheduler<Synchronization> synchronizationScheduler = currentTransaction.getSynchronizationScheduler(); for (Synchronization synchro...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
findDeferredRelease
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
private static boolean isEnlistedInSomeTransaction(XAResourceHolder<? extends XAResourceHolder> xaResourceHolder) throws BitronixSystemException { if (log.isDebugEnabled()) { log.debug("looking in in-flight transactions for XAResourceHolderState of " + xaResourceHolder); } if (!TransactionManagerServic...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
isEnlistedInSomeTransaction
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
private static boolean isEnlistedInSomeTransaction(XAStatefulHolder<? extends XAStatefulHolder> xaStatefulHolder) throws BitronixSystemException { List<? extends XAResourceHolder<? extends XAResourceHolder>> xaResourceHolders = xaStatefulHolder.getXAResourceHolders(); if (xaResourceHolders == null || xa...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
isEnlistedInSomeTransaction
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
private static boolean isInEnlistingGlobalTransactionContext(XAResourceHolder<? extends XAResourceHolder> xaResourceHolder, BitronixTransaction currentTransaction) { boolean globalTransactionMode = false; if (currentTransaction != null && xaResourceHolder.isExistXAResourceHolderStatesForGtrid(currentTra...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
isInEnlistingGlobalTransactionContext
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
private static boolean isInEnlistingGlobalTransactionContext(XAStatefulHolder<? extends XAStatefulHolder> xaStatefulHolder, BitronixTransaction currentTransaction) { List<? extends XAResourceHolder<? extends XAResourceHolder>> xaResourceHolders = xaStatefulHolder.getXAResourceHolders(); if (xaResourceHo...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
isInEnlistingGlobalTransactionContext
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
private static XAResourceHolderState getLatestAlreadyEnlistedXAResourceHolderState(XAResourceHolder xaResourceHolder, final BitronixTransaction currentTransaction) { if (currentTransaction == null) return null; class LocalVisitor implements XAResourceHolderStateVisitor { private...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
getLatestAlreadyEnlistedXAResourceHolderState
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
@Override public boolean visit(XAResourceHolderState xaResourceHolderState) { if (xaResourceHolderState != null && xaResourceHolderState.getXid() != null) { BitronixXid bitronixXid = xaResourceHolderState.getXid(); Uid resourceGtrid = bitronixXid.getGl...
Ensure the {@link XAStatefulHolder}'s release won't be deferred anymore (when appropriate) as it has been recycled. @param xaStatefulHolder the recycled {@link XAStatefulHolder}.
visit
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/TransactionContextHelper.java
Apache-2.0
private void init() throws Exception { growUntilMinPoolSize(); if (bean.getMaxIdleTime() > 0 || bean.getMaxLifeTime() > 0) { TransactionManagerServices.getTaskScheduler().schedulePoolShrinking(this); } }
This map is used to implement the connection sharing feature of Bitronix.
init
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public void close() { synchronized (poolGrowthShrinkLock) { if (log.isDebugEnabled()) { log.debug("closing all connections of " + this); } for (T xaStatefulHolder : getXAResourceHolders()) { try { xaStatefulHolder.close(); } catch (Exc...
Close down and cleanup this XAPool instance.
close
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public Object getConnectionHandle() throws Exception { return getConnectionHandle(true); }
Get a connection handle from this pool. @return a connection handle @throws Exception throw in the pool is unrecoverable or a timeout occurs getting a connection
getConnectionHandle
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public Object getConnectionHandle(boolean recycle) throws Exception { synchronized (poolGrowthShrinkLock) { if (isFailed()) { reinitializePool(); } } long remainingTimeMs = TimeUnit.SECONDS.toMillis(bean.getAcquisitionTimeout()); while (true) { ...
Get a connection handle from this pool. @param recycle true if we should try to get a connection in the NON_ACCESSIBLE pool in the same transaction @return a connection handle @throws Exception throw in the pool is unrecoverable or a timeout occurs getting a connection
getConnectionHandle
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
@Override public void stateChanging(T source, State currentState, State futureState) { stateTransitionLock.writeLock().lock(); try { switch (currentState) { case IN_POOL: // no-op. calling availablePool.remove(source) here is reduncant because it was ...
Get a connection handle from this pool. @param recycle true if we should try to get a connection in the NON_ACCESSIBLE pool in the same transaction @return a connection handle @throws Exception throw in the pool is unrecoverable or a timeout occurs getting a connection
stateChanging
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
@Override public void stateChanged(T source, State oldState, State newState) { stateTransitionLock.writeLock().lock(); try { switch (newState) { case IN_POOL: if (log.isDebugEnabled()) { log.debug("added " + source + " to the available pool"); } avai...
Get a connection handle from this pool. @param recycle true if we should try to get a connection in the NON_ACCESSIBLE pool in the same transaction @return a connection handle @throws Exception throw in the pool is unrecoverable or a timeout occurs getting a connection
stateChanged
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private T getInPool(long remainingTimeMs) throws Exception { if (inPoolSize() == 0) { if (log.isDebugEnabled()) { log.debug("no more free connections in " + this + ", trying to grow it"); } grow(); } if (log.isDebugEnabled()) { log.debug("getting IN_POOL connection from ...
Get an IN_POOL connection. This method blocks for up to remainingTimeMs milliseconds for someone to return or create a connection in the available pool. If remainingTimeMs expires, an exception is thrown. It does not use stateTransitionLock.readLock() because the availablePool [a LinkedBlockingQueue] is already thre...
getInPool
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private T getNotAccessible() { if (log.isDebugEnabled()) { log.debug("trying to recycle a NOT_ACCESSIBLE connection of " + this); } BitronixTransaction transaction = TransactionContextHelper.currentTransaction(); if (transaction == null) { if (log.isDebugEnabled()) { log.debug("no cu...
Get a XAStatefulHolder (connection) from the NOT_ACCESSIBLE pool. This method obtains the stateTransitionLock.readLock() which prevents any modification during iteration, but allows multiple threads to iterate simultaneously. @return a connection, or null if there are no connections in the inaccessible pool for the c...
getNotAccessible
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private T getSharedXAStatefulHolder() { BitronixTransaction transaction = TransactionContextHelper.currentTransaction(); if (transaction == null) { if (log.isDebugEnabled()) { log.debug("no current transaction, shared connection map will not be used"); } return null; } ...
Try to get a shared XAStatefulHolder. This method will either return a shared XAStatefulHolder or <code>null</code>. If there is no current transaction, XAStatefulHolder's are not shared. If there is a transaction <i>and</i> there is a XAStatefulHolder associated with this thread already, we return that XAStatefulHo...
getSharedXAStatefulHolder
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private boolean containsXAResourceHolderMatchingGtrid(T xaStatefulHolder, final Uid currentTxGtrid) { List<? extends XAResourceHolder<? extends XAResourceHolder>> xaResourceHolders = xaStatefulHolder.getXAResourceHolders(); if (log.isDebugEnabled()) { log.debug(xaResourceHolders.size() + " xa resource(s...
Try to get a shared XAStatefulHolder. This method will either return a shared XAStatefulHolder or <code>null</code>. If there is no current transaction, XAStatefulHolder's are not shared. If there is a transaction <i>and</i> there is a XAStatefulHolder associated with this thread already, we return that XAStatefulHo...
containsXAResourceHolderMatchingGtrid
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
@Override public boolean visit(XAResourceHolderState xaResourceHolderState) { // compare GTRIDs BitronixXid bitronixXid = xaResourceHolderState.getXid(); Uid resourceGtrid = bitronixXid.getGlobalTransactionIdUid(); if (log.isDebugEnabled()) { l...
Try to get a shared XAStatefulHolder. This method will either return a shared XAStatefulHolder or <code>null</code>. If there is no current transaction, XAStatefulHolder's are not shared. If there is a transaction <i>and</i> there is a XAStatefulHolder associated with this thread already, we return that XAStatefulHo...
visit
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private void grow() throws Exception { synchronized (poolGrowthShrinkLock) { final long totalPoolSize = totalPoolSize(); if (totalPoolSize < bean.getMaxPoolSize()) { long increment = bean.getAcquireIncrement(); if (totalPoolSize + increment > bean.getMaxPoolS...
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
grow
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private void growUntilMinPoolSize() throws Exception { synchronized (poolGrowthShrinkLock) { if (log.isDebugEnabled()) { log.debug("growing " + this + " to minimum pool size " + bean.getMinPoolSize()); } for (int i = totalPoolSize(); i < bean.getMinPoolSize(); i++) { crea...
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
growUntilMinPoolSize
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private void createPooledObject(Object xaFactory) throws Exception { T xaStatefulHolder = xaResourceProducer.createPooledConnection(xaFactory, bean); xaStatefulHolder.addStateChangeEventListener(this); availablePool.addLast(xaStatefulHolder); poolSize.incrementAndGet(); }
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
createPooledObject
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public Date getNextShrinkDate() { return new Date(MonotonicClock.currentTimeMillis() + TimeUnit.SECONDS.toMillis(bean.getMaxIdleTime())); }
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
getNextShrinkDate
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public void shrink() throws Exception { synchronized (poolGrowthShrinkLock) { if (log.isDebugEnabled()) { log.debug("shrinking " + this); } expireOrCloseStatefulHolders(false); if (log.isDebugEnabled()) { log.debug("shrunk " + this); } } }
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
shrink
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public void reset() throws Exception { synchronized (poolGrowthShrinkLock) { if (log.isDebugEnabled()) { log.debug("resetting " + this); } expireOrCloseStatefulHolders(true); if (log.isDebugEnabled()) { log.debug("reset " + this); } } }
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
reset
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private void expireOrCloseStatefulHolders(boolean forceClose) throws Exception { int closed = 0; final int availableSize = availablePool.size(); for (int i = 0; i < availableSize; i++) { T xaStatefulHolder = availablePool.pollFirst(); if (xaStatefulHolder == null) { ...
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
expireOrCloseStatefulHolders
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private boolean expireStatefulHolder(T xaStatefulHolder, boolean forceClose) { long expirationTime = Long.MAX_VALUE; if (bean.getMaxIdleTime() > 0) { expirationTime = xaStatefulHolder.getLastReleaseDate().getTime() + TimeUnit.SECONDS.toMillis(bean.getMaxIdleTime()); } if (be...
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
expireStatefulHolder
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
private void reinitializePool() { try { if (log.isDebugEnabled()) { log.debug("resource '" + bean.getUniqueName() + "' is marked as failed, resetting and recovering it before trying connection acquisition"); } close(); init(); IncrementalRecoverer.recover(xaResour...
Grow the pool by "acquire increment" amount up to the max pool size. @throws Exception thrown if creating a pooled objects fails
reinitializePool
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public Object getXAFactory() { return xaFactory; }
Get the XAFactory (XADataSource) that produces objects for this pool. @return the factory (XADataSource) object
getXAFactory
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public boolean isFailed() { return failed.get(); }
Is the XAPool in a failed state? @return true if this XAPool has failed, false otherwise
isFailed
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public int totalPoolSize() { return poolSize.get(); }
Get the total size of this pool. @return the total size of this pool
totalPoolSize
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public int inPoolSize() { return availablePool.size(); }
Get the number of objects in the available pool. @return the number of available objects
inPoolSize
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public List<T> getXAResourceHolders() { stateTransitionLock.readLock().lock(); try { List<T> holders = new ArrayList<T>(); holders.addAll(availablePool); holders.addAll(accessiblePool); holders.addAll(inaccessiblePool); return holders; ...
Get the number of objects in the available pool. @return the number of available objects
getXAResourceHolders
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
@Override public String toString() { return "an XAPool of resource " + bean.getUniqueName() + " with " + totalPoolSize() + " connection(s) (" + inPoolSize() + " still available)" + (isFailed() ? " -failed-" : ""); }
Get the number of objects in the available pool. @return the number of available objects
toString
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/common/XAPool.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/common/XAPool.java
Apache-2.0
public static void registerXAResource(String uniqueName, XAResource xaResource) { EhCacheXAResourceProducer xaResourceProducer = producers.get(uniqueName); if (xaResourceProducer == null) { xaResourceProducer = new EhCacheXAResourceProducer(); xaResourceProducer.setUniqueName(uni...
Register an XAResource of a cache with BTM. The first time a XAResource is registered a new EhCacheXAResourceProducer is created to hold it. @param uniqueName the uniqueName of this XAResourceProducer, usually the cache's name @param xaResource the XAResource to be registered
registerXAResource
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/ehcache/EhCacheXAResourceProducer.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/ehcache/EhCacheXAResourceProducer.java
Apache-2.0
public static void unregisterXAResource(String uniqueName, XAResource xaResource) { EhCacheXAResourceProducer xaResourceProducer = producers.get(uniqueName); if (xaResourceProducer != null) { boolean found = xaResourceProducer.removeXAResource(xaResource); if (!found) { ...
Unregister an XAResource of a cache from BTM. @param uniqueName the uniqueName of this XAResourceProducer, usually the cache's name @param xaResource the XAResource to be registered
unregisterXAResource
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/ehcache/EhCacheXAResourceProducer.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/ehcache/EhCacheXAResourceProducer.java
Apache-2.0
private void addXAResource(XAResource xaResource) { EhCacheXAResourceHolder xaResourceHolder = new EhCacheXAResourceHolder(xaResource, this); int key = xaResourceHolderCounter.incrementAndGet(); xaResourceHolders.put(key, xaResourceHolder); }
Unregister an XAResource of a cache from BTM. @param uniqueName the uniqueName of this XAResourceProducer, usually the cache's name @param xaResource the XAResource to be registered
addXAResource
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/ehcache/EhCacheXAResourceProducer.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/ehcache/EhCacheXAResourceProducer.java
Apache-2.0
private boolean removeXAResource(XAResource xaResource) { for (Map.Entry<Integer, EhCacheXAResourceHolder> entry : xaResourceHolders.entrySet()) { Integer key = entry.getKey(); EhCacheXAResourceHolder xaResourceHolder = entry.getValue(); if (xaResourceHolder.getXAResource() =...
Unregister an XAResource of a cache from BTM. @param uniqueName the uniqueName of this XAResourceProducer, usually the cache's name @param xaResource the XAResource to be registered
removeXAResource
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/ehcache/EhCacheXAResourceProducer.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/ehcache/EhCacheXAResourceProducer.java
Apache-2.0
@Override public void onEviction(PreparedStatement stmt) { try { stmt.close(); } catch (SQLException ex) { log.warn("error closing evicted statement", ex); } }
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
onEviction
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
private void applyIsolationLevel() throws SQLException { String isolationLevel = getPoolingDataSource().getIsolationLevel(); if (isolationLevel != null) { int level = translateIsolationLevel(isolationLevel); if (level < 0) { log.warn("invalid transaction isolation...
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
applyIsolationLevel
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
private static int translateIsolationLevel(String isolationLevelGuarantee) { if ("READ_COMMITTED".equals(isolationLevelGuarantee)) return Connection.TRANSACTION_READ_COMMITTED; if ("READ_UNCOMMITTED".equals(isolationLevelGuarantee)) return Connection.TRANSACTION_READ_UNCOMMITTED; if ("REPEATABLE...
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
translateIsolationLevel
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public void close() throws SQLException { // this should never happen, should we throw an exception or log at warn/error? if (usageCount > 0) { log.warn("close connection with usage count > 0, " + this); } setState(State.CLOSED); // cleanup of pooled r...
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
close
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
public RecoveryXAResourceHolder createRecoveryXAResourceHolder() { return new RecoveryXAResourceHolder(this); }
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
createRecoveryXAResourceHolder
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
private void testConnection(Connection connection) throws SQLException { int connectionTestTimeout = poolingDataSource.getEffectiveConnectionTestTimeout(); if (poolingDataSource.isEnableJdbc4ConnectionTest() && jdbcVersionDetected >= 4) { Boolean isValid = null; try { ...
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
testConnection
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
public boolean release() throws SQLException { if (log.isDebugEnabled()) { log.debug("releasing to pool " + this); } --usageCount; // delisting try { TransactionContextHelper.delistFromCurrentTransaction(this); } catch (BitronixRollbackSystemException ex) { ...
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
release
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public XAResource getXAResource() { return xaResource; }
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
getXAResource
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public ResourceBean getResourceBean() { return getPoolingDataSource(); }
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
getResourceBean
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
public PoolingDataSource getPoolingDataSource() { return poolingDataSource; }
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
getPoolingDataSource
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public List<JdbcPooledConnection> getXAResourceHolders() { return Collections.singletonList(this); }
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
getXAResourceHolders
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
public int getJdbcVersion() { return jdbcVersionDetected; }
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
getJdbcVersion
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public Object getConnectionHandle() throws Exception { if (log.isDebugEnabled()) { log.debug("getting connection handle from " + this); } State oldState = getState(); // Increment the usage count usageCount++; // Only transition to State.ACCESSIBLE on the first us...
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
getConnectionHandle
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public void stateChanged(JdbcPooledConnection source, State oldState, State newState) { if (newState == State.IN_POOL) { lastReleaseDate = new Date(MonotonicClock.currentTimeMillis()); } else if (oldState == State.IN_POOL && newState == State.ACCESSIBLE) { a...
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
stateChanged
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public void stateChanging(JdbcPooledConnection source, State currentState, State futureState) { if (futureState == State.IN_POOL && usageCount > 0) { log.warn("usage count too high (" + usageCount + ") on connection returned to pool " + source); } if (futureState == St...
Implementation of a JDBC pooled connection wrapping vendor's {@link XAConnection} implementation. @author Ludovic Orban @author Brett Wooldridge
stateChanging
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
public PreparedStatement getCachedStatement(CacheKey key) { return statementsCache.get(key); }
Get a PreparedStatement from cache. @param key the key that has been used to cache the statement. @return the cached statement corresponding to the key or null if no statement is cached under that key.
getCachedStatement
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
public PreparedStatement putCachedStatement(CacheKey key, PreparedStatement statement) { return statementsCache.put(key, statement); }
Put a PreparedStatement in the cache. @param key the statement's cache key. @param statement the statement to cache. @return the cached statement.
putCachedStatement
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
public Statement registerUncachedStatement(Statement stmt) { uncachedStatements.add(stmt); return stmt; }
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
registerUncachedStatement
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public String toString() { return "a JdbcPooledConnection from datasource " + poolingDataSource.getUniqueName() + " in state " + getState() + " with usage count " + usageCount + " wrapping " + xaConnection; }
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
toString
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
private void applyCursorHoldabilty() throws SQLException { String cursorHoldability = getPoolingDataSource().getCursorHoldability(); if (cursorHoldability != null) { int holdability = translateCursorHoldability(cursorHoldability); if (holdability < 0) { log.warn("...
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
applyCursorHoldabilty
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
private static int translateCursorHoldability(String cursorHoldability) { if ("CLOSE_CURSORS_AT_COMMIT".equals(cursorHoldability)) return ResultSet.CLOSE_CURSORS_AT_COMMIT; if ("HOLD_CURSORS_OVER_COMMIT".equals(cursorHoldability)) return ResultSet.HOLD_CURSORS_OVER_COMMIT; return -1; }
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
translateCursorHoldability
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
private void applyLocalAutoCommit() throws SQLException { String localAutoCommit = getPoolingDataSource().getLocalAutoCommit(); if (localAutoCommit != null) { if (localAutoCommit.equalsIgnoreCase("true")) { if (log.isDebugEnabled()) { log.debug("setting connection's auto comm...
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
applyLocalAutoCommit
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
private Object getConnectionHandle(Connection connection) throws SQLException { return JdbcProxyFactory.INSTANCE.getProxyConnection(this, connection); }
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
getConnectionHandle
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public String getStateDescription() { return getState().toString(); }
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
getStateDescription
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public Date getAcquisitionDate() { return acquisitionDate; }
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
getAcquisitionDate
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public Date getLastReleaseDate() { return lastReleaseDate; }
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
getLastReleaseDate
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
@Override public Collection<String> getTransactionGtridsCurrentlyHoldingThis() { return getXAResourceHolderStateGtrids(); }
Register uncached statement so that it can be closed when the connection is put back in the pool. @param stmt the statement to register. @return the registered statement.
getTransactionGtridsCurrentlyHoldingThis
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Apache-2.0
public PreparedStatement get(CacheKey key) { synchronized (cache) { // See LinkedHashMap documentation. Getting an entry means it is // updated as the 'youngest' (Most Recently Used) entry. StatementTracker cached = cache.get(key); if (cached != null) { cached.u...
The provided key is just a 'shell' JdbcPreparedStatementHandle, it comes in with no actual 'delegate' PreparedStatement. However, it contains all other pertinent information such as SQL statement, autogeneratedkeys flag, cursor holdability, etc. See the equals() method in the JdbcPreparedStatementHandle class. It is...
get
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
Apache-2.0
public PreparedStatement put(CacheKey key, PreparedStatement statement) { if (clearInProgress.get()) { return null; } synchronized (cache) { if (maxSize < 1) { return null; } // See LinkedHashMap documentation. Getting an entry means it is ...
A statement is put into the cache. This is called when a statement is first prepared and also when a statement is closed (by the client). A "closed" statement has it's usage counter decremented in the cache. @param key a cache key @param statement a prepared statement handle @return a prepared statement
put
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
Apache-2.0
protected void clear() { if (clearInProgress.compareAndSet(false, true)) { try { synchronized (cache) { Iterator<Entry<CacheKey, StatementTracker>> it = cache.entrySet().iterator(); while (it.hasNext()) { Entry<CacheKey, StatementTracker> entry = it.next(); ...
Evict all statements from the cache. This likely happens on connection close.
clear
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
Apache-2.0
private void tryEviction() { // Iteration order of the LinkedHashMap is from LRU to MRU Iterator<Entry<CacheKey, StatementTracker>> it = cache.entrySet().iterator(); while (it.hasNext()) { Entry<CacheKey, StatementTracker> entry = it.next(); StatementTracker tracker = entry.get...
Try to evict statements from the cache. Only statements with a current usage count of zero will be evicted. Statements are evicted until the cache is reduced to maxSize.
tryEviction
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
Apache-2.0
private void fireEvictionEvent(PreparedStatement stmt) { for (LruEvictionListener<PreparedStatement> listener : evictionListeners) { listener.onEviction(stmt); } }
Try to evict statements from the cache. Only statements with a current usage count of zero will be evicted. Statements are evicted until the cache is reduced to maxSize.
fireEvictionEvent
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
Apache-2.0
@Override public boolean equals(Object obj) { if (!(obj instanceof CacheKey)) { return false; } CacheKey otherKey = (CacheKey) obj; if (!sql.equals(otherKey.sql)) { return false; } else if (resultSetType != otherKey.res...
Overridden equals() that takes all PreparedStatement attributes into account. @return true if equal, false otherwise
equals
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
Apache-2.0
@Override public int hashCode() { return sql != null ? sql.hashCode() : System.identityHashCode(this); }
Overridden equals() that takes all PreparedStatement attributes into account. @return true if equal, false otherwise
hashCode
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/LruStatementCache.java
Apache-2.0
@Override public synchronized void init() { if (this.pool != null) return; try { buildXAPool(); this.jmxName = "bitronix.tm:type=JDBC,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catc...
Initializes the pool by creating the initial amount of connections.
init
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/PoolingDataSource.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/PoolingDataSource.java
Apache-2.0
private void buildXAPool() throws Exception { if (pool != null) return; if (log.isDebugEnabled()) { log.debug("building XA pool for " + getUniqueName() + " with " + getMinPoolSize() + " connection(s)"); } pool = new XAPool<JdbcPooledConnection, JdbcPooledConnection>(this, this, xaDa...
Initializes the pool by creating the initial amount of connections.
buildXAPool
java
scalar-labs/btm
btm/src/main/java/bitronix/tm/resource/jdbc/PoolingDataSource.java
https://github.com/scalar-labs/btm/blob/master/btm/src/main/java/bitronix/tm/resource/jdbc/PoolingDataSource.java
Apache-2.0