X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Forg%2Fvamsas%2Fclient%2Fsimpleclient%2FEventGeneratorThread.java;fp=src%2Forg%2Fvamsas%2Fclient%2Fsimpleclient%2FEventGeneratorThread.java;h=d9aa1dba71c7cae02f5054ba2e84153039c9282c;hb=bca394759623e8a1e594a55f25b38b532c3c8337;hp=2a1db1fb417363862f0bbb89ece5109dc8b15390;hpb=674ab43cdfca110a2d0b2e6cfe2c2c3e8b33fd65;p=vamsas.git diff --git a/src/org/vamsas/client/simpleclient/EventGeneratorThread.java b/src/org/vamsas/client/simpleclient/EventGeneratorThread.java index 2a1db1f..d9aa1db 100644 --- a/src/org/vamsas/client/simpleclient/EventGeneratorThread.java +++ b/src/org/vamsas/client/simpleclient/EventGeneratorThread.java @@ -1,6 +1,7 @@ package org.vamsas.client.simpleclient; import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.Hashtable; @@ -172,17 +173,21 @@ public class EventGeneratorThread extends Thread implements Runnable { } - + private boolean block_document_updates=false; int STORE_WAIT=5; // how many units before we decide all clients have finalized their appdatas /** * client App requests offline storage of vamsas data. * Call blocks whilst other apps do any appData finalizing * and then returns (after locking the vamsasDocument in the session) + * Note - the calling app may also receive events through the EventGeneratorThread for document updates. + * * @return Lock for session.vamArchive * @param STORE_WAIT indicates how lock the call will block for when nothing appears to be happening to the session. */ protected Lock want_to_store() { + log.debug("Setting flag for document_update requests to be ignored"); + block_document_updates=true; log.debug("Waiting for other apps to do FinalizeApp handling."); try { session.addStoreDocumentRequest(client.getClientHandle(), client.getUserHandle()); @@ -191,7 +196,13 @@ public class EventGeneratorThread extends Thread implements Runnable { e); log.info("trying to continue."); } - + // LATER: refine this semaphore process + // to make a robust signalling mechanism: + // app1 requests, app1..n do something (or don't - they may be dead), + // app1 realises all apps have done their thing, it then continues with synchronized data. + // this probably needs two files - a request file, + // and a response file which is acknowledged by the app1 requestor for each app. + // eventually, no more responses are received for the request, and the app can then only continue with its store. int units = 0; while (units