Class ConnectionRegistry

java.lang.Object
org.nustaq.kontraktor.remoting.base.ConnectionRegistry

public abstract class ConnectionRegistry extends Object
Created by moelrue on 5/7/15. Manages mapping of remote refs and callbacks of a single connection. E.g. if an actor ref or callback or spore is sent to a remote actor, during serialization ConnectionRegistry generates and maps the callback id's required to later on route incoming messages from remote to the appropriate local instances
  • Field Details

  • Constructor Details

    • ConnectionRegistry

      public ConnectionRegistry(org.nustaq.serialization.FSTConfiguration conf, Coding coding)
    • ConnectionRegistry

      public ConnectionRegistry(Coding code)
  • Method Details

    • registerDefaultClassMappings

      public static void registerDefaultClassMappings(org.nustaq.serialization.FSTConfiguration conf)
    • IsJsonConfiguration

      public static boolean IsJsonConfiguration(org.nustaq.serialization.FSTConfiguration conf)
    • getRemoteCallInterceptor

      public BiFunction<Actor,String,Boolean> getRemoteCallInterceptor()
    • configureSerialization

      protected void configureSerialization(Coding code)
    • getOpenRemoteMappingsCount

      public int getOpenRemoteMappingsCount()
    • getPublishedActor

      public Actor getPublishedActor(long id)
    • getPublishedCallback

      public Callback getPublishedCallback(long id)
    • getScheduler

      public RemoteScheduler getScheduler()
    • getRemoteActors

      public ConcurrentLinkedQueue<Actor> getRemoteActors()
    • getRemoteActorMap

      public ConcurrentHashMap<Long,Actor> getRemoteActorMap()
    • isTerminated

      public boolean isTerminated()
    • setTerminated

      public void setTerminated(boolean terminated)
    • publishActor

      public long publishActor(Actor act)
    • unpublishActor

      public void unpublishActor(Actor act)
      remove current <remoteId,actor> mappings if present. return map containing removed mappings (for reconnection)
      Parameters:
      act -
    • registerPublishedCallback

      public long registerPublishedCallback(Callback cb)
    • removePublishedObject

      public void removePublishedObject(long receiverKey)
    • registerRemoteRefDirect

      public void registerRemoteRefDirect(Actor act)
    • registerRemoteActorRef

      public Actor registerRemoteActorRef(Class actorClazz, long remoteId, Object client)
    • remoteRefStopped

      protected void remoteRefStopped(Actor actor)
      warning: MThreaded
      Parameters:
      actor -
    • stopRemoteRefs

      public void stopRemoteRefs()
    • removeRemoteActor

      protected void removeRemoteActor(Actor act)
    • receiveObject

      public boolean receiveObject(ObjectSocket responseChannel, ObjectSink receiver, Object response, List<IPromise> createdFutures, Object authContext) throws Exception
      process a remote call entry or an array of remote call entries.
      Parameters:
      responseChannel - - writer required to route callback messages
      response -
      createdFutures - - can be null. Contains futures created by the submitted callsequence
      authContext -
      Returns:
      Throws:
      Exception
    • processRemoteCallEntry

      protected boolean processRemoteCallEntry(ObjectSocket objSocket, RemoteCallEntry response, List<IPromise> createdFutures, Object authContext) throws Exception
      Throws:
      Exception
    • cleanUp

      public void cleanUp()
      cleanup after (virtual) connection close
    • disconnect

      public void disconnect()
      called from ObjectSocket in case of disconnect (decoding errors or network issues)
    • closeRef

      protected void closeRef(CallEntry ce, ObjectSocket chan) throws IOException
      Throws:
      IOException
    • writeObject

      protected void writeObject(ObjectSocket chan, RemoteCallEntry rce) throws Exception
      Throws:
      Exception
    • inFacadeThread

      public void inFacadeThread(Runnable toRun)
    • forwardRemoteMessage

      public void forwardRemoteMessage(RemoteCallEntry rce)
    • receiveCBResult

      public void receiveCBResult(ObjectSocket chan, long id, Object result, Object error)
    • close

      public void close(Actor closedOne)
    • getConf

      public org.nustaq.serialization.FSTConfiguration getConf()
    • getFacadeProxy

      public abstract Actor getFacadeProxy()
    • setDisconnectHandler

      public void setDisconnectHandler(Consumer<Actor> disconnectHandler)
    • getDisconnectHandler

      public Consumer<Actor> getDisconnectHandler()
    • setClassLoader

      public void setClassLoader(ClassLoader l)
    • getRemoteId

      public long getRemoteId(Actor act)
    • pollAndSend2Remote

      public boolean pollAndSend2Remote(AtomicReference<ObjectSocket> chanHolder) throws Exception
      poll remote actor proxies and send. return true if there was at least one message
      Parameters:
      chanHolder -
      Throws:
      Exception
    • getWriteObjectSocket

      public abstract AtomicReference<ObjectSocket> getWriteObjectSocket()
    • getSocketRef

      public ObjectSocket getSocketRef()
    • isObsolete

      public boolean isObsolete()
    • setIsObsolete

      public void setIsObsolete(boolean isObsolete)
      give the application a way to explecitely flag a connection as obsolete
    • getRemoteActorSize

      public int getRemoteActorSize()
    • setFacadeActor

      public void setFacadeActor(Actor facadeActor)
    • getFacadeActor

      public Actor getFacadeActor()
    • setServer

      public void setServer(ActorServer server)
    • getServer

      public ActorServer getServer()
    • closeNetwork

      public IPromise closeNetwork()
    • pingFromRoutingClient

      public void pingFromRoutingClient()
    • getLastRoutingClientPing

      public long getLastRoutingClientPing()
    • getRemotedActorIds

      public long[] getRemotedActorIds()
    • getPublishedActorIds

      public long[] getPublishedActorIds()
    • getConnectionIdentifier

      public String getConnectionIdentifier()
    • isJsonSerialized

      public boolean isJsonSerialized()