Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6868219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:24:25+00:00 2026-05-27T03:24:25+00:00

Several months ago I implemented a solution to choose unique values from a range

  • 0

Several months ago I implemented a solution to choose unique values from a range between 1 and 65535 (16 bits). This range is used to generate unique Route Targets suffixes, which for this customer massive network (it’s a huge ISP) are a very disputed resource, so any released value needs to become immediately available to the end user.

To tackle this requirement I used a BitSet. Allocate a suffix on the RT index with set and deallocate a suffix with clear. The method nextClearBit() can find the next available value. I handle synchronization / concurrency issues manually.

This works pretty well for a small range… The entire index is small (around 10k), it is blazing fast and can be easy serialized and stored in a blob field.

The problem is, some new devices can handle RT suffixes of 32 bits unsigned (range 1 / 4294967296). Which can’t be managed with a BitSet (it would, by itself, consume around 600Mb, plus be limited to int – 32 bits signed – range). Even with this massive range available, the client still wants to free Route Target suffixes that become available to the end user, mainly because the lowest ones (up to 65535) – which are compatible with old routers – are being heavily disputed.

Before I tell the customer that this is impossible and he will have to conform with my reusable index for lower RTs (up to 65550) and use a database sequence for the other ones (which means that when the user frees a Route Target, it will not become available again), would anyone shed some light?

Maybe some kind soul already implemented a high performance number pool for Java (6 if it matters), or I am missing a killer feature of Oracle database (11R2 if it matters)… Just some wishful thinking :).

Thank you very much in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:24:26+00:00Added an answer on May 27, 2026 at 3:24 am

    I would combine the following:

    your current BitSet solution for 1-65535

    PLUS

    Oracle-based solution with a sequence for 65536 – 4294967296 which wraps around defined as

    CREATE SEQUENCE MyIDSequence
    MINVALUE 65536 
    MAXVALUE 4294967296 
    START WITH 65536
    INCREMENT BY 1
    CYCLE
    NOCACHE
    ORDER;
    

    This sequence gives you ordered values in the specified range and allows for reuse of any values but only after the maximum is reached – which should allow enough time for the values being released… if need be you can keep track of values in use in a table and just increment further if the returned value is already in use – all this can be wrapped nicely into a stored procedure for convenience…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Several months ago I learned from an answer on Stack Overflow how to perform
I've switch from VB.NET to C# several months ago, while there are a lot
I wrote a small PHP application several months ago that uses the WordPress XMLRPC
I built a Winform app several months ago that schedules appointments for repair techs.
Several months (maybe even a year or two) ago, I saw an asp .net
I've started to use XCode several months ago, after using IntelliJ for several years,
I took over a project several months ago that involved polymorphic associations that were
I had this problem some years ago and back then I implemented a "different
I downloaded and installed Eclipse using Yoxos a few months ago. Since then, several
Several months ago, I wrote a blog post detailing how to achieve tab-completion in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.