Remove SEVERE level logging for expected exception in taskservice.claim()

Description

There exists an expected race condition when two users try to find and claim a task at the same time. The second user to issue the claim will result in an exception being thrown when the transaction is committed. This is good and expected.

However, CommandContext.close() always logs all exceptions at the SEVERE level (even if they are not masked). This means that this expected case causes false alarm SEVERE errors in the logs. Furthermore, since the exception is rethrown anyway, this also can result in dual logging of the exception.

Since the exceptions are always re-thrown, I think that this fix should be as simple as removing the logging at CommandContext::124. In my opinion, CommandContext should continue logging exceptions whenever they are masked, but if an exception will not be masked, it should let the caller decide what to do.

Alternatively, now that has been implemented, CommandContext could also have a special case for the ActivitiTaskAlreadyClaimedException exception. However, doing that won't remove the general Log-And-Thrown anti-pattern (http://today.java.net/article/2006/04/04/exception-handling-antipatterns#logAndThrow)

Assignee

Frederik Heremans

Reporter

Brian Showers

Labels

None

Components

Fix versions

Priority

Major
Configure