X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fclient%2Fsimpleclient%2FVamsasSession.java;fp=src%2Fuk%2Fac%2Fvamsas%2Fclient%2Fsimpleclient%2FVamsasSession.java;h=05014abad6c3565502e0520a017b57ee09bec456;hb=8879baa96b917d81b39fee0c2e2cc9e5021865bc;hp=c84989320f072370a4c39a4592c81759ed3df9e4;hpb=ceda0a11dbde684306f712a151414ff6230eb8ef;p=vamsas.git diff --git a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java index c849893..05014ab 100644 --- a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java +++ b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java @@ -294,7 +294,10 @@ public class VamsasSession { 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. @@ -302,7 +305,9 @@ public class VamsasSession { * @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) { @@ -321,8 +326,12 @@ public class VamsasSession { * @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