Hi, There are multiple solutions, depending on your needs (performance, concurrency, simplicity).
One is to use MVMap.lastKey and then put / putIfAbsent (if concurrent puts are possible). This is fast, but not terribly so. Another is to maintain an AtomicInteger yourself (or a simple int, but per thread), and then pre-allocate 20 (or so) new ids at a time, similar to how sequences work in H2 (see the docs there). This is more complex, but faster. The disadvantage is that some ids are lost or inserted later. Regards, Thomas On Sunday, October 18, 2015, <[email protected]> wrote: > I was thinking of creating a poor-man's queue implemented on MVStore. The > implementation that comes to mind uses an auto incrementing key, but the > process would need to maintain this. Is it possible MVStore already > implements this? > > Thanks > -Alex > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
