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 910229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:00:32+00:00 2026-05-15T17:00:32+00:00

Folks I am implementing a file based queue ( see my earlier question )

  • 0

Folks
I am implementing a file based queue (see my earlier question) using sqlite. I have the following threads running in background:

  1. thread-1 to empty out a memory structure into the “queue” table (an insert into “queue” table).
  2. thread-1 to read and “process” the “queue” table runs every 5 to 10 seconds
  3. thread-3 – runs very infrequently and purges old data that is no longer needed from the “queue” table and also runs vacuum so the size of the database file remains small.

Now the behavior that I would like is for each thread to get whatever lock it needs (waiting with a timeout if possible) and then completing the transaction. It is ok if threads do not run concurrently – what is important is that the transaction once begins does not fail due to “locking” errors such as “database is locked”.

I looked at the transaction documentation but there does not seem to be a “timeout” facility (I am using JDBC). Can the timeout be set to a large quantity in the connection?

One solution (untried) I can think of is to have a connection pool of max 1 connection. Thus only one thread can connect at a time and so we should not see any locking errors. Are there better ways?

Thanx!

  • 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-15T17:00:33+00:00Added an answer on May 15, 2026 at 5:00 pm

    If it were me, I’d use a single database connection handle. If a thread needs it, it can allocate it within a critical section (or mutex, or similar) – this is basically a poor man’s connection pool with only one connection in the pool:) It can do its business with the databse. When done, it exits the critical section (or frees the mutex or ?). You won’t get locking errors if you carefully use the single db connection.

    -Don

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

Sidebar

Related Questions

Folks, My Issue Why is an HSQLDB file-based database I have pre-populated with a
Folks, I had a quick question about Amazon EC2, I have been recently using
Folks I am surprised to see my code working, that I dont have any
Folks, We have been using OpenXml APIs found in System.IO.Packaging for creating a package
Folks, I'm trying to open a youtube video in fancybox using the following code:
Folks, I have a HTML file which contains a button called Email this content
Folks, I have just joined a company where they are using WSAD 5.1 which
Folks, I have ASP.NET MVC 3 Application and I have the following JQuery script
Folks, i have the following problem. My website uses an iframe to select an
I have implemented TCp concurrent server and client in c using threads as well

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.