_session.slog.warn("Session Document updated but may not be valid (false return from org.vamsas.simpleclient.ClientDocument.updateSessionDocument()");
}
log.debug("Document update successful.");
+ _session.setUnsavedFlag();
}
catch (IOException e) {
log.warn("IO Problems when updating document!",e);
_session.slog.error("IO problems when attempting to update document.");
}
}
- try {
- _session.setUnsavedFlag();
- _session.unlockVamsasDocument();
- evgen.enableDocumentWatch();
- } catch (IOException e) {
- log.warn("IO Problems when releasing lock on session document!",e);
- _session.slog.error("IO problems when attempting to release lock on session document.");
- }
// garbage collect the ClientDocument instance.
try {
log.debug("Finalizing ClientDocument instance.");
log.error("Exception when trying to garbage collect ClientDocument for "+session.getSessionUrn(), e);
}
cdocument = null; // this is probably done by finalize
+
+ try {
+ _session.unlockVamsasDocument();
+ evgen.enableDocumentWatch();
+ } catch (IOException e) {
+ log.warn("IO Problems when releasing lock on session document!",e);
+ _session.slog.error("IO problems when attempting to release lock on session document.");
+ }
}
/*
newdoc.unlockFile();
log.debug("Transfer complete.");
}
-
+ /**
+ * extant archive IO handler
+ */
+ VamsasArchive _va=null;
/**
* Creates a VamsasArchive Vobject for accessing and updating document
* Note: this will lock the Vamsas Document for exclusive access to the client.
* @throws IOException if locks fail or vamsas document read fails.
*/
protected VamsasArchive getVamsasDocument() throws IOException {
- // TODO: check we haven't already done this once - probably should be done by caller
+ // check we haven't already done this once - probably should be done by caller
+ if (_va!=null)
+ return _va;
// patiently wait for a lock on the document. (from ArchiveClient.getUpdateable())
long tries=5000;
while (vamArchive.getLock()==null && --tries>0) {
* @throws IOException
*/
protected void unlockVamsasDocument() throws IOException {
+ if (_va!=null)
+ _va.closeArchive();
+ _va=null;
if (vamArchive!=null)
vamArchive.unLock();
+
}
/**
* create a uniquely named uk.ac.vamsas.client.simpleclient.ClientsFile.addClient(ClientHandle)ile in the session Directory