What happens to resources when a program ends and garbage

Hi all
Could someone tell me what is happening to resources when a program ends?
Resources such as a "java.sql.Connection' or a 'java.nio.channels.WritableByteChannel" close automatically when an application ends?

Also, is there some kind of garbage collection that takes place? According to Effective Java 2nd edition point 7, "it is quite possible, even likely, that a program ends without running finalizers on objects that are no longer available." What happens then?

Thanks in advance!

Published by: Jujubi on April 12, 2012 10:36

As stated above, you must always closed no matter what output buffering stream or writer yourself, otherwise you will lose data. You must close the database connections yourself, otherwise you get a commit or abandoned according to you and the seller may not so get the one you want. (You should be close connections to DBMS inside finally blocks actually and using a pool of connections, not held on them forever.)

There are a few resources you do not need to clean: you don't need to have windows of Swing, for example, and you have not and cannot have MappedByteBuffers.

Tags: Java

Similar Questions

  • I have downloaded the Foxit and tried and still nothing happens. I associated the program also and nothing happens with save, open, or save as.

    I have downloaded the Foxit and tried and still nothing happens.  I associated the program also and nothing happens with save, open, or save as.  I deleted Adobe Reader and have only Foxit - still nothing happens.

    What browser do you use?
    Does it occur only for attachments Hotmail?
    You are able to download files from other sites?

    If you are using Internet Explorer, try to run without Add-ons and check if the problem persists or not.
    To do this, click Start, type Internet Explorer in the start search box and then open Internet Explorer (No Add-ons).

    If the problem disappears, an add-on is causing the problem, check your add-ons and especially disable all those who may be linked to the reading of PDF.

    If the problem persists, try to create a new user account and the test again under this new user account.
    If the problem disappears, see: http://windows.microsoft.com/en-US/windows7/fix-a-corrupted-user-profile

  • What do I do when my photoshop close and RESTAR my computer

    What do I do when my photoshop close and RESTAR my computer

    Then please go to the following location: C:\Program Files\Adobe\Adobe Photoshop CC 2015 and move the sniffer file.

  • What happens if I don't use paragraph and character Styles?

    I was told that do not use character and paragraph styles makes the files 'unstable '. So everything we manually change is in danger to be changed apparently at random. I have worked in hundreds of InDesign files for several months and have never seen a problem where this is indeed the case. I did a quick search online and on these forums, but I've not found anything directly related to what will happen if the styles have been changed manually. So, what happens if you do not use character and paragraph styles?

    I don't see that there is nothing "unstable" do not use styles, but as mentioned, they make your life easier by providing a single place to make changes that affect all the text containing the tag with the style.

    An important feature/reason for the use of the character styles is that they take precedence over paragraph styles, if a particular word needs to be styled differently to surrounding text, bolded or italicized, for example, you can add a character style that modifies only the bold or italic style type. Subsequent changes to the paragraph style will affect the face and size, if these attributes are changed, but leave your word in bold or italics, bold or italic. If you use "local formatting" (select the word, and apply the formatting) you may lose when styles to change or remove overrides, which is probably the 'random change' you have heard.

    Peter

  • What happened to my Junk folder, he disappeared and I can't get it back.

    What happened to my Junk folder, he disappeared and I can't get it back

    POP mail.bigpond.com and my ISP is Telstra

    So how can I pick up my junk e-mail folder, and why did he disappear? Now, emails and ads are marked as spam but I have to delete them manually as there is no junk folder.

  • What happens to a file at the end of playback of a file reference?

    Question general file IO.

    If I'm reading a binary file and the read operation reaches the end of this file, what happens to the file reference?  It exist in memory at this time, or is he out once labview publishes the end of file error?

    I coded a "departure" from playback and functionality 'stop' and the 'Stop' button is the only method in place for the closing of the reading file reference.  Immediate sights are

    (a) what is happening to the reference of the file once the read operation reaches the end of the file

    (b) it is important that I have never close the reference of the file once the user clicks on 'stop '?  (i.e. is it a best practice out there?)

    I'm under Labview 8.6 on Vista Business.

    The file reference is valid when you reach the end of the file. Each read operation returns an error, but you can write to this location. Writing will succeed because it's normal when you add data to a file.

    Close the reference when the user types stop is OK. If you implement a Replay button that you just need to reposition the pointer at the beginning of the file file and read again. This avoids the need to close and reopen the case.

  • What happened to my Office family programs and Student 2007? ___

    What happened to my Office home and Student 2007 programs when I installed Windows 7?

    I bought my laptop in early 2009, and he had vista.  I also purchased and installed Microsoft Office Home and Student 2007.  I have now installed Windows 7.  My Office home and Student 2007 programs seem to have disappeared and I now find just download and try it for 60 days trial version.  WHERE MY PROGRAMS PURCHASED WENT!  Although I can recharge my programs purchased from the disc, I don't want to do that because I've customized my word and don't want to have to do all over again.

    Hello
    Welcome to the Microsoft answers site.
     
    To better understand the problem, you will need to answer a few questions:
     
    Which type of installation do you do Upgrade or custom?

    If you did a clean install of windows7, then you must install the program from office 2007 from the disk.

    The question you have posted is related to Microsoft Office, and would be better suited in the Discuission Microsoft Office groups.
     
    Please visit the link below and find a community that will offer you a better support.
    http://www.Microsoft.com/Office/Community/en-us/FlyoutOverview.mspx

    Thank you and best regards,
    Azam - Microsoft technical support.

  • What happens to iMessage when I use a Sim Card in Europe

    I intend to get a prepaid Sim Card for my iPhone 6 s when I travel in Europe in a few weeks.  I wonder if I still have iMessages since most of the people that iMessage use me my (Verizon) cell phone number.  I get all the iMessages on my iPad and computer laptop too through my e-mail, so I guess that the two e mail and cell number are used by the ap.  In addition, what happens to my iMessage when I come back and turn on my regular sim card?

    You will not be able to get the iMessages as when you put in the new SIM card, your iPhone to record with a new number. You can add e-mail addresses to your address list under which you are reachable, then iMessages sent one of these e-mail addresses.

  • What happens in Tablespace, when drop any object?

    Hi people.

    I have a question about the store in tablespace, what happens when you track the taks in the database: c

    When you drop a table? Change the size in the tablespace? Reduce the size of the tablespace... ??

    What are the difrent between deleting the table and Truncate Table... Change the size in the tablespace? Reduce the size of the tablespace... ??

    Thanks a lot for your help and your answers... Because I can clear my mind in different concepts.

    Kind regards.

    lokimoix wrote:
    Hi people.

    I have a question about the store in tablespace, what happens when you track the taks in the database: c

    When you drop a table? Change the size in the tablespace? Reduce the size of the tablespace... ??

    What are the difrent between deleting the table and Truncate Table... Change the size in the tablespace? Reduce the size of the tablespace... ??

    Thanks a lot for your help and your answers... Because I can clear my mind in different concepts.

    Kind regards.

    Well, you pouvez test it for yourself and see for yourself. .

    However,.

    Nothing you described changes the size of the storage space. These actions simply free up space previously allocated within the storage space, allowing it to be
    reused.

    DROP TABLE frees all the extensions that have been allocated to this table, which allows the space they occupied to be assigned to any segment which perhaps need - AND DELETED THE TABLE FROM THE DATABASE (which is fine, there are now considerations recyclebin, but that's another issue).

    DELETE just deletes rows from a table, freeing space on the blocks that lines busy. All extents allocated to this table are attributed to him, but the space left vacant by the deleted rows is available to be reused by new lines in this table.

    TRUNCATE table frees all the extensions that have been allocated to this table, which allows the space they occupied to be assigned to any segment that may be in need, BUT in CONTRAST to the DROP TABLE, the structure of the table remains in place.

    The above is just a detailed description of the differences, there are a few details that some people will call me, but for your level of understanding, that these are enough for now. You really, REALLLY need to spend more time in the manual of Concepts.

  • What happens to the data on my iPhone and iPad, if I need to cancel my contract with O2?

    What happens to the data on my iPhone 5 and iPad if I have to cancel my contract with O2?

    I can't say for sure, but probably nothing will happen for her.  When my wife got a new iPhone, we disconnected his former service. We went there on a few months later and everything was still there, it just wouldn't connect a data plan or phone of course service. It has worked well for a wi - fi connection.

  • What is the difference between the program files and Program Files

    original title: difference between program files and program files

    Hello.

    I have 2 files on my C:\ drive that both seem to contain program files: one is called "Programs" (French word) and other 'program (x 86) '.

    Some program files in two directories (like Windows Mail).

    What is the difference btw. them, and that one should choose to place new programs? Or is this duplication caused by my using the French for Vista version?

    If you are running a 64-bit version of Windows:
    Program files (86) your 32-bit programs and "Programs" should be your 64-bit programs. Most of the programs designed for the 32-bit version of Windows works on 64-bit Windows version. The notable exceptions are many antivirus programs and drivers.

    32-bit and 64-bit Windows: frequently asked questions
    http://Windows.Microsoft.com/en-us/Windows7/32-bit-and-64-bit-Windows-frequently-asked-questions

  • What happen to folios in the 2015 to indesing version, how do I create a new folio in the new version, what happens with the sheets that I create and how can I download the adobe Viewer? Thank you

    Folios indesing 2015 version, what happens?

    Transferred to DPS forum

    DPS and CC 2015 InDesign

  • I have cs6 on my computers - what happens to it when I want to launch creative cloud?

    I currently have Adobe Design and Web Premium CS6 and I was wondering what would happen if I want to go creative cloud?

    Hi Philippe,.

    If you have allowed to stand alone for the CS6, it stay there and work with creative cloud.

    Creative cloud won't overlap or uninstall CS6.

    * If you decide to cancel the membership of creative cloud in the future, his will not affect the CS6 license.

    Your CS6 would work as it works now.

    Hope that answers your query.

  • What happens in steady when I change a dense dimension in Essbase?

    Hi all

    When I add/change/remove any member of Dimension Dense, what are the files that would be get restructured.

    I know they are otl files, pag and ind but don't know how/why file ind gets restructured.

    (Index files contains the only address to the actual data blocks which are formed by unique combinations of sparse dimension, but when we make changes to Dense dimension why file ind gets restructured).

    Thank you

    Amith

    Amith, the index contains pointers existing blocks - it literally tells Essbase where in the .pag files to find a particular block.  If the blocks change size / move (because they will be in a dense restructuring implied), the updated index.

    Take Sample.Basic for example.  If the block for "NYC"->"100-10" exists from the 1000th byte of ess00001.pag, the index entry for "New York"-> "100-10" will take account of this.  Then, we perform an implicit restructuring by removing a few dense members.  The block for "New York"-> "" 100-10 will always exist, but it might be present in the file from the 500th byte.  The entry of index for "New York" file-> "" 100-10 must be updated.

    See optimizing database restructuring in the database administrator's Guide (Sreekumar post above is actually taken from this section).

  • What does it mean when the terminal ends with a $ next to your computer name?

    I was looking through the terminal, and I noticed that a dollar sign next to my computer user. what it means? is this something that's going to hurt my computer?

    The $ is normal. This means that you use Terminal as a regular user, as opposed to a system/root user.

Maybe you are looking for

  • Message violates guidelines send IPv6 on PTR 550 5.7.1 documents and authentication

    I use OS X Server (El Capitan) as my personal mail server. Everything is set up correctly. Mail works fine for everything except google gmail. This has happened for 2-3 years... whenever I have send emails to users of Gmail, I get "reviewed mail retu

  • Vista Windows update error after update sp2

    I've upgraded to SP2 for windows vista in May 09... Since then, all windows updates fail with an error code 80072efd.Firewall is NOT the issue here... Help, please!

  • Hidden photos

    Vista, scanner HP4050...  I scanned 46 photos in a folder. When I open the file there is only a single photo... I used the number just as they featured. When I open in a viewer of there is a single picture, but if I double click on it, there are 46 p

  • CQ10 Mini compact: Compact Mini CQ10 password Bios Reset

    My netbook is locked and I don't remember the BIOS password I get the error code following the CNU0092ZQ6 bios password PLS CAN ANYONE HELP, I TRIED OUT THE CMOS BATTERY BUT HASN'T HELPED thks a lot

  • I deleted the 'show desktop' item from the taskbar

    I deleted the 'show desktop' icon of the area of the task bar which also has him "switch between windows" icon & internet explore etc. I don't know how to recover this icon in this area. You can add an office toolbar which is a quicklink to everythin