Used both in the program's main method and in testing to send a request to an actor and wait for a response.
Factorial factorial = new Factorial(mailboxFactory.createMailbox()); JAFuture future = new JAFuture(); future.send(factorial, null);
1920212223242526272829
Doer doer = new Doer(); doer.initialize(doerMailbox); Driver driver = new Driver(); driver.initialize(driverMailbox); driver.doer = doer; JAFuture future = new JAFuture(); try { Go1.req.send(future, driver); } catch (Throwable e) { System.out.println("Go1: " + e.getMessage()); }
1819202122232425262728
Doer doer = new Doer(); doer.initialize(sharedMailbox); Driver driver = new Driver(); driver.initialize(sharedMailbox); driver.doer = doer; JAFuture future = new JAFuture(); try { System.out.println("Test Go1"); Go1.req.send(future, driver); } catch (Throwable e) { System.out.println("Go1: " + e.getMessage());
Doer doer = new Doer(); doer.initialize(doerMailbox); Driver driver = new Driver(); driver.initialize(driverMailbox); driver.doer = doer; JAFuture future = new JAFuture(); try { System.out.println("Test Go1"); Go1.req.send(future, driver); } catch (Throwable e) { System.out.println("Go1: " + e.getMessage());
1516171819202122232425
public void test() { MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { IfV actor = new IfV(); actor.initialize(mailboxFactory.createMailbox()); JAFuture future = new JAFuture(); System.out.println(SimpleRequest.req.send(future, actor)); } catch (Throwable e) { e.printStackTrace(); } finally { mailboxFactory.close();
public void test() { MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { Send actor = new Send(); actor.initialize(mailboxFactory.createMailbox()); JAFuture future = new JAFuture(); System.out.println(SimpleRequest.req.send(future, actor)); } catch (Throwable e) { e.printStackTrace(); } finally { mailboxFactory.close();
1314151617181920212223
*/ public class ReturnFTest extends TestCase { public void test() { MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { JAFuture future = new JAFuture(); ReturnF1 actor1 = new ReturnF1(); actor1.initialize(mailboxFactory.createMailbox()); System.out.println(SimpleRequest.req.send(future, actor1)); ReturnF2 actor2 = new ReturnF2(); actor2.initialize(mailboxFactory.createMailbox());
1617181920212223242526272829
MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { Mailbox mailbox = mailboxFactory.createMailbox(); Calculator calculator = new Calculator(); calculator.initialize(mailbox); JAFuture future = new JAFuture(); future.send(calculator, new Set(1)); future.send(calculator, new Add(2)); System.err.println(future.send(calculator, new Multiply(3))); } catch (Throwable e) { e.printStackTrace(); } finally { mailboxFactory.close(); }
3435363738394041424344
MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { Mailbox mailbox = mailboxFactory.createMailbox(); Driver1 driver = new Driver1(); driver.initialize(mailbox); JAFuture future = new JAFuture(); System.err.println(SimpleRequest.req.send(future, driver)); } catch (Throwable e) { e.printStackTrace(); } finally { mailboxFactory.close();
5051525354555657585960
MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { Mailbox mailbox = mailboxFactory.createMailbox(); Driver2 driver = new Driver2(); driver.initialize(mailbox); JAFuture future = new JAFuture(); System.err.println(SimpleRequest.req.send(future, driver)); } catch (Throwable e) { e.printStackTrace(); } finally { mailboxFactory.close();