/// <summary> /// Whether an incoming message can interleave /// </summary> /// <param name="targetActivation"></param> /// <param name="incoming"></param> /// <returns></returns> public bool CanInterleave(ActivationData targetActivation, Message incoming) { if (incoming.IsAlwaysInterleave) { return(true); } if (targetActivation.Blocking is null) { return(true); } if (targetActivation.Blocking.IsReadOnly && incoming.IsReadOnly) { return(true); } if (targetActivation.GetComponent <GrainCanInterleave>() is GrainCanInterleave canInterleave) { return(canInterleave.MayInterleave(incoming)); } return(false); }