requesttoclose event is raised if session modified flag is set.
authorjprocter <jprocter@compbio.dundee.ac.uk>
Mon, 5 Nov 2007 16:17:14 +0000 (16:17 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Mon, 5 Nov 2007 16:17:14 +0000 (16:17 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@485 be28352e-c001-0410-b1a7-c7978e42abec

src/uk/ac/vamsas/client/simpleclient/VamsasSession.java

index a000f46..87e904a 100644 (file)
@@ -611,10 +611,15 @@ public class VamsasSession {
     client.evgen._raise(Events.DOCUMENT_FINALIZEAPPDATA, null, client, null);
     boolean closeSession = isLastActiveClient(client);
     if (closeSession) {
-      log.debug("Raising request-to-save event");
-      client.evgen._raise(Events.DOCUMENT_REQUESTTOCLOSE, null, client, null);
+      if (client.get_session().getUnsavedFlag())
+      {
+        log.debug("Raising request-to-save event");
+        client.evgen._raise(Events.DOCUMENT_REQUESTTOCLOSE, null, client, null);
+      }
+      log.debug("Raising session shutdown event");
       client.evgen._raise(Events.SESSION_SHUTDOWN, null, client
           .getSessionHandle(), null);
+      log.debug("All events raised for finalising session "+client.getSessionHandle().toString());
     }
     // cwe.haltWatch();
     client.evgen.stopWatching();
@@ -791,7 +796,7 @@ public class VamsasSession {
           // {//no client has registered as active
           if (islastClient) {
             // the client is the last one, so close current session
-            log.info("last client removed: closing session");
+            log.info("FROMCLIENTLIST WATCHER: last client removed: closing session");
             closeSession(client);
           }
         } else {