1 31 package org.objectweb.proactive.examples.futurelist; 32 33 import org.objectweb.proactive.core.config.ProActiveConfiguration; 34 35 public class TestFutureList { 36 37 public TestFutureList() { 38 super(); 39 } 40 41 42 public static void main(String [] args) { 43 BlockedObject blockedO = null; 44 FutureReceiver tf = null; 45 46 if (args.length < 2) { 47 System.err.println("Usage: TestFutureList hostName1/nodeName1 hostName2/nodeName2"); 48 System.exit(-1); 49 } 50 ProActiveConfiguration.load(); 51 52 System.out.println("This is designed to test the use of the future list"); 53 54 try { 55 blockedO = (BlockedObject)org.objectweb.proactive.ProActive.newActive(BlockedObject.class.getName(), null, args[0]); 56 tf = (FutureReceiver)org.objectweb.proactive.ProActive.newActive(FutureReceiver.class.getName(), null, args[1]); 57 } catch (Exception e) { 58 e.printStackTrace(); 59 } 60 61 62 tf.setBlockedObject(blockedO); 64 65 tf.createFutureList(); 67 68 tf.getFutureAndAddToFutureList(); 71 tf.getFutureAndAddToFutureList(); 72 tf.getFutureAndAddToFutureList(); 73 tf.getFutureAndAddToFutureList(); 74 75 System.out.println("*** Sleeping for 5 seconds"); 76 77 try { 78 Thread.sleep(5000); 79 } catch (Exception e) { 80 e.printStackTrace(); 81 } 82 83 tf.displayAwaited(); 84 tf.displayAllAwaited(); 85 tf.displayNoneAwaited(); 86 87 System.out.println("*** Sleeping for 1 seconds"); 88 try { 89 Thread.sleep(1000); 90 } catch (Exception e) { 91 e.printStackTrace(); 92 } 93 94 System.out.println("*** Asking the reply to the futures"); 95 97 tf.unblockOtherObject(); 99 tf.waitAndDisplayAllFuture(); 100 System.out.println("*** Sleeping for 5 seconds"); 106 try { 107 Thread.sleep(5000); 108 } catch (Exception e) { 109 e.printStackTrace(); 110 } 111 112 tf.displayAwaited(); 113 tf.displayAllAwaited(); 114 tf.displayNoneAwaited(); 115 tf.displayAllFutures(); 116 try { 118 Thread.sleep(5000); 119 } catch (Exception e) { 120 e.printStackTrace(); 121 } 122 123 System.out.println("*** Test over"); 124 } 125 } 126 | Popular Tags |