# PSF-LoginServer - master - net.psforever.objects.guid.actor.UniqueNumberSystem
PSF - LoginServer - master - net.psforever.objects.guid.actor.UniqueNumberSystem
Keywords: PSF LoginServer master net.psforever.objects.guid.actor.UniqueNumberSystem

PSF-LoginServer - master < Back


# Packages

-  package root
  Definition Classes
    root
-  package net
  Definition Classes
    root
-  package psforever
  Definition Classes
    net
-  package objects
  Definition Classes
    psforever
-  package guid
  Definition Classes
    objects
-  package actor
  Definition Classes
    guid
- NumberPoolActor
- Register
- UniqueNumberSystem
- Unregister

c

net.psforever.objects.guid.actor

# UniqueNumberSystem 

###
Companion object UniqueNumberSystem

#### class UniqueNumberSystem extends Actor

An `Actor` that wraps around converted `NumberPool`s and synchronizes a portion of the number registration process. The ultimate goal is to manage a coherent group of unique identifiers for a given "region" (`Zone`). Both parts of the UID system sit atop the `Zone` for easy external access. The plain part - the `NumberPoolHub` here - is used for low-priority requests such as checking for existing associations. This `Actor` is the involved portion that paces registration and unregistration.
A four part process is used for object registration tasks. First, the requested `NumberPool` is located among the list of known `NumberPool`s. Second, an asynchronous request is sent to that pool to retrieve a number. (Only any number. Only a failing case allows for selection of a specific number.) Third, the asynchronous request returns and the original information about the request is recovered. Fourth, both sides of the contract are completed by the object being assigned the number and the underlying "number source" is made to remember an association between the object and the number. Short circuits and recoveries as available on all steps though reporting is split between logging and callbacks. The process of removing the association between a number and object (unregistering) is a similar four part process.
The important relationship between this `Actor` and the `Map` of `NumberPoolActors` is an "gate." A single `Map` is constructed and shared between multiple entry points to the UID system where requests are messaged. Multiple entry points send messages to the same `NumberPool`. That `NumberPool` deals with the messages one at a time and sends reply to each entry point that communicated with it. This process is almost as fast as the process of the `NumberPool` selecting a number. (At least, both should be fast.)

Source
  UniqueNumberSystem.scala

Linear Supertypes
Actor, AnyRef, Any

Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. UniqueNumberSystem
2. Actor
3. AnyRef
4. Any

1. Hide All
2. Show All

Visibility

1. Public
2. Protected

### Instance Constructors

1.  new UniqueNumberSystem(guid: NumberPoolHub, poolActors: Map[String, ActorRef])

   guid

     the `NumberPoolHub` that is partially manipulated by this `Actor`

   poolActors

     a common mapping created from the `NumberPool`s in `guid`; there is currently no check for this condition save for requests failing

### Type Members

1.  type Receive = PartialFunction[Any, Unit]
   Definition Classes
     Actor

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##: Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  def aroundPostRestart(reason: Throwable): Unit
   Attributes
     protected[akka]
   Definition Classes
     Actor
   Annotations
     @InternalApi()
5.  def aroundPostStop(): Unit
   Attributes
     protected[akka]
   Definition Classes
     Actor
   Annotations
     @InternalApi()
6.  def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit
   Attributes
     protected[akka]
   Definition Classes
     Actor
   Annotations
     @InternalApi()
7.  def aroundPreStart(): Unit
   Attributes
     protected[akka]
   Definition Classes
     Actor
   Annotations
     @InternalApi()
8.  def aroundReceive(receive: akka.actor.Actor.Receive, msg: Any): Unit
   Attributes
     protected[akka]
   Definition Classes
     Actor
   Annotations
     @InternalApi()
9.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
10.  def clone(): AnyRef
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.CloneNotSupportedException]) @native()
11.  implicit val context: ActorContext
    Definition Classes
      Actor
12.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
13.  def equals(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef → Any
14.  def finalize(): Unit
    Attributes
      protected[lang]
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.Throwable])
15.  final def getClass(): Class[_ <: AnyRef]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
16.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
17.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
18.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
19.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
20.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
21.  def postRestart(reason: Throwable): Unit
    Definition Classes
      Actor
    Annotations
      @throws(classOf[java.lang.Exception])
22.  def postStop(): Unit
    Definition Classes
      Actor
    Annotations
      @throws(classOf[java.lang.Exception])
23.  def preRestart(reason: Throwable, message: Option[Any]): Unit
    Definition Classes
      Actor
    Annotations
      @throws(classOf[java.lang.Exception])
24.  def preStart(): Unit
    Definition Classes
      Actor
    Annotations
      @throws(classOf[java.lang.Exception])
25.  def receive: Receive
    Definition Classes
      UniqueNumberSystem → Actor
26.  implicit final val self: ActorRef
    Definition Classes
      Actor
27.  final def sender(): ActorRef
    Definition Classes
      Actor
28.  def supervisorStrategy: SupervisorStrategy
    Definition Classes
      Actor
29.  final def synchronized[T0](arg0: => T0): T0
    Definition Classes
      AnyRef
30.  def toString(): String
    Definition Classes
      AnyRef → Any
31.  def unhandled(message: Any): Unit
    Definition Classes
      Actor
32.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
33.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException])
34.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws(classOf[java.lang.InterruptedException]) @native()

### Inherited from Actor

### Inherited from AnyRef

### Inherited from Any

### Ungrouped