text:
package com.tikinou.schedulesdirect.core.commands.schedules;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.tikinou.schedulesdirect.core.commands.AuthenticatedBaseCommandParameter;

import java.util.Arrays;
import java.util.List;

/**
 * @author Sebastien Astie
 */
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class GetSchedulesCommandParameters extends AuthenticatedBaseCommandParameter {
    @JsonProperty("request")
    private List<String> stationIds;

    public GetSchedulesCommandParameters(){
        this(null);
    }

    public GetSchedulesCommandParameters(List<String> stationIds){
        this.stationIds = stationIds;
    }

    public List<String> getStationIds() {
        return stationIds;
    }

    public void setStationIds(List<String> stationIds) {
        this.stationIds = stationIds;
    }

    @Override
    public String toString() {
        return "GetSchedulesCommandParameters{" + toStringMembers() + '}';
    }

    @Override
    protected String toStringMembers() {
        return super.toStringMembers() +
            ", stationIds=" + (stationIds != null ? Arrays.toString(stationIds.toArray()) : stationIds);
    }
}


text:
import { FunctionBinding } from './function-config';
import { AADPermissions } from './microsoft-graph';
import { RuntimeExtension } from './binding';

export interface FunctionTemplate {
    id: string;
    function: FunctionTemplateBindings;
    metadata: FunctionTemplateMetadata;
    files: any;
}

export interface FunctionTemplateBindings {
    bindings: FunctionBinding[];
}

export interface FunctionTemplateMetadata {
    name: string;
    trigger: string;
    language: string;
    category?: string[];
    userPrompt?: string[];
    defaultFunctionName?: string;
    description?: string;
    visible?: boolean;
    filters?: string[];
    enabledInTryMode?: boolean;
    warning: Warning;
    AADPermissions?: AADPermissions[];
    extensions: RuntimeExtension[];
    categoryStyle: string;
}

export interface Warning {
    type: string;
    text: string;
}

redpajama_set_name: RedPajamaGithub


text:
@interface ZJTabbarViewController ()<UITabBarControllerDelegate>
@end

@implementation ZJTabbarViewController

{
    NSInteger currentSelectIndex;

}
//在自定义tabbar中的控制器里
+ (void)load
{
    // 获取当前类的tabBarItem
    UITabBarItem *item = [UITabBarItem appearanceWhenContainedIn:self, nil];

    // 设置所有item的选中时颜色

    // 设置选中文字颜色
    // 创建字典去描述文本
    NSMutableDictionary *attr = [NSMutableDictionary dictionary];
    [item setTitleTextAttributes:attr forState:UIControlStateSelected];
    // 通过normal状态设置字体大小
    // 字体大小 跟 normal
    NSMutableDictionary *attrnor = [NSMutableDictionary dictionary];
    // 设置字体
    attrnor[NSFontAttributeName] = [UIFont systemFontOfSize:12];
//    attrnor[NSForegroundColorAttributeName] = [UIColor blackColor];
    [item setTitleTextAttributes:attrnor forState:UIControlStateNormal];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[ZJHomeViewController alloc]init]];
    UINavigationController *nav_1 = [[UINavigationController alloc]initWithRootViewController:[[ZJDebtMangerViewController alloc]init]];
    UINavigationController *nav_2 = [[UINavigationController alloc]initWithRootViewController:[[ZJDebtPersonViewController alloc]init]];
    UINavigationController *nav_3 = [[UINavigationController alloc]initWithRootViewController:[[ZJMyPageViewController alloc]init]];
    nav.navigationBar.barTintColor = ZJColor_red;
    nav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"首页" image:[UIImage imageNamed:@"home-gray"] selectedImage:[UIImage imageNamed:@"home-red"]];
    nav_1.navigationBar.barTintColor = ZJColor_red;
    nav_1.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"债事管理" image:[UIImage imageNamed:@"debt-manage-gray"] selectedImage:[UIImage imageNamed:@"debt-manage-red"]];
    nav_2.navigationBar.barTintColor = ZJColor_red;
    nav_2.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"债事人管理" image:[UIImage imageNamed:@"debt-people-manage-gray"] selectedImage:[UIImage imageNamed:@"debt-people-manage-red"]];
    nav_3.navigationBar.barTintColor = ZJColor_red;
    nav_3.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"我的" image:[UIImage imageNamed:@"mine-gray"] selectedImage:[UIImage imageNamed:@"mine-red"]];

    self.viewControllers = @[nav,nav_1,nav_2,nav_3];
    self.tabBar.tintColor = [UIColor redColor];
    self.tabBar.barTintColor = [UIColor whiteColor];

    isShowSmallSlidView =false;
    [[NSNotificationCenter defaultCenter]  addObserver:self selector:@selector(smallSlidView:) name:@"smallSlidView" object:nil];

}

#pragma mark -小框
-(UIView*)smallSlidView:(float)width height:(float)height value:(NSString*)value{
    UIView * _smallSlidView = [[UIView alloc]initWithFrame:CGRectMake(ZJAPPWidth/2-width/2, ZJAPPHeight - 100, width, height)];
    [_smallSlidView setBackgroundColor:[UIColor blackColor]];
    [_smallSlidView setAlpha:0];
    _smallSlidView.layer.masksToBounds = YES;
    _smallSlidView.layer.cornerRadius = 3;

    UILabel * text = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 300, height)];
    [text setTextColor:[UIColor whiteColor]];
    [text setBackgroundColor:[UIColor clearColor]];
    [text setTextAlignment:NSTextAlignmentCenter];
    [text setFont:[UIFont fontWithName:@"Arial" size:14]];
    text.text = value;
    CGSize mySize;
    mySize = [text.text sizeWithFont:text.font constrainedToSize:CGSizeMake(text.frame.size.width, MAXFLOAT) lineBreakMode:NSLineBreakByWordWrapping];
    [text setFrame:CGRectMake(0, 0, mySize.width, mySize.height)];
    text.numberOfLines=(int)mySize.height/text.font.xHeight;
    [_smallSlidView setFrame:CGRectMake(ZJAPPWidth/2-(text.frame.size.width+20)/2, ZJAPPHeight - 100-30, text.frame.size.width+20, text.frame.size.height+20)];
    [text setFrame:CGRectMake(_smallSlidView.frame.size.width/2-text.frame.size.width/2, _smallSlidView.frame.size.height/2-text.frame.size.height/2, mySize.width, mySize.height)];
    [_smallSlidView addSubview:text];

    return _smallSlidView;
}
-(void)smallSlidView:(NSNotification*)value{
    if (!isShowSmallSlidView ) {
        isShowSmallSlidView = true;
        id obj = [value object];
        smallSlidView=nil;
        smallSlidView = [self smallSlidView:[[obj objectAtIndex:0]floatValue]  height:[[obj objectAtIndex:1]floatValue] value:[obj objectAtIndex:2]] ;
        //        UIWindow *keywindow=[UIApplication sharedApplication].keyWindow;
        //        [keywindow addSubview:smallSlidView];
        [self.view.window addSubview:smallSlidView];
        [self showSlidAnimation];
    }
}
-(void)showSlidAnimation{
    smallSlidView.frame=CGRectMake((ZJAPPWidth-smallSlidView.frame.size.width)/2, ZJAPPHeight,smallSlidView.frame.size.width,smallSlidView.frame.size.height);
    [smallSlidView setAlpha:.88f];

    [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        smallSlidView.frame=CGRectMake((ZJAPPWidth-smallSlidView.frame.size.width)/2, ZJAPPHeight-smallSlidView.frame.size.height-70,smallSlidView.frame.size.width,smallSlidView.frame.size.height);
    } completion:^(BOOL finished) {

    }];
    dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, 2000*USEC_PER_SEC);
    dispatch_after(time, dispatch_get_main_queue(), ^{
        [self endSlidAnimation];
    });
}
-(void)endSlidAnimation{
    [UIView animateWithDuration:0.15 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        smallSlidView.transform = CGAffineTransformMakeScale(1.03, 1);
        smallSlidView.alpha=0.5;
    } completion:^(BOOL finished) {
        smallSlidView.alpha=0;
        isShowSmallSlidView = false;
    }];
}
-(void)closedSlidAnimation{
    isShowSmallSlidView = false;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end


text:
package io.lenses.streamreactor.connect.aws.s3.source

import com.datamountaineer.streamreactor.common.utils.JarManifest

import java.util
import io.lenses.streamreactor.connect.aws.s3.auth.AwsContextCreator
import io.lenses.streamreactor.connect.aws.s3.model._
import io.lenses.streamreactor.connect.aws.s3.source.config.S3SourceConfig
import io.lenses.streamreactor.connect.aws.s3.storage.{MultipartBlobStoreStorageInterface, StorageInterface}
import org.apache.kafka.connect.data.{Schema, SchemaAndValue}
import org.apache.kafka.connect.source.{SourceRecord, SourceTask}

import scala.collection.JavaConverters._
import scala.util.Try

class S3SourceTask extends SourceTask {

  private val logger = org.slf4j.LoggerFactory.getLogger(getClass.getName)

  private val manifest = JarManifest(getClass.getProtectionDomain.getCodeSource.getLocation)

  private implicit var storageInterface: StorageInterface = _

  private implicit var sourceLister: S3SourceLister = _

  private var config: S3SourceConfig = _

  private var readerManagers: Seq[S3BucketReaderManager] = _

  override def version(): String = manifest.version()

  /**
    * Start sets up readers for every configured connection in the properties
    **/
  override def start(props: util.Map[String, String]): Unit = {

    logger.debug(s"Received call to S3SinkTask.start with ${props.size()} properties")

    val awsConfig = S3SourceConfig(props.asScala.toMap)

    val awsContextCreator = new AwsContextCreator(AwsContextCreator.DefaultCredentialsFn)
    storageInterface = new MultipartBlobStoreStorageInterface(awsContextCreator.fromConfig(awsConfig.s3Config))
    sourceLister = new S3SourceLister()

    val configs = Option(context).flatMap(c => Option(c.configs())).filter(_.isEmpty == false).getOrElse(props)

    config = S3SourceConfig(configs.asScala.toMap)

    val offsetFn: (String, String) => Option[OffsetReaderResult] =
      (bucket, prefix) => {
        val key = fromSourcePartition(bucket, prefix).asJava
        Try {
          val matchingOffset = context.offsetStorageReader().offset(key).asScala.toMap

          OffsetReaderResult(
            matchingOffset.getOrElse("path", throw new IllegalArgumentException("Could not find path value in matching offset")).asInstanceOf[String],
            matchingOffset.getOrElse("line", throw new IllegalArgumentException("Could not find line value in matching offset")).asInstanceOf[String],
          )
        }.toOption
      }

    readerManagers = config.bucketOptions
      .map(new S3BucketReaderManager(_, offsetFn))

  }

  override def stop(): Unit = {
    logger.debug(s"Received call to S3SinkTask.stop")

    readerManagers.foreach(_.close())
  }

  override def poll(): util.List[SourceRecord] = readerManagers
    .flatMap(_.poll())
    .flatMap(convertToSourceRecordList)
    .asJava

  private def fromSourcePartition(bucket: String, prefix: String) =
    Map(
      "container" -> bucket,
      "prefix" -> prefix
    )

  private def fromSourceOffset(bucketAndPath: BucketAndPath, offset: Long): Map[String, AnyRef] =
    Map(
      "path" -> bucketAndPath.path,
      "line" -> offset.toString
    )

  private def convertToSourceRecordList(pollResults: PollResults): Vector[SourceRecord] =
    pollResults.resultList.map(convertToSourceRecord(_, pollResults))

  private def convertToSourceRecord(sourceData: SourceData, pollResults: PollResults): SourceRecord = {

    val (schema: Option[Schema], value: AnyRef, key: Option[AnyRef]) = sourceData match {
      case SchemaAndValueSourceData(result: SchemaAndValue, _) =>
        (Some(result.schema()), result.value(), None)
      case StringSourceData(result: String, _) =>
        (None, result, None)
      case ByteArraySourceData(resultBytes, _) =>
        (None, resultBytes.value, resultBytes.key)
      case _ =>
        throw new IllegalArgumentException("Why are we here")
    }
    if (key.isDefined) {
      new SourceRecord(
        fromSourcePartition(pollResults.bucketAndPath.bucket, pollResults.prefix).asJava,
        fromSourceOffset(pollResults.bucketAndPath, sourceData.getLineNumber).asJava,
        pollResults.targetTopic,
        null,
        key,
        schema.orNull,
        value
      )
    } else {
      new SourceRecord(
        fromSourcePartition(pollResults.bucketAndPath.bucket, pollResults.prefix).asJava,
        fromSourceOffset(pollResults.bucketAndPath, sourceData.getLineNumber).asJava,
        pollResults.targetTopic,
        schema.orNull,
        value
      )
    }

  }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Orleans.Hosting;
using Orleans.Runtime;
using Orleans.Runtime.Configuration;
using Orleans.TestingHost;
using TestExtensions;
using UnitTests.GrainInterfaces;
using Xunit;

namespace UnitTests.General
{
    [TestCategory("Elasticity"), TestCategory("Placement")]
    public class ElasticPlacementTests : TestClusterPerTest
    {
        private readonly List<IActivationCountBasedPlacementTestGrain> grains = new List<IActivationCountBasedPlacementTestGrain>();
        private const int leavy = 300;
        private const int perSilo = 1000;

        protected override void ConfigureTestCluster(TestClusterBuilder builder)
        {
            builder.ConfigureLegacyConfiguration(legacy =>
            {
                legacy.ClusterConfiguration.ApplyToAllNodes(nodeConfig => nodeConfig.LoadSheddingEnabled = true);
            });
            builder.AddSiloBuilderConfigurator<SiloConfigurator>();
        }

        private class SiloConfigurator : ISiloBuilderConfigurator
        {
            public void Configure(ISiloHostBuilder hostBuilder)
            {
                hostBuilder.AddMemoryGrainStorage("MemoryStore")
                    .AddMemoryGrainStorageAsDefault();
            }
        }

        /// <summary>
        /// Test placement behaviour for newly added silos. The grain placement strategy should favor them
        /// until they reach a similar load as the other silos.
        /// </summary>
        [SkippableFact(Skip = "https://github.com/dotnet/orleans/issues/4008"), TestCategory("Functional")]
        public async Task ElasticityTest_CatchingUp()
        {

            logger.Info("\n\n\n----- Phase 1 -----\n\n");
            AddTestGrains(perSilo).Wait();
            AddTestGrains(perSilo).Wait();

            var activationCounts = await GetPerSiloActivationCounts();
            LogCounts(activationCounts);
            logger.Info("-----------------------------------------------------------------");
            AssertIsInRange(activationCounts[this.HostedCluster.Primary], perSilo, leavy);
            AssertIsInRange(activationCounts[this.HostedCluster.SecondarySilos.First()], perSilo, leavy);

            SiloHandle silo3 = this.HostedCluster.StartAdditionalSilo();
            await this.HostedCluster.WaitForLivenessToStabilizeAsync();

            logger.Info("\n\n\n----- Phase 2 -----\n\n");
            await AddTestGrains(perSilo);
            await AddTestGrains(perSilo);
            await AddTestGrains(perSilo);
            await AddTestGrains(perSilo);

            logger.Info("-----------------------------------------------------------------");
            activationCounts = await GetPerSiloActivationCounts();
            LogCounts(activationCounts);
            logger.Info("-----------------------------------------------------------------");
            double expected = (6.0 * perSilo) / 3.0;
            AssertIsInRange(activationCounts[this.HostedCluster.Primary], expected, leavy);
            AssertIsInRange(activationCounts[this.HostedCluster.SecondarySilos.First()], expected, leavy);
            AssertIsInRange(activationCounts[silo3], expected, leavy);

            logger.Info("\n\n\n----- Phase 3 -----\n\n");
            await AddTestGrains(perSilo);
            await AddTestGrains(perSilo);
            await AddTestGrains(perSilo);

            logger.Info("-----------------------------------------------------------------");
            activationCounts = await GetPerSiloActivationCounts();
            LogCounts(activationCounts);
            logger.Info("-----------------------------------------------------------------");
            expected = (9.0 * perSilo) / 3.0;
            AssertIsInRange(activationCounts[this.HostedCluster.Primary], expected, leavy);
            AssertIsInRange(activationCounts[this.HostedCluster.SecondarySilos.First()], expected, leavy);
            AssertIsInRange(activationCounts[silo3], expected, leavy);

            logger.Info("-----------------------------------------------------------------");
            logger.Info("Test finished OK. Expected per silo = {0}", expected);
        }

        /// <summary>
        /// This evaluates the how the placement strategy behaves once silos are stopped: The strategy should
        /// balance the activations from the stopped silo evenly among the remaining silos.
        /// </summary>
        [SkippableFact(Skip = "https://github.com/dotnet/orleans/issues/4008"), TestCategory("Functional")]
        public async Task ElasticityTest_StoppingSilos()
        {
            List<SiloHandle> runtimes = await this.HostedCluster.StartAdditionalSilosAsync(2);
            await this.HostedCluster.WaitForLivenessToStabilizeAsync();
            int stopLeavy = leavy;

            await AddTestGrains(perSilo);
            await AddTestGrains(perSilo);
            await AddTestGrains(perSilo);
            await AddTestGrains(perSilo);

            var activationCounts = await GetPerSiloActivationCounts();
            logger.Info("-----------------------------------------------------------------");
            LogCounts(activationCounts);
            logger.Info("-----------------------------------------------------------------");
            AssertIsInRange(activationCounts[this.HostedCluster.Primary], perSilo, stopLeavy);
            AssertIsInRange(activationCounts[this.HostedCluster.SecondarySilos.First()], perSilo, stopLeavy);
            AssertIsInRange(activationCounts[runtimes[0]], perSilo, stopLeavy);
            AssertIsInRange(activationCounts[runtimes[1]], perSilo, stopLeavy);

            await this.HostedCluster.StopSiloAsync(runtimes[0]);
            await this.HostedCluster.WaitForLivenessToStabilizeAsync();
            await InvokeAllGrains();

            activationCounts = await GetPerSiloActivationCounts();
            logger.Info("-----------------------------------------------------------------");
            LogCounts(activationCounts);
            logger.Info("-----------------------------------------------------------------");
            double expected = perSilo * 1.33;
            AssertIsInRange(activationCounts[this.HostedCluster.Primary], expected, stopLeavy);
            AssertIsInRange(activationCounts[this.HostedCluster.SecondarySilos.First()], expected, stopLeavy);
            AssertIsInRange(activationCounts[runtimes[1]], expected, stopLeavy);

            logger.Info("-----------------------------------------------------------------");
            logger.Info("Test finished OK. Expected per silo = {0}", expected);
        }

        /// <summary>
        /// Do not place activation in case all silos are above 110 CPU utilization.
        /// </summary>
        [SkippableFact(Skip = "https://github.com/dotnet/orleans/issues/4008"), TestCategory("Functional")]
        public async Task ElasticityTest_AllSilosCPUTooHigh()
        {
            var taintedGrainPrimary = await GetGrainAtSilo(this.HostedCluster.Primary.SiloAddress);
            var taintedGrainSecondary = await GetGrainAtSilo(this.HostedCluster.SecondarySilos.First().SiloAddress);

            await taintedGrainPrimary.EnableOverloadDetection(false);
            await taintedGrainSecondary.EnableOverloadDetection(false);

            await taintedGrainPrimary.LatchCpuUsage(110.0f);
            await taintedGrainSecondary.LatchCpuUsage(110.0f);

            await Assert.ThrowsAsync<OrleansException>(() =>
                this.AddTestGrains(1));
        }

        /// <summary>
        /// Do not place activation in case all silos are above 110 CPU utilization or have overloaded flag set.
        /// </summary>
        [SkippableFact(Skip= "https://github.com/dotnet/orleans/issues/4008"), TestCategory("Functional")]
        public async Task ElasticityTest_AllSilosOverloaded()
        {
            var taintedGrainPrimary = await GetGrainAtSilo(this.HostedCluster.Primary.SiloAddress);
            var taintedGrainSecondary = await GetGrainAtSilo(this.HostedCluster.SecondarySilos.First().SiloAddress);

            await taintedGrainPrimary.LatchCpuUsage(110.0f);
            await taintedGrainSecondary.LatchOverloaded();

            // OrleansException or GateWayTooBusyException
            var exception = await Assert.ThrowsAnyAsync<Exception>(() =>
                this.AddTestGrains(1));

            Assert.True(exception is OrleansException || exception is GatewayTooBusyException);
        }

        [Fact, TestCategory("Functional")]
        public async Task LoadAwareGrainShouldNotAttemptToCreateActivationsOnOverloadedSilo()
        {
            await ElasticityGrainPlacementTest(
                g =>
                    g.LatchOverloaded(),
                g =>
                    g.UnlatchOverloaded(),
                "LoadAwareGrainShouldNotAttemptToCreateActivationsOnOverloadedSilo",
                "A grain instantiated with the load-aware placement strategy should not attempt to create activations on an overloaded silo.");
        }

        [Fact, TestCategory("Functional")]
        public async Task LoadAwareGrainShouldNotAttemptToCreateActivationsOnBusySilos()
        {
            // a CPU usage of 110% will disqualify a silo from getting new grains.
            const float undesirability = (float)110.0;
            await ElasticityGrainPlacementTest(
                g =>
                    g.LatchCpuUsage(undesirability),
                g =>
                    g.UnlatchCpuUsage(),
                "LoadAwareGrainShouldNotAttemptToCreateActivationsOnBusySilos",
                "A grain instantiated with the load-aware placement strategy should not attempt to create activations on a busy silo.");
        }

        private async Task<IPlacementTestGrain> GetGrainAtSilo(SiloAddress silo)
        {
            while (true)
            {
                IPlacementTestGrain grain = this.GrainFactory.GetGrain<IRandomPlacementTestGrain>(Guid.NewGuid());
                SiloAddress address = await grain.GetLocation();
                if (address.Equals(silo))
                    return grain;
            }
        }

        private static void AssertIsInRange(int actual, double expected, int leavy)
        {
            Assert.True(expected - leavy <= actual && actual <= expected + leavy,
                String.Format("Expecting a value in the range between {0} and {1}, but instead got {2} outside the range.",
                    expected - leavy, expected + leavy, actual));
        }

        private async Task ElasticityGrainPlacementTest(
            Func<IPlacementTestGrain, Task> taint,
            Func<IPlacementTestGrain, Task> restore,
            string name,
            string assertMsg)
        {
            await this.HostedCluster.WaitForLivenessToStabilizeAsync();
            logger.Info("********************** Starting the test {0} ******************************", name);
            var taintedSilo = this.HostedCluster.StartAdditionalSilo();

            const long sampleSize = 10;

            var taintedGrain = await GetGrainAtSilo(taintedSilo.SiloAddress);

            var testGrains =
                Enumerable.Range(0, (int)sampleSize).
                Select(
                    n =>
                        this.GrainFactory.GetGrain<IActivationCountBasedPlacementTestGrain>(Guid.NewGuid()));

            // make the grain's silo undesirable for new grains.
            taint(taintedGrain).Wait();
            List<IPEndPoint> actual;
            try
            {
                actual =
                    testGrains.Select(
                        g =>
                            g.GetEndpoint().Result).ToList();
            }
            finally
            {
                // i don't know if this necessary but to be safe, i'll restore the silo's desirability.
                logger.Info("********************** Finalizing the test {0} ******************************", name);
                restore(taintedGrain).Wait();
            }

            var unexpected = taintedSilo.SiloAddress.Endpoint;
            Assert.True(
                actual.All(
                    i =>
                        !i.Equals(unexpected)),
                assertMsg);
        }

        private Task AddTestGrains(int amount)
        {
            var promises = new List<Task>();
            for (var i = 0; i < amount; i++)
            {
                IActivationCountBasedPlacementTestGrain grain = this.GrainFactory.GetGrain<IActivationCountBasedPlacementTestGrain>(Guid.NewGuid());
                this.grains.Add(grain);
                // Make sure we activate grain:
                promises.Add(grain.Nop());
            }
            return Task.WhenAll(promises);
        }

        private Task InvokeAllGrains()
        {
            var promises = new List<Task>();
            foreach (var grain in grains)
            {
                promises.Add(grain.Nop());
            }
            return Task.WhenAll(promises);
        }

        private async Task<Dictionary<SiloHandle, int>> GetPerSiloActivationCounts()
        {
            string fullTypeName = "UnitTests.Grains.ActivationCountBasedPlacementTestGrain";

            IManagementGrain mgmtGrain = this.GrainFactory.GetGrain<IManagementGrain>(0);
            SimpleGrainStatistic[] stats = await mgmtGrain.GetSimpleGrainStatistics();

            return this.HostedCluster.GetActiveSilos()
                .ToDictionary(
                    s => s,
                    s => stats
                        .Where(stat => stat.SiloAddress.Equals(s.SiloAddress) && stat.GrainType == fullTypeName)
                        .Select(stat => stat.ActivationCount).SingleOrDefault());
        }

        private void LogCounts(Dictionary<SiloHandle, int> activationCounts)
        {
            var sb = new StringBuilder();
            foreach (var silo in this.HostedCluster.GetActiveSilos())
            {
                int count;
                activationCounts.TryGetValue(silo, out count);
                sb.AppendLine($"{silo.Name}.ActivationCount = {count}");
            }
            logger.Info(sb.ToString());
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Ceská Mykol. 36(2): 82 (1982)

#### Original name
Krombholzia rotundifoliae Singer

### Remarks
null


text:
#include "DeviceMemoryStore.h"
#include "cudafuncs.h"
#include <algorithm>

using namespace sqaod_cuda;

/*
 * FixedSizedChunks
 */

#ifdef _MSC_VER
/* __builtin_ctz() implementations on MSVC
 * https ://stackoverflow.com/questions/355967/how-to-use-msvc-intrinsics-to-get-the-equivalent-of-this-gcc-code
 */
#include <intrin.h>
uint32_t __inline __builtin_ctz(uint32_t value) {
    unsigned long trailing_zero = 0;
    if (_BitScanForward(&trailing_zero, value))
        return trailing_zero;
    else
        return 32;
}
uint32_t __inline __builtin_clzll(uint64_t value) {
    if (value == 0) return 64;
    unsigned long idx; // bit pos of the first bit set(1) from MSB to LSB.
    _BitScanReverse64(&idx, value);
    return 63 - idx;
}
/* Effective after Haswell */
/* #define __builtin_clzll __lzcnt64 */

#endif

// #define DEBUG_ALLOC

bool HeapBitmap::acquire(uintptr_t *addr) {
    if (freeRegions_.empty())
        return false;
    uintptr_t key = *freeRegions_.begin();
    RegionMap::iterator rit = regions_.find(key);
#ifdef DEBUG_ALLOC
    fprintf(stderr, "Acquire Region: %3d, %I64x - %I64x, mask: %2x\n", regionSize_, rit->first - regionSize_, rit->first - 1, rit->second);
    for (RegionMap::iterator it = regions_.begin(); it != regions_.end(); ++it)
        fprintf(stderr, "Region: %3d, %I64x - %I64x, mask: %2x\n", regionSize_, it->first - regionSize_, it->first - 1, it->second);
#endif
    int iChunk = __builtin_ctz(rit->second);
    rit->second ^= (1 << iChunk);
    *addr = (key - regionSize_) + (iChunk << chunkSizeShift_);
#ifdef DEBUG_ALLOC
    fprintf(stderr, "Acquire Region: %3d, Chunk, %d, addr: %I64x\n", regionSize_, iChunk, *addr);
#endif
    if (isRegionFull(rit->second))
        freeRegions_.erase(key);
    return true;
}

bool HeapBitmap::release(uintptr_t addr, uintptr_t *freeKey) {
#ifdef DEBUG_ALLOC
    fprintf(stderr, "Release: Region: %3d, addr: %I64x\n", regionSize_, addr);
    for (RegionMap::iterator it = regions_.begin(); it != regions_.end(); ++it)
        fprintf(stderr, "Region: %3d, %I64x - %I64x, mask: %2x\n", regionSize_, it->first - regionSize_, it->first - 1, it->second);
#endif
    RegionMap::iterator it = regions_.upper_bound(addr);
    if (it == regions_.end())
        abort_("trying to release a chunk that not allocated.");
#ifdef DEBUG_ALLOC
    fprintf(stderr, "Region: %3d, %I64x - %I64x, mask: %2x\n", regionSize_, it->first - regionSize_, it->first - 1, it->second);
#endif
    if (it->first <= addr)
        abort_("trying to release a chunk that not allocated.");

    uintptr_t key = it->first;
    if (isRegionFull(it->second)) {
        /* will have a vacant chunk, thus, add to freeRegions */
        freeRegions_.insert(key);
    }
    uintptr_t regionBegin = key - regionSize_;
    int chunkIdx = ((addr - regionBegin) >> chunkSizeShift_) & regionMask;
    it->second ^= (1 << chunkIdx);
    if (!isRegionEmpty(it->second))
        return false;

#ifdef DEBUG_ALLOC
    fprintf(stderr, "Free: %3d, %I64x - %I64x, mask: %2x\n", regionSize_, it->first - regionSize_, it->first - 1, it->second);
#endif
    regions_.erase(it);
    assert(freeRegions_.find(key) != freeRegions_.end());
    freeRegions_.erase(key);
    *freeKey = regionBegin;

    return true;
}

void HeapBitmap::addRegion(uintptr_t addr) {
    uintptr_t key = addr + regionSize_;
    freeRegions_.insert(key);
    regions_[key] = regionMask;
#ifdef DEBUG_ALLOC
    fprintf(stderr, "Add Region: %3d, %I64x - %I64x, mask: %2x\n", regionSize_, key - regionSize_, key - 1, regionMask);
#endif
}

void FixedSizedChunks::initialize() {
    bitmapLayers_[ 0].set( 2); /*    4 byte / chunk, 128 bytes / region parent : 5 */
    bitmapLayers_[ 1].set( 3); /*    8 byte / chunk, 256 bytes / region parent : 6 */
    bitmapLayers_[ 2].set( 4); /*   16 byte / chunk, 512 bytes / region parent : 7 */
    bitmapLayers_[ 3].set( 5); /*   32 byte / chunk,   1 K     / region parent : 8  */
    bitmapLayers_[ 4].set( 6); /*   64 byte / chunk    2 K     / region parent : 9  */
    bitmapLayers_[ 5].set( 7); /*  128 byte / chunk,   4 K     / region parent : 10 */
    bitmapLayers_[ 6].set( 8); /*  256 byte / chunk,   8 K     / region */
    bitmapLayers_[ 7].set( 9); /*  512 byte / chunk,  16 K     / region */
    bitmapLayers_[ 8].set(10); /*   1k byte / chunk,  32 K     / region */
    bitmapLayers_[ 9].set(11); /*   2k byte / chunk,  64 K     / region */
    bitmapLayers_[10].set(12); /*   4k byte / chunk, 128 K     / region */
}

void FixedSizedChunks::finalize() {
    for (int idx = 0; idx < nBitmapLayers; ++idx)
        bitmapLayers_[idx].clear();
}

size_t FixedSizedChunks::newHeapSize(size_t reqSize) const {
    int layerIdx = layerIdxFromSize(reqSize);
    if (layerIdx == 0)
        return reqSize * HeapBitmap::nChunksInRegion * HeapBitmap::nChunksInRegion * HeapBitmap::nChunksInRegion;
    if (layerIdx <= 5)
        return reqSize * HeapBitmap::nChunksInRegion * HeapBitmap::nChunksInRegion;
    return reqSize * HeapBitmap::nChunksInRegion;
}

void FixedSizedChunks::addFreeHeap(uintptr_t pv, size_t size) {
    assert(size % (1 << 7) == 0);
    int layerIdx = layerIdxFromSize(size / HeapBitmap::nChunksInRegion);
    bitmapLayers_[layerIdx].addRegion(pv);
}

uintptr_t FixedSizedChunks::acquire(size_t *size) {
    /* get the idx for the appropriate layer */
    int layerIdx = layerIdxFromSize(*size);
    *size = 1ull << (layerIdx + 2); /* round up to power of 2. */
    assert((0 <= layerIdx) && (layerIdx < nBitmapLayers));

    HeapBitmap &bitmap = bitmapLayers_[layerIdx];
    uintptr_t addr;
    if (bitmap.acquire(&addr))
        return addr;
    if (5 < layerIdx)
        return -1;

    const int parentLayerIdx = layerIdx + 5;
    HeapBitmap &parentBitmap = bitmapLayers_[parentLayerIdx];
    bool success = parentBitmap.acquire(&addr);
    if ((!success) && (parentLayerIdx <= 5)) {
        /* retrying with grand parent layer. */
        HeapBitmap &gParentBitmap = bitmapLayers_[parentLayerIdx + 5];
        success = gParentBitmap.acquire(&addr);
        if (!success)
            return (uintptr_t)-1;
        parentBitmap.addRegion(addr);
        success = parentBitmap.acquire(&addr);
    }
    if (!success)
        return (uintptr_t)-1;

    bitmap.addRegion(addr);
    bool res = bitmap.acquire(&addr);
    abortIf(!res, "bitmap.acquire() failed.");
    return addr;
}

size_t FixedSizedChunks::release(uintptr_t addr, size_t size, uintptr_t *freeKey) {
    int layerIdx = layerIdxFromSize(size);
    bool chunkReleased = bitmapLayers_[layerIdx].release(addr, freeKey);
    if (!chunkReleased)
        return 0;
    while (layerIdx <= 5) {
        addr = *freeKey;
        layerIdx += 5;
        chunkReleased = bitmapLayers_[layerIdx].release(addr, freeKey);
        if (!chunkReleased)
            return 0;
    }
    return layerIdxToChunkSize(layerIdx) * HeapBitmap::nChunksInRegion;
}

int FixedSizedChunks::layerIdxFromSize(size_t size) {
    size_t size4 = (size + 3) / 4;
    return int(sizeof(size_t) * 8 - __builtin_clzll(size4 - 1));
}

size_t FixedSizedChunks::layerIdxToChunkSize(int layerIdx) {
    return 4 << layerIdx;
}

/*
 * HeapMap
 */

HeapMap::HeapMap() {
    currentHeapSize_ = 0;
}

void HeapMap::finalize() {
    freeRegions_.clear();
}

size_t HeapMap::newHeapSize() {
    return std::min(currentHeapSize_, size_t(256) << 20);
}

void HeapMap::addFreeHeap(uintptr_t heap, size_t size) {
    freeRegions_[heap] = size;
    currentHeapSize_ += size;
}

uintptr_t HeapMap::acquire(size_t *size) {
    *size += 511;
    *size &= ((size_t)-1) - 511;
    RegionMap::iterator it = freeRegions_.begin();
    for ( ; it != freeRegions_.end(); ++it) {
        if (*size <= it->second)
            break;
    }
    if (it == freeRegions_.end())
        return (uintptr_t)-1;

    uintptr_t addr = it->first;
    uintptr_t newAddr = addr + *size;
    size_t newSize = it->second - *size;
    freeRegions_.erase(it);
    /* Exactly the same size as requested by size found.
     * No need to register to freeRegions. */
    if (newSize != 0)
        freeRegions_[newAddr] = newSize;

    return addr;
}

void HeapMap::release(uintptr_t addr, size_t size) {
    RegionMap::iterator it = freeRegions_.upper_bound(addr);
    if (it != freeRegions_.end()) {
        /* merge previous region if continuous. */
        if (it->first + it->second == addr) {
            it->second += size;
            /* merge next region if continuous. */
            RegionMap::iterator nextIt = it;
            ++nextIt;
            if (it->first + it->second == nextIt->first) {
                it->second += nextIt->second;
                freeRegions_.erase(nextIt);
            }
            return;
        }
    }
    /* merge next region if continuous. */
    it = freeRegions_.lower_bound(addr);
    if (it != freeRegions_.end()) {
        if (addr + size == it->first) {
            size_t newSize = size + it->second;
            freeRegions_.erase(it);
            freeRegions_[addr] = newSize;
            return;
        }
    }
    /* no continous chunks, just add free region */
    freeRegions_[addr] = size;
}

DeviceMemoryStore::DeviceMemoryStore() {
    useManagedMemory_ = false;
    enableLocalStore_ = true;
    initialized_ = false;
}

/* DeviceMemoryStore */
void DeviceMemoryStore::initialize() {
    if (enableLocalStore_) {
        fixedSizedChunks_.initialize();
        size_t newHeapSize = 128ull * (1ull << 20); /* 128 M */
        uintptr_t newHeap = cudaMalloc(newHeapSize);
        d_mems_.pushBack((void*)newHeap);
        heapMap_.addFreeHeap(newHeap, newHeapSize);
    }
    initialized_ = true;
}

void DeviceMemoryStore::finalize() {
    fixedSizedChunks_.finalize();
    heapMap_.finalize();
    chunkPropSet_.clear();
    for (sq::IdxType idx = 0; idx < d_mems_.size(); ++idx)
        cudaFree(d_mems_[idx]);
    d_mems_.clear();
    initialized_ = false;
}

void DeviceMemoryStore::useManagedMemory(bool use) {
    useManagedMemory_ = use;
}

void DeviceMemoryStore::enableLocalStore(bool enable) {
    enableLocalStore_ = enable;
}

void *DeviceMemoryStore::allocate(size_t size) {
    if (!enableLocalStore_) {
        /* use cudaMalloc(), local memory store is disabled. */
        return (void*)cudaMalloc(size);
    }

    /* FIXME: Parameterize */
    uintptr_t addr;
    if (ChunkSizeToUseMalloc < size) {
        addr = cudaMalloc(size);
#ifdef DEBUG_ALLOC
        assert(chunkPropSet_.find(ChunkProp(addr, 0, fromNone)) == chunkPropSet_.end());
#endif
        chunkPropSet_.insert(ChunkProp(addr, size, fromCudaMalloc));
    }
    else if (SmallChunkSize < size) {
        addr = allocFromHeapMap(&size);
#ifdef DEBUG_ALLOC
        assert(chunkPropSet_.find(ChunkProp(addr, 0, fromNone)) == chunkPropSet_.end());
#endif
        chunkPropSet_.insert(ChunkProp(addr, size, fromHeapMap));
    }
    else {
        addr = allocFromFixedSizedChunks(&size);
#ifdef DEBUG_ALLOC
        assert(chunkPropSet_.find(ChunkProp(addr, 0, fromNone)) == chunkPropSet_.end());
#endif
        chunkPropSet_.insert(ChunkProp(addr, size, fromFixedSizedSeries));
    }
    return reinterpret_cast<void*>(addr);
}

void DeviceMemoryStore::deallocate(void *pv) {
    if (pv == NULL) {
        /* FIXME: Add message. */
        return;
    }
    if (!enableLocalStore_) {
        /* use cudaFree(), local memory store is disabled. */
        cudaFree(pv);
        return;
    }
    if (!initialized_) {
        /* local store is enabled, and already finalized. */
        return;
    }

    uintptr_t addr = reinterpret_cast<uintptr_t>(pv);
    ChunkPropSet::iterator it = chunkPropSet_.find(ChunkProp(addr, 0, fromNone));
    if (it == chunkPropSet_.end())
        abort_("trying to release a chunk that not allocated.");
    // THROW_IF(it == chunkPropSet_.end());
    const ChunkProp &chunk = *it;

    switch (chunk.src) {
    case fromFixedSizedSeries:
        deallocateInFixedSizedChunks(chunk.addr, chunk.size);
        break;
    case fromHeapMap:
        deallocateInHeapMap(chunk.addr, chunk.size);
        break;
    case fromCudaMalloc:
        throwOnError(::cudaFree(pv));
        break;
    default:
        abort_("Must not reach."); // Must not reach here.
    }
    chunkPropSet_.erase(it);
}

uintptr_t DeviceMemoryStore::cudaMalloc(size_t size) {
    uintptr_t addr;
    if (!useManagedMemory_) {
        throwOnError(::cudaMalloc(reinterpret_cast<void**>(&addr), size));
    }
    else {
        throwOnError(::cudaMallocManaged(reinterpret_cast<void**>(&addr), size));
    }
    return addr;
}

void DeviceMemoryStore::cudaFree(void *pv) {
    throwOnError(::cudaFree(pv));
}

uintptr_t DeviceMemoryStore::allocFromHeapMap(size_t *size) {
    uintptr_t addr = heapMap_.acquire(size);
    if (addr == (uintptr_t)-1) {
        size_t newHeapSize = heapMap_.newHeapSize();
        uintptr_t newHeap = cudaMalloc(newHeapSize);
        d_mems_.pushBack((void*)newHeap);
        heapMap_.addFreeHeap(newHeap, newHeapSize);
        addr = heapMap_.acquire(size);
    }
#ifdef DEBUG_ALLOC
    fprintf(stderr, "Acquired Heapmap: %I64x, %zd.\n", addr, *size);
#endif
    return addr;
}

void DeviceMemoryStore::deallocateInHeapMap(uintptr_t addr, size_t size) {
    heapMap_.release(addr, size);
}

uintptr_t DeviceMemoryStore::allocFromFixedSizedChunks(size_t *size) {
    uintptr_t addr = fixedSizedChunks_.acquire(size);
    if (addr == (uintptr_t)-1) {
        /* FIXME: give more appropriate size. */
        size_t newHeapSize = fixedSizedChunks_.newHeapSize(*size);
        uintptr_t newHeap = allocFromHeapMap(&newHeapSize);
        fixedSizedChunks_.addFreeHeap(newHeap, newHeapSize);
        addr = fixedSizedChunks_.acquire(size);
    }
    return addr;
}

void DeviceMemoryStore::deallocateInFixedSizedChunks(uintptr_t addr, size_t size) {
    uintptr_t freeKey = (uintptr_t)-1;
    size_t chunkSize = fixedSizedChunks_.release(addr, size, &freeKey);
    if (chunkSize != 0)
        deallocateInHeapMap(freeKey, chunkSize);
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Button</title>
    <meta name="description" content="Responsive button sizes, custom colors and shapes can make buttons special and recognizable."/>
    <meta name="author" content="Alexander Tarkhov">
    <link rel="apple-touch-icon" href="/postboot/assets/img/apple-touch-icon.png">
    <link rel="icon" href="/postboot/assets/img/favicon.ico">
    <link rel="manifest" href="/postboot/assets/json/manifest.json">
    <link rel="dns-prefetch" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,500,700" rel="stylesheet">
    <link rel="stylesheet" href="/postboot/assets/css/app.min.css">

P  PostBoot  1.0.2

Version

v1

  Twitter

  Medium

  Telegram

  GitHub

Download

Background

Badge

Border

Breadcrumb

Button

Card

Collapse

Dropdown

FlexNew

Font

Form

Grid

List group

Nav

Navbar

Pagination

Position

Progress

ScrollSpy

SidebarNew

Size

Text

Triple barNew

Typography

Button

Responsive button sizes, custom colors and shapes can make buttons special and recognizable.

Custom colors

More contextual button colors diversify their place of application.

Custom outline colors

Modern outline buttons implementation with more range of colors.

Hover colors

Change button color on hover just with add custom class.

Active colors

Make any button variant active style.

3D

3D buttons inspired by Lumen Bootswatch template.

Opacity colors

Transparent buttons with opacity in the range from 0.1 to 0.9.

State colors

State buttons inspired by alert component colors and can add additional contextual sense.

Sizes

Standard buttons can change only 3 sizes without responsive behavior, with this component you can do it now.

Circle

Circle buttons inspired by material design buttons.

Pill

Pill buttons better than rounded-pill utility, because they can work with button groups.

Responsive block

Control block buttons on different devices.

Description

Examples

Background

Badge

Border

Breadcrumb

Button

Card

Collapse

Dropdown

Flex

Font

Form

Grid

List group

Nav

Navbar

Pagination

Position

Progress

ScrollSpy

Sidebar

Size

Text

Triple bar

Typography


text:
package org.apache.kafka.clients.consumer.internals;

import org.apache.kafka.common.Node;
import org.apache.kafka.common.TopicPartition;
import org.apache.kafka.common.errors.TopicAuthorizationException;
import org.apache.kafka.common.protocol.Errors;
import org.apache.kafka.common.requests.AbstractRequest;
import org.apache.kafka.common.requests.EpochEndOffset;
import org.apache.kafka.common.requests.OffsetsForLeaderEpochRequest;
import org.apache.kafka.common.requests.OffsetsForLeaderEpochResponse;
import org.apache.kafka.common.utils.LogContext;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * Convenience class for making asynchronous requests to the OffsetsForLeaderEpoch API
 */
public class OffsetsForLeaderEpochClient extends AsyncClient<
        Map<TopicPartition, SubscriptionState.FetchPosition>,
        OffsetsForLeaderEpochRequest,
        OffsetsForLeaderEpochResponse,
        OffsetsForLeaderEpochClient.OffsetForEpochResult> {

    OffsetsForLeaderEpochClient(ConsumerNetworkClient client, LogContext logContext) {
        super(client, logContext);
    }

    @Override
    protected AbstractRequest.Builder<OffsetsForLeaderEpochRequest> prepareRequest(
            Node node, Map<TopicPartition, SubscriptionState.FetchPosition> requestData) {
        Map<TopicPartition, OffsetsForLeaderEpochRequest.PartitionData> partitionData = new HashMap<>(requestData.size());
        requestData.forEach((topicPartition, fetchPosition) -> fetchPosition.offsetEpoch.ifPresent(
            fetchEpoch -> partitionData.put(topicPartition,
                new OffsetsForLeaderEpochRequest.PartitionData(fetchPosition.currentLeader.epoch, fetchEpoch))));

        return OffsetsForLeaderEpochRequest.Builder.forConsumer(partitionData);
    }

    @Override
    protected OffsetForEpochResult handleResponse(
            Node node,
            Map<TopicPartition, SubscriptionState.FetchPosition> requestData,
            OffsetsForLeaderEpochResponse response) {

        Set<TopicPartition> partitionsToRetry = new HashSet<>();
        Set<String> unauthorizedTopics = new HashSet<>();
        Map<TopicPartition, EpochEndOffset> endOffsets = new HashMap<>();

        for (TopicPartition topicPartition : requestData.keySet()) {
            EpochEndOffset epochEndOffset = response.responses().get(topicPartition);
            if (epochEndOffset == null) {
                logger().warn("Missing partition {} from response, ignoring", topicPartition);
                partitionsToRetry.add(topicPartition);
                continue;
            }
            Errors error = epochEndOffset.error();
            if (error == Errors.NONE) {
                logger().debug("Handling OffsetsForLeaderEpoch response for {}. Got offset {} for epoch {}",
                        topicPartition, epochEndOffset.endOffset(), epochEndOffset.leaderEpoch());
                endOffsets.put(topicPartition, epochEndOffset);
            } else if (error == Errors.NOT_LEADER_FOR_PARTITION ||
                    error == Errors.REPLICA_NOT_AVAILABLE ||
                    error == Errors.KAFKA_STORAGE_ERROR ||
                    error == Errors.OFFSET_NOT_AVAILABLE ||
                    error == Errors.LEADER_NOT_AVAILABLE) {
                logger().debug("Attempt to fetch offsets for partition {} failed due to {}, retrying.",
                        topicPartition, error);
                partitionsToRetry.add(topicPartition);
            } else if (error == Errors.FENCED_LEADER_EPOCH ||
                    error == Errors.UNKNOWN_LEADER_EPOCH) {
                logger().debug("Attempt to fetch offsets for partition {} failed due to {}, retrying.",
                        topicPartition, error);
                partitionsToRetry.add(topicPartition);
            } else if (error == Errors.UNKNOWN_TOPIC_OR_PARTITION) {
                logger().warn("Received unknown topic or partition error in ListOffset request for partition {}", topicPartition);
                partitionsToRetry.add(topicPartition);
            } else if (error == Errors.TOPIC_AUTHORIZATION_FAILED) {
                unauthorizedTopics.add(topicPartition.topic());
            } else {
                logger().warn("Attempt to fetch offsets for partition {} failed due to: {}, retrying.", topicPartition, error.message());
                partitionsToRetry.add(topicPartition);
            }
        }

        if (!unauthorizedTopics.isEmpty())
            throw new TopicAuthorizationException(unauthorizedTopics);
        else
            return new OffsetForEpochResult(endOffsets, partitionsToRetry);
    }

    public static class OffsetForEpochResult {
        private final Map<TopicPartition, EpochEndOffset> endOffsets;
        private final Set<TopicPartition> partitionsToRetry;

        OffsetForEpochResult(Map<TopicPartition, EpochEndOffset> endOffsets, Set<TopicPartition> partitionsNeedingRetry) {
            this.endOffsets = endOffsets;
            this.partitionsToRetry = partitionsNeedingRetry;
        }

        public Map<TopicPartition, EpochEndOffset> endOffsets() {
            return endOffsets;
        }

        public Set<TopicPartition> partitionsToRetry() {
            return partitionsToRetry;
        }
    }
}


text:
#ifndef COFACTOR_TERM_ITE_TACTIC_H_
#define COFACTOR_TERM_ITE_TACTIC_H_

#include"params.h"
class ast_manager;
class tactic;

tactic * mk_cofactor_term_ite_tactic(ast_manager & m, params_ref const & p = params_ref());
/*
  ADD_TACTIC("cofactor-term-ite", "eliminate term if-the-else using cofactors.", "mk_cofactor_term_ite_tactic(m, p)")
*/

#endif


text:
package org.apache.camel.processor;

import java.util.HashMap;
import java.util.Map;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.junit.Test;

/**
 *
 */
public class RecipientListContextScopedOnExceptionIssueTest extends ContextTestSupport {

    @Test
    public void testUsingInterceptor() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                onException(Exception.class).handled(true)
                        .process(new Processor() {
                            @Override
                            public void process(Exchange exchange) throws Exception {
                                String routeId = exchange.getUnitOfWork().getRouteContext().getRoute().getId();
                                assertEquals("fail", routeId);
                            }
                        }).to("mock:error");

                interceptSendToEndpoint("direct*").process(new Processor() {
                    public void process(Exchange exchange) throws Exception {
                        String target = exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT, String.class);
                        exchange.getIn().setHeader("target", target);
                    }
                });

                from("direct:start").routeId("start")
                    .recipientList(header("foo"));

                from("direct:foo").routeId("foo")
                    .setBody(constant("Bye World")).to("mock:foo");

                from("direct:fail").routeId("fail")
                    .throwException(new IllegalArgumentException("Forced"));
            }
        });
        context.start();

        getMockEndpoint("mock:foo").expectedMessageCount(1);
        getMockEndpoint("mock:error").expectedMessageCount(1);
        getMockEndpoint("mock:error").message(0).header("target").isEqualTo("direct://fail");

        String foo = "direct:foo,direct:fail";

        Map<String, Object> headers = new HashMap<>();
        headers.put("foo", foo);
        headers.put(Exchange.FILE_NAME, "hello.txt");

        template.sendBodyAndHeaders("direct:start", "Hello World", headers);

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testUsingExistingHeaders() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                onException(Exception.class).handled(true)
                        .process(new Processor() {
                            @Override
                            public void process(Exchange exchange) throws Exception {
                                String routeId = exchange.getUnitOfWork().getRouteContext().getRoute().getId();
                                assertEquals("fail", routeId);
                            }
                        }).to("mock:error");

                from("direct:start").routeId("start")
                        .recipientList(header("foo"));

                from("direct:foo").routeId("foo")
                        .setBody(constant("Bye World")).to("mock:foo");

                from("direct:fail").routeId("fail")
                        .throwException(new IllegalArgumentException("Forced"));
            }
        });
        context.start();

        getMockEndpoint("mock:foo").expectedMessageCount(1);
        getMockEndpoint("mock:foo").message(0).header(Exchange.TO_ENDPOINT).isEqualTo("mock://foo");
        getMockEndpoint("mock:error").expectedMessageCount(1);
        getMockEndpoint("mock:error").message(0).header(Exchange.FAILURE_ENDPOINT).isEqualTo("direct://fail");

        String foo = "direct:foo,direct:fail";

        Map<String, Object> headers = new HashMap<>();
        headers.put("foo", foo);
        headers.put(Exchange.FILE_NAME, "hello.txt");

        template.sendBodyAndHeaders("direct:start", "Hello World", headers);

        assertMockEndpointsSatisfied();
    }

}