X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fclient%2Fsimpleclient%2FSimpleClient.java;h=dc3df202e7522ad7625af856e261ea804ccf43ac;hb=e4bdd840d03dfca1ebc51818eb9c15400b06fd58;hp=ad742098ab59b9be852beaf1b038be703b673204;hpb=4af676753de2489148d92c834398ec88079bcf24;p=vamsas.git diff --git a/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java b/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java index ad74209..dc3df20 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java +++ b/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java @@ -61,7 +61,9 @@ public class SimpleClient implements IClient { * @return */ private IdFactory makeVorbaIdFactory() { - return new IdFactory(getSessionHandle(), client, user); + if (extantobjects==null) + extantobjects=new Hashtable(); + return new IdFactory(getSessionHandle(), client, user, extantobjects); } /** @@ -211,7 +213,7 @@ public class SimpleClient implements IClient { new Thread() { public void run() { SimpleClient.log.debug("Stopping pickManager.."); - dying.pickmanager.haltPickManager(); + dying.pickmanager.shutdown(); SimpleClient.log.debug("pickManager halted."); } }.start(); @@ -236,8 +238,9 @@ public class SimpleClient implements IClient { // if (handlers.containsKey(Events.)) // if (handlers.containsKey(Events.CLIENT_FINALIZATION)) // deregister listeners. + log.debug("Stopping pickManager"); haltPickmanager(); - SimpleClient.log.debug("Stopping EventGenerator.."); + log.debug("Stopping EventGenerator.."); evgen.stopWatching(); SimpleClient.log.debug("EventGenerator halted."); log.debug("Deregistering Client"); @@ -315,26 +318,21 @@ public class SimpleClient implements IClient { log.debug("updateDocument for "+session.getSessionUrn()+" with unmodified IClientDocument (skipping the write)"); } else { try { - if (!cdocument.updateSessionDocument()) { + boolean updated=cdocument.updateSessionDocument(); + if (!updated) { log.warn("Session document did not update properly for session directory "+_session.sessionDir); // cdocument.archive.cancelArchive(); // LATER: could be done - would need to prevent updateSessionDocument closing the iohandler. _session.slog.warn("Session Document updated but may not be valid (false return from org.vamsas.simpleclient.ClientDocument.updateSessionDocument()"); + } else { + log.debug("Document update successful."); } - 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."); @@ -343,6 +341,14 @@ public class SimpleClient implements IClient { 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."); + } } /*