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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:34:21+00:00 2026-06-05T03:34:21+00:00

Java applications may use IO streams, sockets or database connections that should be closed

  • 0

Java applications may use IO streams, sockets or database connections that should be closed when they are no longer needed.

However, applications may be terminated (e.g. by killing the process). Will all used resources be freed in this case? Who will free them: OS or JRE?

  • 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-05T03:34:23+00:00Added an answer on June 5, 2026 at 3:34 am

    If your software doesn’t take care of resource management properly, the following will happen:

    • at runtime: the JVM will attempt during the duration of your program to close open streams if they’re are seemingly unused (during garbage collection cycles),
    • at your program’s termination point: the JVM should close open streams of all kinds left open by your program,
    • at the JVM’s process termination point: the operating system will take care of releasing anything that hasn’t been properly released by the JVM when it exists (hopefully, or this OS has some serious issues…).

    As mentioned by Vulcan, none of this ensures that they are properly dealt with on the other end, obviously.

    Note that the 3rd bullet point is a rather generic thing: most operating systems will take care of this, and it doesn’t relate to the Java Platform’s internals. It’s about the OS managing its processes and resources on its own.

    More Info

    See also:

    • Cleanup of resources on an abnormal Exit, also on StackOverflow
    • How do I implement graceful termination in Java
    • Java Theory and Practice: Good Housekeeping Practices, at the IBM Developer Series
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Conventional wisdom tells us that high-volume enterprise java applications should use thread pooling in
Many Java applications that use shell scripts to configure their environment use the JAVA_HOME
I have two Java applications in my network that talk to each other over
I use an embedded DB for two applications that one of them is Server
In my Java application, I use a third-party library. However, I found something strange,
I have an OSX App-Bundle for a Java Application that does not use the
In my java application, I have some entity, some of them may have the
I am from Java Desktop Application background. May I know what is the best
My Java applications uses Hibernate with a SessionFactory-scoped interceptor in order to change data
I have an Java applications which I would like to run with different values

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.