From: jprocter Date: Mon, 21 May 2007 07:28:00 +0000 (+0000) Subject: test cdoc object retrieve by VorbaId and add timeout for hanging around (needs to... X-Git-Tag: Release_0.2~121 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d5ae6920a5b10289c55ccff8bf0aaf39c821a908;p=vamsas.git test cdoc object retrieve by VorbaId and add timeout for hanging around (needs to be a specific command) git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@399 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/uk/ac/vamsas/test/ExampleApplication.java b/src/uk/ac/vamsas/test/ExampleApplication.java index 6673129..3ac5cd3 100644 --- a/src/uk/ac/vamsas/test/ExampleApplication.java +++ b/src/uk/ac/vamsas/test/ExampleApplication.java @@ -67,14 +67,22 @@ public class ExampleApplication private boolean isFinalizing = false; private int totalUpdates = 9; + private uk.ac.vamsas.client.VorbaId recover = null; private void processVamsasDocument(IClientDocument doc) { if (doc.getVamsasRoots().length<4) { - doc.addVamsasRoot(Core.getDemoVamsas()); + doc.addVamsasRoot(Core.getDemoVamsas()); } else { try { uk.ac.vamsas.objects.core.DataSet ds = doc.getVamsasRoots()[1].getDataSet(0); uk.ac.vamsas.objects.core.AlignmentSequence alsq = ds.getAlignment(0).getAlignmentSequence(0); + if (recover==null) + { + recover = alsq.getVorbaId(); + } else { + Vobject recoverd = doc.getObject(recover); + System.out.println("Recovery of "+recover+" was "+((recoverd==null) ? "A FAILURE" : "SUCCESSFUL")); + } System.out.println("Modifying Sequence:\n"+alsq.hashCode()); alsq.setSequence(alsq.getSequence()+ds.getAlignment(0).getGapChar()); System.out.println("Modifying Sequence:\n"+alsq.hashCode()); @@ -262,7 +270,7 @@ public class ExampleApplication } } - + long shutdown = -1; public void runMe(String[] args) { if (!parseArgs(args)) @@ -372,10 +380,13 @@ public class ExampleApplication { System.out .println("Received |" + message.getRawMessage() + "|"); + shutdown +=100; // hang around for 5 seconds or so before dying naturally. + } }); } + shutdown = System.currentTimeMillis()+10000; // hang around for 10 seconds or so before dying naturally. while (!isShuttingdown && update < totalUpdates) { // do something with data @@ -388,6 +399,7 @@ public class ExampleApplication System.out .println("******************************************"); isUpdated = false; // TODO: saner update det method. + shutdown = System.currentTimeMillis()+10000; if (update % 2 == 1) { try @@ -402,6 +414,11 @@ public class ExampleApplication e.printStackTrace(System.err); } } + } else { + if (System.currentTimeMillis()>shutdown) + { + isShuttingdown=true; + } } try { Thread.sleep(50); }