Announcement Announcement Module
No announcement yet.
Atomic read/write Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Atomic read/write

    I am very new to Spring-ldap (and ldap) and are trying to understand how to implement an atomic read write. Basically, I am working on the "next uidNumber" issue - trying to obtain a unique uidNumber. At the moment I am storing the next uidNumber in the schema. Obviously, I have to be able to read the current next uidNumber, increment and write back within a single operation. I think I need ldapTemplate.executeReadWrite although I don't really understand how to implement it? Any guidance/advice appreciated.


  • #2
    Well, either way you won't get an atomic operation. There is no server-side transaction support in LDAP, which means that you have no control whatsoever over what happens between the read operation and the write operation (any other client may get in there between the operations). This is the case regardless of whether you are using Spring LDAP or any other LDAP access method.

    The best effort you could would be to do the locking in the client code surrounding the critical operations. Provided there is only one application accessing the application you should be all right in that scenario. This would not be an ideal solution however, as the original problem still remains, you just won't risk running into it with two threads in your own application; I would probably suggest some generated guid instead.