From 54de284cf0c04cd8e0ca00c48d74257a55b1e617 Mon Sep 17 00:00:00 2001 From: pmarguerite Date: Fri, 18 May 2007 14:48:31 +0000 Subject: [PATCH] VamsasSession: insure the RemoveClientWatchCallBack handleWatchEvent method. no needed to check if there is no client in the client list,if the list does not have been modified git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@395 be28352e-c001-0410-b1a7-c7978e42abec --- .../vamsas/client/simpleclient/VamsasSession.java | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java index b066f88..dcffe57 100644 --- a/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java +++ b/src/uk/ac/vamsas/client/simpleclient/VamsasSession.java @@ -402,6 +402,8 @@ public class VamsasSession { public boolean handleWatchEvent(WatcherElement watcher, Lock lock) { boolean isWatchEnable = watcher.isWatchEnabled(); + if (lock== null)//no update on the list + return isWatchEnable; if (client != null) { @@ -504,18 +506,19 @@ public class VamsasSession { * @return true to enable watcher, or false to disable it in future WatcherThread cycles. */ public boolean handleWatchEvent(WatcherElement watcher, Lock lock) - { - // boolean isWatchEnable = watcher.isWatchEnabled(); - if (client != null) + { + // if lock is null, no client has been added since last, clear. + //the client is then the last client + if (client != null && lock == null) { //checks if the client is not already in the lists - ClientHandle[] cl = clist.retrieveClientList(lock);//clist.retrieveClientList(); + // ClientHandle[] cl = clist.retrieveClientList();//lock);//clist.retrieveClientList(); // ask to the client to cpoy application data into the document client.evgen._raise(Events.DOCUMENT_FINALIZEAPPDATA, null, client,null); - if(cl == null || cl.length<1 ) - {//no client has registered as active + // if(cl == null || cl.length<1 ) + // {//no client has registered as active //the client is the last one, so close current session log.info("last client removed: closing session"); @@ -525,20 +528,17 @@ public class VamsasSession { getSessionManager().removeSession(client.getSessionHandle()); log.debug("Session removed"); - } - else - { + } + else + { log.debug("not the last client found "); // ask to the client to cpoy application data into the document // client.evgen._raise(Events.DOCUMENT_FINALIZEAPPDATA, null, client,null); - } - // watcher.haltWatch(); - log.debug("Stopping EventGenerator.."); - client.evgen.stopWatching(); - - - } + // / } + log.debug("Stopping EventGenerator.."); + client.evgen.stopWatching(); + } watcher.setHandler(null);//Do not check if the client is the last client. watcher will shutdown anyway return false; -- 1.7.10.2