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

  • Home
  • SEARCH
  • 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 391453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:03:47+00:00 2026-05-12T16:03:47+00:00

For a travel booking web application, where there are 100 concurrent users logged in,

  • 0

For a travel booking web application, where there are 100 concurrent users logged in,
should ticket booking and generating an “E-Ticket Number” be implemented by a “synchronized” or a “static synchronized” method?

  • 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-12T16:03:47+00:00Added an answer on May 12, 2026 at 4:03 pm

    Well, are you aware of the difference between a static method and an instance method in general?

    The only difference that synchronized makes is that before the VM starts running that method, it has to acquire a monitor. For an instance method, the lock acquired is the one associated with the object you’re calling the method on. For a static method, the lock acquired is associated with the type itself – so no other threads will be able to call any other synchronized static methods at the same time.

    In other words, this:

    class Test
    {
        static synchronized void Foo() { ... }
    
        synchronized void Bar() { ... }
    }
    

    is roughly equivalent to:

    class Test
    {
        static void Foo()
        {
            synchronized(Test.class)
            {
                ...
            }
        }
    
        void Bar()
        {
            synchronized(this)
            {
                ...
            }
        }
    }
    

    Generally I tend not to use synchronized methods at all – I prefer to explicitly synchronize on a private lock reference:

    private final Object lock = new Object();
    
    ...
    
    void Bar()
    {
        synchronized(lock)
        {
            ...
        }
    }
    

    You haven’t provided nearly enough information to determine whether your method should be a static or instance method, or whether it should be synchronized at all. Multithreading is a complex issue – I strongly suggest that you read up on it (through books, tutorials etc).

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

Sidebar

Related Questions

Can anyone recommend for/against the time-travel functions in postgresql's contrib/spi module? Is there an
In dopplr [ http://www.dopplr.com] there is an option to fill the city of travel
Background We have a Windows .NET application used by our field employees who travel
I am doing a Flight booking system and I want to send an E-Mail
Can you have tar travel to a certain direct and then tar files relative
I work for a travel agency, they have a website, from here they want
I am about to travel to Europe (I'm Australian but imagine this is a
I want to travel in the past and learn REXX , but I don't
I have a travel related website that has been online for several years (since
I'm going to travel through Thailand and I want to keep track of my

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.