private void writeFin(String user, int glID, String resName,
                                double cost, double cpu, double clock,
                                boolean header)
   {
       if (trace_flag == false) {
            return;
       }

       // Write into a results file
       FileWriter fwriter = null;
       try
       {
           fwriter = new FileWriter(user, true);
       } catch (Exception ex)
       {
           ex.printStackTrace();
           System.out.println(
                   "Unwanted errors while opening file " + user);
       }

       try
       {
           if (header == true) {
               fwriter.write(
                  "\n\nGridletID \t Resource \t Cost \t CPU time \t Latency\n");
           }

           fwriter.write(glID + "\t" + resName + "\t" + cost + "\t"+ cpu +
                         "\t" + + clock + "\n");
       } catch (Exception ex)
       {
           ex.printStackTrace();
           System.out.println(
                   "Unwanted errors while writing on file " + user);
       }

       try
       {
           fwriter.close();
       } catch (Exception ex)
       {
           ex.printStackTrace();
           System.out.println(
                   "Unwanted errors while closing file " + user);
       }

   }