title: Will the synchronize method throw EOF Exception?
body: <p>I have a synchronize method, in whoich i am using datainputstream.readfully() .Its throwing me the "EOF exception". Why the reallyfully method throws EOF when it is still inside the synchronize method? below is the code for reference</p>
  
  <pre><code>private static synchronized String getTransactionId() {
         try {
            String txnId_fname = SiteConfiguration.getInstance().getProperty("TRANSACTION.INFO_FILE", //
                    LaneProcessor.DEFAULT_TRANSACTION_ID_FILE_NAME);
  
            File tmpFile = new File(txnId_fname);
            if (!tmpFile.exists()) {
                tmpFile.createNewFile();
            }
            else {
  
               long sz = tmpFile.length();
               if ( 12 == sz ) {
                  // read the transaction id from the file, the ID must be 12 bytes long to be valid.
                  DataInputStream dis = new DataInputStream(new FileInputStream(tmpFile));
  
                  byte[] datainBytes = new byte[dis.available()];
                  dis.readFully(datainBytes);
                  transactionIdLog = new String(datainBytes, 0, datainBytes.length);
  
                  if ( Stringer.isNumeric(transactionIdLog))
                    { 
  
                      transactionId = Long.valueOf(transactionIdLog);
                    }
  
                  dis.close();
                  //log.debug("transaction id from the existing file"+transactionId);
               }
            }
  
  
            transactionId = ConvertUtils.incrementLong(transactionId);
            transactionIdLog = Long.toString(transactionId);
              transactionIdLog = Stringer.zpad(transactionIdLog, 12);
  
            _out = new FileOutputStream(tmpFile);
            _out.write(transactionIdLog.getBytes());
            _out.flush();
            _out.close();
  
        }
        catch (Exception e) {
            log.error("Error in transaction id generation" + e.getMessage(), e);
        }
        return transactionIdLog;
      }
  </code></pre>