You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Chris Watts (JIRA)" <ji...@apache.org> on 2013/12/02 15:39:35 UTC

[jira] [Commented] (OPENJPA-2461) throws PessimisticLockException instead of LockTimeoutException

    [ https://issues.apache.org/jira/browse/OPENJPA-2461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13836550#comment-13836550 ] 

Chris Watts commented on OPENJPA-2461:
--------------------------------------

In PessimisticLockManager.lockRow
{code:java}
catch (SQLException se) {
	LockException e = new LockException(sm.getPersistenceCapable(), timeout, level);
	e.setCause(se);
	e.setFatal(dict.isFatalException(StoreException.LOCK, se) 
			|| level >= MixedLockLevels.LOCK_PESSIMISTIC_READ);
	throw e;
}{code}
Should be:
{code:java}
e.setFatal(dict.isFatalException(StoreException.LOCK, se) || (level >= MixedLockLevels.LOCK_PESSIMISTIC_READ && timeout != 0 && timeTaken < timeout));
{code}

> throws PessimisticLockException instead of LockTimeoutException
> ---------------------------------------------------------------
>
>                 Key: OPENJPA-2461
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2461
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 2.2.2
>         Environment: derby 10.10
>            Reporter: Chris Watts
>
> When javax.persistence.lock.timeout is set to zero or the lock takes longer than specified then LockTimeoutException should be thrown, however PessimisticLockException is thrown.
> From the spec:
> The length of time in milliseconds the persistence provider should wait to obtain a lock on the database tables may be specified using the javax.persistence.lock.timeout property. If the time it takes to obtain a lock exceeds the value of this property, a LockTimeoutException will be thrown, but the current transaction will not be marked for rollback. If this property is set to 0, the persistence provider should throw a LockTimeoutException if it cannot immediately obtain a lock.



--
This message was sent by Atlassian JIRA
(v6.1#6144)