Class Chain

  • All Implemented Interfaces:
    java.lang.Runnable, EventSubscriber, Fiber.Worker

    public class Chain
    extends Task
    Set up a chain of tasks. Each task knows about its mailbox and that of the next in the chain, but is not given the other tasks ref. The main thread pushes an empty StringBuffer into the first task's mailbox, which writes "hello" into the buffer and passes the modified StringBuffer on to the next task, and so on. The last task appends "world", prints it out and exits. [compile] javac -d ./classes Chain.java [weave] java kilim.tools.Weave -d ./wclasses kilim.examples.Chain [run] java -cp ./wclasses:./classes:$CLASSPATH kilim.examples.Chain
    • Field Detail

      • mymb

        Mailbox<java.lang.StringBuffer> mymb
      • nextmb

        Mailbox<java.lang.StringBuffer> nextmb
    • Constructor Detail

      • Chain

        public Chain​(Mailbox<java.lang.StringBuffer> mb,
                     Mailbox<java.lang.StringBuffer> next)