I have an application on xpages that needs to have a handle number for the user, and I am having problems with duplicate numbers when I have two users trying to save simultaneously. I have tried using FTSearch and UpdateIndex, both are not viable because they caused slowness on xpage. I would like other options to be generating this sequence without duplicity and without impacting server performance.
You need to distinguish: single server or multiple servers (presuming you don’t use Notes clients).
Single server:
Create a managed bean that you deploy a “application managed bean”. On load that bean takes the first entry from a view that is sorted descending of your sequence. It keeps that one in memory. A synchronised function getNextNumber()
that internally calls a singleton provides you with the value you need
Multiple servers: a) they can’t “see” each other (remote replication): change your sequence to include a server prefix. Or: add sequence numbers after replication only.
b) they see each other on https: Design “application managed beans” that do the same a single server, except that they asks a “master” for the number. You then need to implement a mechanism that allows to dynamically change the master when the master is unresponsive. Some kind of negotiation protocol. (Common challenge in Cluster environments).