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);
1314151617181920212223
*/ public class ReturnVTest extends TestCase { public void test() { MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { JAFuture future = new JAFuture(); ReturnV1 actor1 = new ReturnV1(); actor1.initialize(mailboxFactory.createMailbox()); System.out.println(SimpleRequest.req.send(future, actor1)); ReturnV2 actor2 = new ReturnV2(); actor2.initialize(mailboxFactory.createMailbox());
1516171819202122232425
public void test() { MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { SetV1 actor = new SetV1(); actor.initialize(mailboxFactory.createMailbox()); JAFuture future = new JAFuture(); System.out.println(SimpleRequest.req.send(future, actor)); } catch (Throwable e) { e.printStackTrace(); } finally { mailboxFactory.close();
151617181920212223
Mailbox mailbox = mailboxFactory.createMailbox(); Actor1 actor1 = new Actor1(); actor1.initialize(mailbox); Actor2 actor2 = new Actor2(); actor2.initialize(mailbox, actor1); JAFuture future = new JAFuture(); Greet1.req.send(future, actor2); mailboxFactory.close(); }
public void test() { MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1); try { It actor = new It(); actor.initialize(mailboxFactory.createMailbox()); JAFuture future = new JAFuture(); System.out.println(SimpleRequest.req.send(future, actor)); } catch (Throwable e) { e.printStackTrace(); } finally { mailboxFactory.close();
13141516171819202122
public void test() throws Exception { MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(10); Mailbox mailbox = mailboxFactory.createMailbox(); Actor5a actor5a = new Actor5a(); actor5a.initialize(mailbox); JAFuture future = new JAFuture(); boolean response = Parallel.req.send(future, actor5a); assertEquals(true, response); mailboxFactory.close(); }
1617181920212223242526
Mailbox mailbox = mailboxFactory.createMailbox(); Greeter a = new Greeter(); a.initialize(mailbox); ResponsePrinter b = new ResponsePrinter(); b.initialize(mailbox); JAFuture future = new JAFuture(); (new PrintResponse(new Hi(), a)).send(future, b); } catch (Throwable e) { e.printStackTrace(); } finally { System.out.println("end ResponsePrinterTest 1");
3637383940414243444546
Mailbox mailbox2 = mailboxFactory.createMailbox(); Greeter a = new Greeter(); a.initialize(mailbox1); ResponsePrinter b = new ResponsePrinter(); b.initialize(mailbox2); JAFuture future = new JAFuture(); (new PrintResponse(new Hi(), a)).send(future, b); } catch (Throwable e) { e.printStackTrace(); } finally { System.out.println("end ResponsePrinterTest 2");
5657585960616263646566
Mailbox mailbox2 = mailboxFactory.createAsyncMailbox(); Greeter a = new Greeter(); a.initialize(mailbox1); ResponsePrinter b = new ResponsePrinter(); b.initialize(mailbox2); JAFuture future = new JAFuture(); (new PrintResponse(new Hi(), a)).send(future, b); } catch (Throwable e) { e.printStackTrace(); } finally { System.out.println("end ResponsePrinterTest 3");
8485868788899091929394
bs[i] = b; i += 1; } ParallelResponsePrinter c = new ParallelResponsePrinter(); c.initialize(mailboxFactory.createMailbox()); JAFuture future = new JAFuture(); PrintResponse printResponse = new PrintResponse(new Hi(), a); PrintParallelResponse printParallelResponse = new PrintParallelResponse(count, bs, printResponse); printParallelResponse.send(future, c); } catch (Throwable e) { e.printStackTrace();
114115116117118119120121122123124
bs[i] = b; i += 1; } ParallelResponsePrinter c = new ParallelResponsePrinter(); c.initialize(mailboxFactory.createMailbox()); JAFuture future = new JAFuture(); PrintResponse printResponse = new PrintResponse(new Hi(), a); PrintParallelResponse printParallelResponse = new PrintParallelResponse(count, bs, printResponse); int j = 0; while (j < 1) { printParallelResponse.send(future, c);