java - Can not closing a FileOutputStream cause Issue? -


i have scenario have created lock objects initialization of fileoutputstream using below code. objects supposed there in application throughout lifetime.i have static arraylist adding lock objects. there total 10 lock objects available application.

  class lock      // instance variable     fileoutputstream fos = new fileoutputstream(file);      // acquire lock api()      try      {          filelock lock = fos.getchannel().trylock();      }      catch(overlappingfilelockexception ex)      {         // happens when lock aquired other resures.          return false;      }        // release lock api      if(lock !=null)                   lock.release 

since objects there throughout lifetime of app, not willing open , close stream every time lock requested. so, choose open once while initialization. want know can impact of design. also, in way can monitor how leak can impact application , system? suspect whenever restart server filedescriptors still open. but, not sure additional overhead cause.

note- servers gets restart every weekend

your inputs me rethink , come else. in advance !!


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -