Coder Social home page Coder Social logo

Comments (8)

glassfishrobot avatar glassfishrobot commented on September 27, 2024

Reported by stuartdouglas

from ejb-spec.

glassfishrobot avatar glassfishrobot commented on September 27, 2024

@ldemichiel said:
The EJB 3.1 Expert Group made the decision to assign this semantics to AccessTimeout(0) instead of introducing something like a ConcurrencyManagementType.CONCURRENCY_NOT_ALLOWED value.
I think this annotation is mostly useful to override for a method behavior that is specified at class level.

from ejb-spec.

glassfishrobot avatar glassfishrobot commented on September 27, 2024

@ldemichiel said:
Not a bug

from ejb-spec.

glassfishrobot avatar glassfishrobot commented on September 27, 2024

stuartdouglas said:
There is already a way to do that though (@lock(WRITE) @AccessTimeout(0)). It seems really silly that if you do @lock(READ) @AccessTimeout(0) two threads cannot call the method at the same time, even though @lock(READ) explicitly allows this behaviour.

This basically has the effect of transparently turning a READ lock into a WRITE lock, for no good reason (if the user wanted a write lock they would have use @lock(WRITE)).

from ejb-spec.

glassfishrobot avatar glassfishrobot commented on September 27, 2024

@ldemichiel said:
Combining the two annotations doesn't make a lot of sense to me. I think the intention was to treat AccessTimeout as an override over any concurrency. That is different from turning a READ lock into a WRITE lock, because there is no waiting involved for the lock to free up – instead one just gets the ConcurrentAccessException. BTW, I'm certainly not disagreeing with your general point about lack of intuitiveness in the design though.

from ejb-spec.

glassfishrobot avatar glassfishrobot commented on September 27, 2024

stuartdouglas said:
I think it makes sense. Intuitively AccessTimeout(0) means 'I don't want this thread to block, if you can't get the lock straight away throw an exception', so if it is applied to a read lock I would expect that if another thread holds the write lock an exception will be thrown, otherwise the thread would proceed as normal.

With the current wording there can be situations where the current thread can take the lock immediately (as there are only other read threads active), however it still has to throw an exception because of the 'no concurrency' stipulation.

from ejb-spec.

glassfishrobot avatar glassfishrobot commented on September 27, 2024

This issue was imported from java.net JIRA EJB_SPEC-122

from ejb-spec.

glassfishrobot avatar glassfishrobot commented on September 27, 2024

Marked as works as designed on Monday, September 15th 2014, 1:54:49 pm

from ejb-spec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.