import com.google.common.base.MoreObjects.ToStringHelper;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
public final class ConnectClientSuccess extends RequestSuccess<ClientIdentifier, ConnectClientSuccess> {
private static final long serialVersionUID = 1L;
+ @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "This field is not Serializable but this class "
+ + "implements writeReplace to delegate serialization to a Proxy class and thus instances of this class "
+ + "aren't serialized. FindBugs does not recognize this.")
private final List<ActorSelection> alternates;
+
+ @SuppressFBWarnings(value = "SE_BAD_FIELD", justification = "See justification above.")
private final DataTree dataTree;
private final ActorRef backend;
- private final long maxMessages;
+ private final int maxMessages;
- ConnectClientSuccess(final ClientIdentifier target, final ActorRef backend, final List<ActorSelection> alternates,
- final Optional<DataTree> dataTree, final long maxMessages) {
- super(target);
+ ConnectClientSuccess(final ClientIdentifier target, final long sequence, final ActorRef backend,
+ final List<ActorSelection> alternates, final Optional<DataTree> dataTree, final int maxMessages) {
+ super(target, sequence);
this.backend = Preconditions.checkNotNull(backend);
this.alternates = ImmutableList.copyOf(alternates);
this.dataTree = dataTree.orElse(null);
this.maxMessages = maxMessages;
}
- public ConnectClientSuccess(final @Nonnull ClientIdentifier target, final @Nonnull ActorRef backend,
- final @Nonnull List<ActorSelection> alternates, final @Nonnull DataTree dataTree, final long maxMessages) {
- this(target, backend, alternates, Optional.of(dataTree), maxMessages);
+ public ConnectClientSuccess(@Nonnull final ClientIdentifier target, final long sequence,
+ @Nonnull final ActorRef backend, @Nonnull final List<ActorSelection> alternates,
+ @Nonnull final DataTree dataTree, final int maxMessages) {
+ this(target, sequence, backend, alternates, Optional.of(dataTree), maxMessages);
}
/**
*
* @return a list of known backend alternates
*/
- public @Nonnull List<ActorSelection> getAlternates() {
+ @Nonnull
+ public List<ActorSelection> getAlternates() {
return alternates;
}
- public @Nonnull ActorRef getBackend() {
+ @Nonnull
+ public ActorRef getBackend() {
return backend;
}
return Optional.ofNullable(dataTree);
}
- public long getMaxMessages() {
+ public int getMaxMessages() {
return maxMessages;
}
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
- return super.addToStringAttributes(toStringHelper).add("alternates", alternates).add("dataTree", dataTree);
+ return super.addToStringAttributes(toStringHelper).add("alternates", alternates)
+ .add("dataTree present", getDataTree().isPresent()).add("maxMessages", maxMessages);
}
}