import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/** {@link XAResource} for a user directory being edited. */
class WcXaResource implements XAResource {
- private final static Log log = LogFactory.getLog(WcXaResource.class);
-
private final AbstractUserDirectory userDirectory;
private Map<Xid, UserDirectoryWorkingCopy> workingCopies = new HashMap<Xid, UserDirectoryWorkingCopy>();
public synchronized void start(Xid xid, int flags) throws XAException {
if (editingXid != null)
throw new UserDirectoryException("Already editing " + editingXid);
- UserDirectoryWorkingCopy wc = workingCopies.put(xid,
- new UserDirectoryWorkingCopy());
+ UserDirectoryWorkingCopy wc = workingCopies.put(xid, new UserDirectoryWorkingCopy());
if (wc != null)
- throw new UserDirectoryException(
- "There is already a working copy for " + xid);
+ throw new UserDirectoryException("There is already a working copy for " + xid);
this.editingXid = xid;
}
return null;
UserDirectoryWorkingCopy wc = workingCopies.get(editingXid);
if (wc == null)
- throw new UserDirectoryException("No working copy found for "
- + editingXid);
+ throw new UserDirectoryException("No working copy found for " + editingXid);
return wc;
}
try {
userDirectory.prepare(wc);
} catch (Exception e) {
- log.error("Cannot prepare " + xid, e);
throw new XAException(XAException.XAER_RMERR);
}
return XA_OK;
userDirectory.prepare(wc);
userDirectory.commit(wc);
} catch (Exception e) {
- log.error("Cannot commit " + xid, e);
throw new XAException(XAException.XAER_RMERR);
} finally {
cleanUp(xid);
checkXid(xid);
userDirectory.rollback(wc(xid));
} catch (Exception e) {
- log.error("Cannot rollback " + xid, e);
throw new XAException(XAException.XAER_RMERR);
} finally {
cleanUp(xid);