From bca394759623e8a1e594a55f25b38b532c3c8337 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 15 Mar 2006 19:35:11 +0000 Subject: [PATCH] adding various state flags for events git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@181 be28352e-c001-0410-b1a7-c7978e42abec --- docs/VamsasSessionEventAnalysis.xls | Bin 12288 -> 27648 bytes .../client/simpleclient/EventGeneratorThread.java | 46 ++++++++++++++++++-- .../vamsas/client/simpleclient/FileWatcher.java | 17 ++++++++ .../vamsas/client/simpleclient/SimpleClient.java | 7 ++- .../vamsas/client/simpleclient/VamsasSession.java | 9 ++++ 5 files changed, 74 insertions(+), 5 deletions(-) diff --git a/docs/VamsasSessionEventAnalysis.xls b/docs/VamsasSessionEventAnalysis.xls index 2ddf60a4f5b40eef548fbd70c18ece9af7774a7e..dbc3c6d948c088f7510be96e0e906eea6d585f24 100644 GIT binary patch literal 27648 zcmeHQYiu0Xbv`>Bl9DV-)WeoVy+$uXh@bSQdQH~RfoGn?ncX< z_0Fzr77f5S4UifNP}hM20zrxZMSvoJo2ICn8bvD?1=OGl+y)Jd^p}%9fFk+fI8I@s zw%PBy_s;C>a!FAy+sf|9GduUrea)S7zH{!m=g|N1`kFVt`4^o(k(%QXX^{`-mP=bK zKY{zcFx???0Qb!MaBgmn+4thaZS%N=W?=cUWg@Mul3V`$b`rsBV&VGtI4|P-Db6Ql zo2+>}JLQ}#`l*svbdrxf{%DsIKORM;@7Q0*b(P$SYpZOKWzyC%n(@5Sf!KXt?7n{k zN+upuS9>GwMb@h8I(2;*DITw;y7wPccM16|>#%zE6?NUAuB&iO$X_Q||KC;40a+*i zgw!(mBT^?0d(_PbH#2*yy&f;UX4lT1ojdoR?K+gycU@cYVr_C~l>gaNUizuZ!%k_J z4fL#og_GGH5&MLLu6hI1& zU(Gpk(NVX;Jbpvuy>q2J5g4s*$?L9@w|rh6 z=L-Fv{IbnEQQwHa30Yew&*_MdMVH%Br(9>9yzY8=QF||1wsg$2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j7?b7p)9I< zYHmq&!mMfCOLN=Ks9$qx4e|Bj92(-wmE>!!K^;NfA`QueSic&|Bg9^*Aw3~FrVL`+ zFR+>eep3jJxl6to-yncq7v+?^vLrf(ZW)N4(Zy4@Vy$p(X5i?77 z5i>b0GgVJh`5Iy-Ta$*EX#&d6P%}5S3k@-q@2ZBF%3i}r^)~eltRZHShBJN4^kfjP z+X*GRh?%_19A`TUofKnhdoDek_NL|Z*E?%FIUeO785LcsM`@C+(Y}_sx@wbRQ6Dh*d35R4{xB0G0dHj!LhyIFu zBfUCSnwm=JdD~V2m!?+4M^?NuwWK#uWW$C_(<@Rd{x$tfYEqV3Y4i(HYDSTH0<4-* Tiqx5SHfk&c{@#9j;7#ctl;N)H 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 (units0) { + //TODO: check vamsas document for presence of an AppData entry for this application + //evgen.raise(Events.DOCUMENT_CREATE); + } } diff --git a/src/org/vamsas/client/simpleclient/VamsasSession.java b/src/org/vamsas/client/simpleclient/VamsasSession.java index 1424ee8..7971f57 100644 --- a/src/org/vamsas/client/simpleclient/VamsasSession.java +++ b/src/org/vamsas/client/simpleclient/VamsasSession.java @@ -62,6 +62,13 @@ public class VamsasSession { */ public static final String CLOSEANDSAVE_FILE="stored.log"; /** + * state of vamsas document when it was last stored outside the session directory + */ + protected long last_stored_stat[]=null; + protected void updateLastStoredStat() { + + } + /** * log file location */ public static final String SESSION_LOG="Log.txt"; @@ -211,6 +218,8 @@ public class VamsasSession { } /** * write session as a new vamsas Document (this will overwrite any existing file without warning) + * TODO: test + * TODO: verify that lock should be released for vamsas document. * @param destarchive */ protected void writeVamsasDocument(File destarchive, Lock extlock) throws IOException { -- 1.7.10.2