abstract class ActiveProtocol extends ProtocolImpl with ManagedActivity with ProtocolUtils with Receiving with ListenerUtils with Runnable with LazyLogging with Tracing
Basic class for defining active protocols; those typically at the top of the protocol stack.
An active protocol must redefine the ActiveProtocol!.run method to implement the code of the protocol there. The code in run() can use several convenience methods, such as ActiveProtocol!.SEND, Receive, ProtocolUtils.me, ProtocolUtils.N, ProtocolUtils.ALL.
- Alphabetic
- By Inheritance
- ActiveProtocol
- Tracing
- LazyLogging
- Runnable
- ListenerUtils
- Listener
- Receiving
- Receiver
- ManagedActivity
- ProtocolImpl
- ProtocolUtils
- Protocol
- NamedEntity
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- 
      
      
      
        
      
    
      
        
        new
      
      
        ActiveProtocol(config: ProcessConfig, nickname: String = "unnamed")
      
      
      - config
- configutation information from the NekoProcess on which the ActiveProtocol is instantiated 
- nickname
- some nickname to describe the protocol 
 
Concrete Value Members
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        !=(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ##(): Int
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        +(other: String): String
      
      
      - Implicit
- This member is added by an implicit conversion from ActiveProtocol to any2stringadd[ActiveProtocol] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        -->(sender: Sender): Unit
      
      
      Connects a new sender to this protocol. Connects a new sender to this protocol. - sender
- the new sender to connect. 
 - Definition Classes
- ProtocolUtils
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        ->[B](y: B): (ActiveProtocol, B)
      
      
      - Implicit
- This member is added by an implicit conversion from ActiveProtocol to ArrowAssoc[ActiveProtocol] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ==(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        lazy val
      
      
        ALL: Set[PID]
      
      
      set of all processes in the system. set of all processes in the system. - Attributes
- protected[this]
- Definition Classes
- ProtocolUtils
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        BROADCAST(m: BroadcastMessage): Unit
      
      
      Broadcasts a message using the sender set in the initializer where the protocol is created. 
- 
      
      
      
        
      
    
      
        
        lazy val
      
      
        N: Int
      
      
      total number of processes running in the system. total number of processes running in the system. - Attributes
- protected[this]
- Definition Classes
- ProtocolUtils
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        RECEIVE(withTimeout: Time): Event
      
      
      Returns the next message in the receive queue, if any, or times out. Returns the next message in the receive queue, if any, or times out. If the receive queue is empty, the call blocks until a message arrives or the call times out, whichever occurs first. - withTimeout
- maximal duration until a timeout occurs. 
- returns
- A message if it receives one before the timeout, or Timeout if the timeout occurs. 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        RECEIVE(): Event
      
      
      Returns the next message in the receive queue, if any. Returns the next message in the receive queue, if any. If the receive queue is empty, the call blocks until a message arrives. - returns
- a message 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        SEND(m: Event): Unit
      
      
      Sends a message using the sender set in the initializer where the protocol is created. Sends a message using the sender set in the initializer where the protocol is created. If no sender was explicitly set, the message will be set directly through the network. The destination for the message is defined when the message is created. - m
- the message/signal to send 
 - Definition Classes
- ActiveProtocol → Receiving
 
- 
      
      
      
        
      
    
      
        
        val
      
      
        activityID: ActivityID
      
      
      - Attributes
- protected[this]
- Definition Classes
- ManagedActivity
 
- 
      
      
      
        
      
    
      
        
        val
      
      
        activityManager: ActivityManager
      
      
      - Attributes
- protected[this]
- Definition Classes
- ManagedActivity
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        asInstanceOf[T0]: T0
      
      
      - Definition Classes
- Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        clone(): AnyRef
      
      
      - Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        context: Some[PID]
      
      
      - Definition Classes
- Protocol → NamedEntity
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        deliver(event: Event): Unit
      
      
      - Definition Classes
- ActiveProtocol → Receiving → Receiver
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        dispatcher: Dispatcher
      
      
      dispatcher to be used when delivering messages. dispatcher to be used when delivering messages. Typically, this is the default dispatcher of the process. - returns
- dispatcher for message delivery 
 - Definition Classes
- ProtocolImpl
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        ensuring(cond: (ActiveProtocol) ⇒ Boolean, msg: ⇒ Any): ActiveProtocol
      
      
      - Implicit
- This member is added by an implicit conversion from ActiveProtocol to Ensuring[ActiveProtocol] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        ensuring(cond: (ActiveProtocol) ⇒ Boolean): ActiveProtocol
      
      
      - Implicit
- This member is added by an implicit conversion from ActiveProtocol to Ensuring[ActiveProtocol] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        ensuring(cond: Boolean, msg: ⇒ Any): ActiveProtocol
      
      
      - Implicit
- This member is added by an implicit conversion from ActiveProtocol to Ensuring[ActiveProtocol] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        ensuring(cond: Boolean): ActiveProtocol
      
      
      - Implicit
- This member is added by an implicit conversion from ActiveProtocol to Ensuring[ActiveProtocol] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        eq(arg0: AnyRef): Boolean
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        equals(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        eventTracer: EventTracer
      
      
      - Definition Classes
- ProtocolImpl
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        formatted(fmtstr: String): String
      
      
      - Implicit
- This member is added by an implicit conversion from ActiveProtocol to StringFormat[ActiveProtocol] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        getClass(): Class[_]
      
      
      - Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        hasPendingMessages: Boolean
      
      
      - Attributes
- protected[neko]
- Definition Classes
- ActiveProtocol → ManagedActivity
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        hashCode(): Int
      
      
      - Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
 
- 
      
      
      
        
      
    
      
        
        val
      
      
        id: ProtoID
      
      
      identifier of the protocol. identifier of the protocol. - returns
- identifier of the protocol 
 - Definition Classes
- ProtocolImpl → Protocol
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        isInstanceOf[T0]: Boolean
      
      
      - Definition Classes
- Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        listenTo(clazz: Class[_ <: Event]): Unit
      
      
      called by the protocol to declare that it will listen to messages/event of the given type. called by the protocol to declare that it will listen to messages/event of the given type. class MyProtocol(...) extends ... with ListenerUtils { listenTo(classOf[MyMessage]) listenTo(MyAlarm.getClass) def onReceive = { case MyMessage(...) => ... case MyAlarm => ... } } object MyProtocol { case class MyMessage(...) extends UnicastMessage(...) case object MyAlarm extends Signal - clazz
- type of the message/event to listen to 
 - Attributes
- protected[this]
- Definition Classes
- ListenerUtils → Listener
 
- 
      
      
      
        
      
    
      
        
        lazy val
      
      
        logger: Logger
      
      
      - Attributes
- protected
- Definition Classes
- LazyLogging
- Annotations
- @transient()
 
- 
      
      
      
        
      
    
      
        
        lazy val
      
      
        me: PID
      
      
      identifier of the process in which the protocol is running. identifier of the process in which the protocol is running. - Attributes
- protected[this]
- Definition Classes
- ProtocolUtils
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        name: String
      
      
      returns the name of the protocol returns the name of the protocol - returns
- name of the protocol 
 - Definition Classes
- Protocol → NamedEntity
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ne(arg0: AnyRef): Boolean
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        lazy val
      
      
        neighbors: Set[PID]
      
      
      set of processes that are direct neighbors to the process in which this instance of the protocol runs. set of processes that are direct neighbors to the process in which this instance of the protocol runs. - Attributes
- protected[this]
- Definition Classes
- ProtocolUtils
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        notify(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        notifyAll(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        onError(e: Throwable): Unit
      
      
      override this method to report on errors whens the protocol is forcibly terminated due to an an error or exception. override this method to report on errors whens the protocol is forcibly terminated due to an an error or exception. The method should never use any of the communication methods such as send, receive, or deliver. - Definition Classes
- Protocol
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        onFinish(): Unit
      
      
      override this method to perform take downs just after this process has finished. override this method to perform take downs just after this process has finished. - Definition Classes
- Protocol
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        onReceive: PartialFunction[Event, Unit]
      
      
      Implements the behavior of the protocol when receiving a message (or signal). Implements the behavior of the protocol when receiving a message (or signal). This must be defined in any concrete subclass. It is defined as a partial function taking a message as input and returning nothing. Typically, the partial function will implement different behavior depending on the type of message being sent. For instance, def onReceive = { case Token(from, _, _) if parent.isEmpty => parent = Some(from) children = (neighbors-from).toList DELIVER (Visit) visitNextChild() case Token(_, _, _) => visitNextChild() } - Definition Classes
- ActiveProtocol → Receiving
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        onShutdown(): Unit
      
      
      override this method to perform take downs after all processes have finished and before the process shuts down. override this method to perform take downs after all processes have finished and before the process shuts down. - Definition Classes
- Protocol
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        out: PrintWriter
      
      
      - Definition Classes
- ProtocolImpl
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        preStart(): Unit
      
      
      override this method to perform initializations just before the process begins to run. override this method to perform initializations just before the process begins to run. - Definition Classes
- Protocol
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        process: PID
      
      
      identifier of the process to which the protocol is attached. identifier of the process to which the protocol is attached. - returns
- identifier of the process 
 - Definition Classes
- ProtocolImpl → Protocol
 
-  def receive(withTimeout: Time): Option[Event]
-  def receive(): Event
- 
      
      
      
        
      
    
      
        
        def
      
      
        receiver: Receiver
      
      
      receiver to which this protocol delivers messages. receiver to which this protocol delivers messages. Typically, this is the message dispatcher of the process. - returns
- receiver to which messages are delivered 
 - Definition Classes
- ProtocolUtils
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        receiver_=(receiver: Receiver): Unit
      
      
      sets a new receiver to which this protocol will deliver messages. sets a new receiver to which this protocol will deliver messages. Normally, there is no need for the application programmer to use this, as the receiver is automatically set to a meaningful default value. - receiver
- new receiver to which messages will be delivered 
 - Definition Classes
- ProtocolUtils
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sender: Sender
      
      
      target sender that will handle Sending#send operations for this protocol. target sender that will handle Sending#send operations for this protocol. - returns
- target sender 
 - Definition Classes
- ProtocolUtils
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        senderOpt: Option[Sender]
      
      
      - Definition Classes
- ProtocolUtils
 
-  def setTrace[A](obj: A, nameOfVariable: String*)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[A], arg1: ClassTag[A]): Unit
- 
      
      
      
        
      
    
      
        
        def
      
      
        simpleName: String
      
      
      - Definition Classes
- Protocol → NamedEntity
 
-  def sleep(duration: Time): Unit
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        start(): Unit
      
      
      - Definition Classes
- ManagedActivity
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        synchronized[T0](arg0: ⇒ T0): T0
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        system: NekoSystem
      
      
      system in which the protocol is running. system in which the protocol is running. This gives access to some general information about the system, such as the total number of processes. - returns
- the system in which the protocol runs. 
 - Definition Classes
- ProtocolImpl → Protocol
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        toString(): String
      
      
      - Definition Classes
- ProtocolImpl → AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        val
      
      
        tracer: EventTracer
      
      
      - Attributes
- protected
- Definition Classes
- Tracing
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long, arg1: Int): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        willFinish(): Unit
      
      
      - Attributes
- protected[this]
- Definition Classes
- ManagedActivity
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        willWait(): Unit
      
      
      - Attributes
- protected[this]
- Definition Classes
- ManagedActivity
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        →[B](y: B): (ActiveProtocol, B)
      
      
      - Implicit
- This member is added by an implicit conversion from ActiveProtocol to ArrowAssoc[ActiveProtocol] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
 
- 
      
      
      
        
      
    
      
        
        object
      
      
        Receive
      
      
      Basic functionality for receiving together with pattern matching. Basic functionality for receiving together with pattern matching. Receiving is done either through Receive.apply or with Receive.withTimeout. Typical example: Receive { case Request(from, to, req) if (to-me).nonEmpty => SEND(Request(me, to-me, req)) SEND(Ack(me, from)) case Ack(from, _) => countAcks += 1 }or with a timeout: Receive.withTimeout(10.0) { case Request(from, to, req) if (to-me).nonEmpty => SEND(Request(me, to-me, req)) SEND(Ack(me, from)) case Ack(from, _) => countAcks += 1 case Timeout => SEND(Suspect(me, ALL-me)) }