Package akka.actor

Class Props

  • All Implemented Interfaces:
    java.io.Serializable, scala.Equals, scala.Product

    public final class Props
    extends java.lang.Object
    implements scala.Product, java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Props​(Deploy deploy, java.lang.Class<?> clazz, scala.collection.immutable.Seq<java.lang.Object> args)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class<? extends Actor> actorClass()
      Obtain an upper-bound approximation of the actor class which is going to be created by these Props.
      static Props apply​(Deploy deploy, java.lang.Class<?> clazz, scala.collection.immutable.Seq<java.lang.Object> args)
      Props is a configuration object using in creating an Actor; it is immutable, so it is thread-safe and fully shareable.
      static Props apply​(java.lang.Class<?> clazz, scala.collection.immutable.Seq<java.lang.Object> args)
      Scala API: create a Props given a class and its constructor arguments.
      static <T extends Actor>
      Props
      apply​(scala.Function0<T> creator, scala.reflect.ClassTag<T> evidence$2)
      Scala API: Returns a Props that has default values except for "creator" which will be a function that creates an instance using the supplied thunk.
      static <T extends Actor>
      Props
      apply​(scala.reflect.ClassTag<T> evidence$1)
      Scala API: Returns a Props that has default values except for "creator" which will be a function that creates an instance of the supplied type using the default constructor.
      scala.collection.immutable.Seq<java.lang.Object> args()  
      boolean canEqual​(java.lang.Object x$1)  
      java.lang.Class<?> clazz()  
      Props copy​(Deploy deploy, java.lang.Class<?> clazz, scala.collection.immutable.Seq<java.lang.Object> args)  
      Deploy copy$default$1()  
      java.lang.Class<?> copy$default$2()  
      scala.collection.immutable.Seq<java.lang.Object> copy$default$3()  
      static <T extends Actor>
      Props
      create​(Creator<T> creator)  
      static Props create​(java.lang.Class<?> clazz, java.lang.Object... args)  
      static Props create​(java.lang.Class<?> clazz, scala.collection.immutable.Seq<java.lang.Object> args)  
      static <T extends Actor>
      Props
      create​(java.lang.Class<T> actorClass, Creator<T> creator)  
      static scala.Function0<Actor> defaultCreator()
      The defaultCreator, simply throws an UnsupportedOperationException when applied, which is used when creating a Props
      static Deploy defaultDeploy()
      The default Deploy instance which is used when creating a Props
      static RouterConfig defaultRoutedProps()
      The defaultRoutedProps is NoRouter which is used when creating a Props
      Deploy deploy()  
      java.lang.String dispatcher()
      Convenience method for extracting the dispatcher information from the contained Deploy instance.
      static Props empty()
      A Props instance whose creator will create an actor that doesn't respond to any message
      boolean equals​(java.lang.Object x$1)  
      int hashCode()  
      java.lang.String mailbox()
      Convenience method for extracting the mailbox information from the contained Deploy instance.
      int productArity()  
      java.lang.Object productElement​(int x$1)  
      java.lang.String productElementName​(int x$1)  
      scala.collection.Iterator<java.lang.Object> productIterator()  
      java.lang.String productPrefix()  
      RouterConfig routerConfig()
      Convenience method for extracting the router configuration from the contained Deploy instance.
      java.lang.String toString()  
      static scala.Option<scala.Tuple3<Deploy,​java.lang.Class<?>,​scala.collection.immutable.Seq<java.lang.Object>>> unapply​(Props x$0)  
      Props withActorTags​(java.lang.String... tags)
      Returns a new Props with the specified set of tags.
      Props withActorTags​(scala.collection.immutable.Seq<java.lang.String> tags)
      Returns a new Props with the specified set of tags.
      Props withActorTags​(scala.collection.immutable.Set<java.lang.String> tags)
      Scala API: Returns a new Props with the specified set of tags.
      Props withDeploy​(Deploy d)
      Returns a new Props with the specified deployment configuration.
      Props withDispatcher​(java.lang.String d)
      Returns a new Props with the specified dispatcher set.
      Props withMailbox​(java.lang.String m)
      Returns a new Props with the specified mailbox set.
      Props withRouter​(RouterConfig r)
      Returns a new Props with the specified router config set.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface scala.Product

        productElementNames
    • Constructor Detail

      • Props

        public Props​(Deploy deploy,
                     java.lang.Class<?> clazz,
                     scala.collection.immutable.Seq<java.lang.Object> args)
    • Method Detail

      • defaultCreator

        public static final scala.Function0<Actor> defaultCreator()
        The defaultCreator, simply throws an UnsupportedOperationException when applied, which is used when creating a Props
      • defaultRoutedProps

        public static final RouterConfig defaultRoutedProps()
        The defaultRoutedProps is NoRouter which is used when creating a Props
      • defaultDeploy

        public static final Deploy defaultDeploy()
        The default Deploy instance which is used when creating a Props
      • empty

        public static final Props empty()
        A Props instance whose creator will create an actor that doesn't respond to any message
      • apply

        public static <T extends ActorProps apply​(scala.reflect.ClassTag<T> evidence$1)
        Scala API: Returns a Props that has default values except for "creator" which will be a function that creates an instance of the supplied type using the default constructor.
      • apply

        public static <T extends ActorProps apply​(scala.Function0<T> creator,
                                                    scala.reflect.ClassTag<T> evidence$2)
        Scala API: Returns a Props that has default values except for "creator" which will be a function that creates an instance using the supplied thunk.

        CAVEAT: Required mailbox type cannot be detected when using anonymous mixin composition when creating the instance. For example, the following will not detect the need for DequeBasedMessageQueueSemantics as defined in Stash:

        
         'Props(new Actor with Stash { ... })
         
        Instead you must create a named class that mixin the trait, e.g. class MyActor extends Actor with Stash.
      • apply

        public static Props apply​(java.lang.Class<?> clazz,
                                  scala.collection.immutable.Seq<java.lang.Object> args)
        Scala API: create a Props given a class and its constructor arguments.
      • apply

        public static Props apply​(Deploy deploy,
                                  java.lang.Class<?> clazz,
                                  scala.collection.immutable.Seq<java.lang.Object> args)
        Props is a configuration object using in creating an Actor; it is immutable, so it is thread-safe and fully shareable.

        Examples on Scala API:

        
          val props = Props.empty
          val props = Props[MyActor]
          val props = Props(classOf[MyActor], arg1, arg2)
        
          val otherProps = props.withDispatcher("dispatcher-id")
          val otherProps = props.withDeploy(<deployment info>)
         

        Examples on Java API:

        
          final Props props = Props.empty();
          final Props props = Props.create(MyActor.class, arg1, arg2);
        
          final Props otherProps = props.withDispatcher("dispatcher-id");
          final Props otherProps = props.withDeploy(<deployment info>);
         
      • unapply

        public static scala.Option<scala.Tuple3<Deploy,​java.lang.Class<?>,​scala.collection.immutable.Seq<java.lang.Object>>> unapply​(Props x$0)
      • create

        public static Props create​(java.lang.Class<?> clazz,
                                   scala.collection.immutable.Seq<java.lang.Object> args)
      • create

        public static <T extends ActorProps create​(java.lang.Class<T> actorClass,
                                                     Creator<T> creator)
      • create

        public static Props create​(java.lang.Class<?> clazz,
                                   java.lang.Object... args)
      • withActorTags

        public Props withActorTags​(java.lang.String... tags)
        Returns a new Props with the specified set of tags.
      • deploy

        public Deploy deploy()
      • clazz

        public java.lang.Class<?> clazz()
      • args

        public scala.collection.immutable.Seq<java.lang.Object> args()
      • dispatcher

        public java.lang.String dispatcher()
        Convenience method for extracting the dispatcher information from the contained Deploy instance.
      • mailbox

        public java.lang.String mailbox()
        Convenience method for extracting the mailbox information from the contained Deploy instance.
      • routerConfig

        public RouterConfig routerConfig()
        Convenience method for extracting the router configuration from the contained Deploy instance.
      • withDispatcher

        public Props withDispatcher​(java.lang.String d)
        Returns a new Props with the specified dispatcher set.
      • withMailbox

        public Props withMailbox​(java.lang.String m)
        Returns a new Props with the specified mailbox set.
      • withRouter

        public Props withRouter​(RouterConfig r)
        Returns a new Props with the specified router config set.
      • withDeploy

        public Props withDeploy​(Deploy d)
        Returns a new Props with the specified deployment configuration.
      • withActorTags

        public Props withActorTags​(scala.collection.immutable.Seq<java.lang.String> tags)
        Returns a new Props with the specified set of tags.
      • withActorTags

        public Props withActorTags​(scala.collection.immutable.Set<java.lang.String> tags)
        Scala API: Returns a new Props with the specified set of tags.
      • actorClass

        public java.lang.Class<? extends Actor> actorClass()
        Obtain an upper-bound approximation of the actor class which is going to be created by these Props. In other words, the actor factory method will produce an instance of this class or a subclass thereof. This is used by the actor system to select special dispatchers or mailboxes in case dependencies are encoded in the actor type.
      • copy

        public Props copy​(Deploy deploy,
                          java.lang.Class<?> clazz,
                          scala.collection.immutable.Seq<java.lang.Object> args)
      • copy$default$1

        public Deploy copy$default$1()
      • copy$default$2

        public java.lang.Class<?> copy$default$2()
      • copy$default$3

        public scala.collection.immutable.Seq<java.lang.Object> copy$default$3()
      • productPrefix

        public java.lang.String productPrefix()
        Specified by:
        productPrefix in interface scala.Product
      • productArity

        public int productArity()
        Specified by:
        productArity in interface scala.Product
      • productElement

        public java.lang.Object productElement​(int x$1)
        Specified by:
        productElement in interface scala.Product
      • productIterator

        public scala.collection.Iterator<java.lang.Object> productIterator()
        Specified by:
        productIterator in interface scala.Product
      • canEqual

        public boolean canEqual​(java.lang.Object x$1)
        Specified by:
        canEqual in interface scala.Equals
      • productElementName

        public java.lang.String productElementName​(int x$1)
        Specified by:
        productElementName in interface scala.Product
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object x$1)
        Specified by:
        equals in interface scala.Equals
        Overrides:
        equals in class java.lang.Object