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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:51:01+00:00 2026-06-10T16:51:01+00:00

Say, I have a Java application running, and I have provided RESTful web services

  • 0

Say, I have a Java application running, and I have provided RESTful web services call (via Java Jersey). First, am I right that every invocation of a HTTP RESTful request (or servlet request) runs on a different thread from the main thread? And if so, if I provide a RESTful call to kill the app, how can it reach the main thread (the one started by the main() method) to kill it and subsequently stop the program?

Note: the reason I’m asking this is I need to do a graceful shutdown of the main thread (and the program).

  • 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-10T16:51:02+00:00Added an answer on June 10, 2026 at 4:51 pm

    Your restful service should treat a shutdown request the same as any other request.

    For example, if your app was an online store, you might have calls like processOrder or getInventory. These calls have access to many things in your app, right? Well, just make a new call called shutdown. This call will shut the gates to future calls, wait for existing calls to finish, save in-memory information to the DB, and other safe shutdown procedures.

    It’s really just another call. I wouldn’t worry so much about “stopping the main method” from a call – think in terms of logical behavior, not technical behavior.

    It would appear for Jersey, you’re looking for client.destroy();.

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

Sidebar

Related Questions

Let's say I have a running Java-based web application with 0 or more valid
I have a web application running on Google App Engine (GAE) for JAVA. I'm
I have an existing application (say 'A') and I want to call a java
I have java application say xxxx.exe. Which I manually kill that application, the corresponding
Say I have two Java apps that I wrote: Ping.jar and Pong.jar and they
Say I have a GUI Java project of something that simulates an ATM machine,
Say I have a couple of java runtime environments running on my system which
Say I have a REST API in java, and it supports responses that are
I am running JavaScript inside a Java application and have a gui terminal where
I have written an application in Java that can be used on both Linux

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.