Class ClientActorBehavior<T extends BackendInfo>
- java.lang.Object
-
- org.opendaylight.controller.cluster.access.client.AbstractClientActorBehavior<C>
-
- org.opendaylight.controller.cluster.access.client.ClientActorBehavior<T>
-
- All Implemented Interfaces:
AutoCloseable
,Identifiable<ClientIdentifier>
@Beta public abstract class ClientActorBehavior<T extends BackendInfo> extends AbstractClientActorBehavior<C> implements Identifiable<ClientIdentifier>
A behavior, which handles messages sent to aAbstractClientActor
.- Author:
- Robert Varga
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
ClientActorBehavior.ConnectionConnectCohort
Connection reconnect cohort, driven by this class.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClientActorBehavior(@NonNull ClientActorContext context, @NonNull BackendInfoResolver<T> resolver)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
protected abstract @NonNull ClientActorBehavior.ConnectionConnectCohort
connectionUp(@NonNull ConnectedClientConnection<T> newConn)
Callback invoked when a new connection has been established.AbstractClientConnection<T>
getConnection(Long shard)
Get a connection to a shard.ClientIdentifier
getIdentifier()
protected abstract void
haltClient(@NonNull Throwable cause)
Halt And Catch Fire.protected abstract @Nullable ClientActorBehavior<T>
onCommand(@NonNull Object command)
Override this method to handle any command which is not handled by the base behavior.protected @NonNull BackendInfoResolver<T>
resolver()
Override this method to provide a backend resolver instance.-
Methods inherited from class org.opendaylight.controller.cluster.access.client.AbstractClientActorBehavior
context, persistenceId, self
-
-
-
-
Constructor Detail
-
ClientActorBehavior
protected ClientActorBehavior(@NonNull ClientActorContext context, @NonNull BackendInfoResolver<T> resolver)
-
-
Method Detail
-
getIdentifier
public final ClientIdentifier getIdentifier()
- Specified by:
getIdentifier
in interfaceIdentifiable<T extends BackendInfo>
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classAbstractClientActorBehavior<ClientActorContext>
-
getConnection
public final AbstractClientConnection<T> getConnection(Long shard)
Get a connection to a shard.- Parameters:
shard
- Shard cookie- Returns:
- Connection to a shard
- Throws:
InversibleLockException
- if the shard is being reconnected
-
haltClient
protected abstract void haltClient(@NonNull Throwable cause)
Halt And Catch Fire. Halt processing on this client. Implementations need to ensure they initiate state flush procedures. No attempt to use this instance should be made after this method returns. Any such use may result in undefined behavior.- Parameters:
cause
- Failure cause
-
onCommand
protected abstract @Nullable ClientActorBehavior<T> onCommand(@NonNull Object command)
Override this method to handle any command which is not handled by the base behavior.- Parameters:
command
- the command to process- Returns:
- Next behavior to use, null if this actor should shut down.
-
resolver
protected final @NonNull BackendInfoResolver<T> resolver()
Override this method to provide a backend resolver instance.- Returns:
- a backend resolver instance
-
connectionUp
@Holding("connectionsLock") protected abstract @NonNull ClientActorBehavior.ConnectionConnectCohort connectionUp(@NonNull ConnectedClientConnection<T> newConn)
Callback invoked when a new connection has been established. Implementations are expected perform preparatory tasks before the previous connection is frozen.- Parameters:
newConn
- New connection- Returns:
- ConnectionConnectCohort which will be used to complete the process of bringing the connection up.
-
-