File cache loader in a cluster was failing with EOF exception while 
restoring an object, under load. It looks like the original hash map was not 
getting written properly. The original code is given below:

   protected void storeAttributes(Fqn fqn, Map attrs) throws Exception
   {
      File f = getDirectory(fqn, true);
      File child = new File(f, DATA);
      if (!child.exists())
         if (!child.createNewFile())
            throw new IOException("Unable to create file: " + child);
      FileOutputStream out = new FileOutputStream(child);
      ObjectOutputStream output = new ObjectOutputStream(out);
      output.writeObject(attrs);
      out.close();
   }

    Changing the code as given below seems to fix the issue. 

   protected void storeAttributes(Fqn fqn, Map attrs) throws Exception
   {
      File f = getDirectory(fqn, true);
      File child = new File(f, DATA);
      if (!child.exists())
         if (!child.createNewFile())
            throw new IOException("Unable to create file: " + child);
      FileOutputStream out = new FileOutputStream(child);
      try
      {
        MarshalledValueOutputStream output =
            new MarshalledValueOutputStream(out);
        output.writeObject(attrs);
        output.close();
        out = null;
      }
      finally
      {
        if(out != null)
          out.close();
      }
   }



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4137259#4137259

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4137259
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to