[jboss-user] [JBoss Cache: Core Edition] - Re: FileCacheLoader failing with EOFException with fix

e2open do-not-reply at jboss.com
Thu Mar 20 22:38:08 EDT 2008


    I changed the code to do a dot file and move to avoid the EOF on read(on linux). The problem i see now is that, there are more than one write happening at the same time (from different nodes in the cluster). How is that possible if there is a write lock on the node ? 


    protected void storeAttributes(Fqn fqn, Map attrs) throws Exception
    {
        File f = getDirectory(fqn, true);
        File child = new File(f, DATA);
        File dotChild = new File(f, DOT_DATA);
        if(dotChild.exists())
            System.out.println("Found dot file : " + dotChild);
        FileOutputStream out = new FileOutputStream(dotChild);
        try
        {
            MarshalledValueOutputStream output =
                new MarshalledValueOutputStream(out);
            output.writeObject(attrs);
            output.close();
            out = null;
        }
        finally
        {
            if(out != null)
                out.close();
        }
        if(!dotChild.renameTo(child))
        {
            throw new Exception("Failed to rename '" + dotChild + "' to '" +
                child + "' : " + f.exists() + " : " + dotChild.exists() +
                " : " + child.exists());
        }
    }


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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138217



More information about the jboss-user mailing list