@Override
public void register(ActorRef receiver, ActorSystemEvent event, Object message) throws IOException {
if(!(receiver instanceof ActorShardRef)) {
throw new IllegalArgumentException("ActorRef must be referencing a Persistent Actor (i.e. annotated with @Actor)");
}
<BUG>ShardKey shardKey = ((ActorShard)((ActorShardRef) receiver).get()).getKey();
</BUG>
MessageSerializer serializer = actorSystem.getSerializer(message.getClass());
ByteBuffer serializedMessage = serializer.serialize(message);
byte[] serializedBytes = new byte[serializedMessage.remaining()];

@Override
public void register(ActorRef receiver, ActorSystemEvent event, Object message) throws IOException {
if(!(receiver instanceof ActorShardRef)) {
throw new IllegalArgumentException("ActorRef must be referencing a Persistent Actor (i.e. annotated with @Actor)");
}
ShardKey shardKey = ((ActorShard)((ActorShardRef) receiver).getActorContainer()).getKey();
MessageSerializer serializer = actorSystem.getSerializer(message.getClass());
ByteBuffer serializedMessage = serializer.serialize(message);
byte[] serializedBytes = new byte[serializedMessage.remaining()];
