Implementing synchronized beans with lingo?
Good day!
Is instance-level synchronization possible with Lingo?
On Oracle database I would just use transaction level = serializable to achieve my goals, but looks like we have no Oracle on this project :(
The situation is: we will have the (possibly) clustered application, and one of the business tasks work like the following. There are X time periods each day with Y slots available for users. When users claim to use slot(s) we should:
1. Check if there is enough slots left;
2. Accept (or reject) user's request;
3. Update the slots state.
We were happy with the "public void synchronized claim (User user, int slots);" method signature in non-clustered environment (the RequestManager with the mentioned method was just a Spring-managed singleton bean), which was working with any database.
But clustered (or EJB) environment ruins our architecture completely - since there are several instances of RequestManager bean in the Session Pool, the "synchronized" keyword cannot guarantee absolutely nothing. Even worse - these instances will be running in different JVMs so I cannot do the "synchronize on static field" trick.
Are there any workarounds available with lingo? I supposed that it might be useful having plain old Spring application with singleton beans (and "synchronized" methods) exposed via lingo's MultiplexingRequestor to achieve my goals. But I still doubt regarding this.
Any comments/suggestions please? Are there any other solutions available?