示例#1
0
#pragma warning disable 612,618
        internal static PlacementStrategy GetPlacementStrategy(Type grainClass)
        {
            PlacementStrategy placement;

            if (GetPlacementStrategy <StatelessWorkerAttribute>(
                    grainClass,
                    (StatelessWorkerAttribute attr) =>
            {
                return(new StatelessWorkerPlacement(attr.MaxLocalWorkers));
            },
                    out placement))
            {
                return(placement);
            }

            if (GetPlacementStrategy <PlacementAttribute>(
                    grainClass,
                    a => a.PlacementStrategy,
                    out placement))
            {
                return(placement);
            }

            return(PlacementStrategy.GetDefault());
        }
示例#2
0
 internal GrainClassData(int grainTypeCode, string grainClass, GrainInterfaceData interfaceData, PlacementStrategy placement)
 {
     GrainTypeCode      = grainTypeCode;
     GrainClass         = grainClass;
     this.interfaceData = interfaceData;
     genericClassNames  = new Dictionary <string, string>(); // TODO: initialize only for generic classes
     placementStrategy  = placement ?? PlacementStrategy.GetDefault();
 }
示例#3
0
 internal GrainClassData(int grainTypeCode, string grainClass, bool isGeneric, GrainInterfaceData interfaceData, PlacementStrategy placement, MultiClusterRegistrationStrategy registrationStrategy)
 {
     GrainTypeCode             = grainTypeCode;
     GrainClass                = grainClass;
     this.isGeneric            = isGeneric;
     this.interfaceData        = interfaceData;
     genericClassNames         = new Dictionary <string, string>(); // TODO: initialize only for generic classes
     placementStrategy         = placement ?? PlacementStrategy.GetDefault();
     this.registrationStrategy = registrationStrategy ?? MultiClusterRegistrationStrategy.GetDefault();
 }
示例#4
0
#pragma warning disable 612,618
        internal static PlacementStrategy GetPlacementStrategy(Type grainClass)
        {
            PlacementStrategy placement;

            if (GetPlacementStrategy <StatelessWorkerAttribute>(
                    grainClass,
                    _ => GrainStrategy.StatelessWorkerPlacement,
                    out placement))
            {
                return(placement);
            }

            if (GetPlacementStrategy <PlacementAttribute>(
                    grainClass,
                    a => a.PlacementStrategy,
                    out placement))
            {
                return(placement);
            }

            return(PlacementStrategy.GetDefault());
        }