Search code examples
javadistributed-computingoracle-coherencesequence-generators

How to generate unique id on a distributed system using Oracle Coherence?


I have a distributed java application which uses Oracle Coherence for caching capabilities. How can I use this to generate a unique UUID for the distributed system? I am pretty sure this can be done by implementing a sequence generator by leveraging on Coherence's cache capabilities as done here. Cassandra has TimeBaseUUID and I am trying to find if there is something similar on Coherence.


Solution

  • Coherence's UUID class has the below constructor which is very much similar to functionality offered by Cassandra's TimeBasedUUID.

    public UUID(long lDatetime,
                java.net.InetAddress addr,
                int nPort,
                int nCount)
    

    Coherence Incubator's UUIDBasedIdentifier uses the default constructor of UUID internally.