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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:06:11+00:00 2026-06-10T04:06:11+00:00

We are developing travel application for booking flight, bus tickets etc. For the flight

  • 0

We are developing travel application for booking flight, bus tickets etc. For the flight tickets initially PNR (Passenger Name Record) will be generated, through that PNR confirmation of ticket will be done.

The problem is, if ticket is not confirmed with in 12 hours after generating the PNR, the PNR has to be canceled. If not, we will face penalty from Air GDS provider.

Up to now we have written Cron Schedulers which does this thing for every 15 minutes. We have problems by doing like this, and faced penalty also. I can’t run the schedulers every minute.

How can I cancel the PNR, after generating 12 hours if not booked.

  • 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-06-10T04:06:13+00:00Added an answer on June 10, 2026 at 4:06 am

    aioobe provided some good references for solving this sort of problem. However if you want to solve the problem without having to worry about timers or other transient things that may disappear on you if the JVM ever needs to be shutdown and restarted, I’d suggest also considering a simple approach along the lines of:

    public class PNRExpirationThread extends Thread {
        @Override
        public void run() {
            while (true) {  //or while !stop, or while Server.isRunning(), you get the idea
                try {
                    Thread.sleep(30000);  //wait 30 seconds; adjust this to your liking
                    //it's pseudo-SQL, but you get the idea; I'm assuming your data model has the required fields for this to work
                    Database.executeTxn("DELETE FROM pnrRecords WHERE NOW() - createDate > 12h AND confirmed = 0");  
                }
                catch (Throwable ignored) {
                }
            }
        }
    }
    

    Then, add to your server’s startup/initialization routine some code like:

    //keep a reference to this if you want to terminate the thread gracefully at shutdown time
    new PNRExpirationThread().start();
    

    Then your platform will automatically query for and delete any records that are older than 12 hours, at 30-second intervals.

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

Sidebar

Related Questions

Developing an application for Android, i want to record data that will be usefull
I am developing simple travel agent android application. When application starts it loads list
I'm developing a web application that deals with travel. I want to be able
Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart
Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and
While developing an application using gwt in ecliplse crashed. Now the server is running
When developing an RCP application against a target platform, I ( and others )
iam developing one application.In that i need to get the music files from the
I've been developing a travel planning site - tripgrep.com - which is built on
Developing a multilingual application in VB.Net 2008, Im able to add resources to forms

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.