当前位置: 首页>>代码示例>>Java>>正文


Java Ignite类代码示例

本文整理汇总了Java中org.apache.ignite.Ignite的典型用法代码示例。如果您正苦于以下问题:Java Ignite类的具体用法?Java Ignite怎么用?Java Ignite使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Ignite类属于org.apache.ignite包,在下文中一共展示了Ignite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.ignite.Ignite; //导入依赖的package包/类
public static void main(String[] args) {
	try (Ignite ignite =  Ignition.start(IgniteConfigurationHelper.helloworldConfiguration())) {
		IgniteRunnable task = new IgniteRunnable() {
			private static final long serialVersionUID = 787726700536869271L;

			@IgniteInstanceResource
			private transient Ignite ignite;
			@Override
			public void run() {
				System.out.println("Hello Gaurav Bytes from: " + ignite.name());
				
			}
		};
		ignite.compute().run(task);
	}
	Ignition.stop(true);
}
 
开发者ID:gauravrmazra,项目名称:gauravbytes,代码行数:18,代码来源:HelloworldIgniteExample.java

示例2: reduce

import org.apache.ignite.Ignite; //导入依赖的package包/类
/**
 * Distributed version of fold operation. This method also applicable to sparse zeroes.
 *
 * @param cacheName Cache name.
 * @param ignite ignite
 * @param acc Accumulator
 * @param supp supplier
 * @param entriesGen entries generator
 * @param comb combiner
 * @param zeroValSupp Zero value supplier.
 * @return aggregated result
 */
public static <K, V, A, W> A reduce(String cacheName, Ignite ignite,
    IgniteTriFunction<W, Cache.Entry<K, V>, A, A> acc,
    IgniteSupplier<W> supp,
    IgniteSupplier<Iterable<Cache.Entry<K, V>>> entriesGen, IgniteBinaryOperator<A> comb,
    IgniteSupplier<A> zeroValSupp) {

    A defRes = zeroValSupp.get();

    Collection<A> totalRes = bcast(cacheName, ignite, () -> {
        // Use affinity in filter for ScanQuery. Otherwise we accept consumer in each node which is wrong.
        A a = zeroValSupp.get();

        W w = supp.get();

        for (Cache.Entry<K, V> kvEntry : entriesGen.get())
            a = acc.apply(w, kvEntry, a);

        return a;
    });

    return totalRes.stream().reduce(defRes, comb);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:35,代码来源:CacheUtils.java

示例3: provideKVMetaList

import org.apache.ignite.Ignite; //导入依赖的package包/类
public static Object[][] provideKVMetaList(Ignite ignite) {
    return new Object[][]{
            {asList(PrimitivesHolder.withMetaData(1, PH_1),
                    PrimitivesHolder.withMetaData(2, PH_2))},
            {asList(PrimitivesHolder.withMetaData(1, binary(ignite, PH_1)),
                    PrimitivesHolder.withMetaData(2, binary(ignite, PH_2)))},
            {asList(PrimitiveWrappersHolder.withMetaData(1, PWH_1),
                    PrimitiveWrappersHolder.withMetaData(2, PWH_2),
                    PrimitiveWrappersHolder.withMetaData(3, PWH_3))},
            {asList(PrimitiveWrappersHolder.withMetaData(1, binary(ignite, PWH_1)),
                    PrimitiveWrappersHolder.withMetaData(2, binary(ignite, PWH_2)),
                    PrimitiveWrappersHolder.withMetaData(3, binary(ignite, PWH_3)))},
            {asList(OtherTypesHolder.withMetaData(1, OTH_1),
                    OtherTypesHolder.withMetaData(2, OTH_2))},
            {asList(//OtherTypesHolder.withMetaData(1, binary(ignite, OTH_1)),
                    OtherTypesHolder.withMetaData(2, binary(ignite, OTH_2)))}
    };
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:19,代码来源:DataProviders.java

示例4: cancelServices

import org.apache.ignite.Ignite; //导入依赖的package包/类
/**
 * Cancels used services.
 */
public void cancelServices() {
    ignite().compute().broadcast(new IgniteRunnable() {
        /** Auto-injected ignite instance. */
        @IgniteInstanceResource
        private transient Ignite ignite;

        @Override public void run() {
            Injection container = (Injection)ignite.cluster().nodeLocalMap().get(Injection.CONTAINER);
            if (container != null) {
                container.stop();
            }
        }
    });
    ignite().services().cancel(CommandService.SERVICE_NAME);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:19,代码来源:TestResources.java

示例5: MLPGroupUpdateTrainer

import org.apache.ignite.Ignite; //导入依赖的package包/类
/**
 * Construct instance of this class with given parameters.
 *
 * @param loss Loss function.
 * @param ignite Ignite instance.
 * @param tolerance Error tolerance.
 */
public MLPGroupUpdateTrainer(int maxGlobalSteps,
    int syncRate,
    IgniteFunction<List<U>, U> allUpdatesReducer,
    IgniteFunction<List<U>, U> locStepUpdatesReducer,
    ParameterUpdateCalculator<MultilayerPerceptron, U> updateCalculator,
    IgniteFunction<Vector, IgniteDifferentiableVectorToDoubleFunction> loss,
    Ignite ignite, double tolerance) {
    super(new MLPMetaoptimizer<>(allUpdatesReducer), MLPCache.getOrCreate(ignite), ignite);

    this.maxGlobalSteps = maxGlobalSteps;
    this.syncRate = syncRate;
    this.allUpdatesReducer = allUpdatesReducer;
    this.locStepUpdatesReducer = locStepUpdatesReducer;
    this.updateCalculator = updateCalculator;
    this.loss = loss;
    this.tolerance = tolerance;
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:25,代码来源:MLPGroupUpdateTrainer.java

示例6: deployServices

import org.apache.ignite.Ignite; //导入依赖的package包/类
/**
 * Deploys used services synchronously.
 */
public void deployServices() {
    ignite().compute().broadcast(new IgniteRunnable() {
        /** Auto-injected ignite instance. */
        @IgniteInstanceResource
        private transient Ignite ignite;

        @Override public void run() {
            ignite.cluster().nodeLocalMap().remove(Injection.CONTAINER);
        }
    });
    ignite().services().deployClusterSingleton(CommandService.SERVICE_NAME, activeStoreConfiguration.commandService());

    do {
        try {
            sleep(100);
        }
        catch (InterruptedException e) {
            break;
        }
    }
    while (head() == null);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:26,代码来源:TestResources.java

示例7: startWorkers

import org.apache.ignite.Ignite; //导入依赖的package包/类
/** */
private void startWorkers(Ignite ignite) {
    logger.info("Starting workers");

    for (int i = 0; i < config.getThreads(); i++) {
        int currentWorkers = workers.size();
        long startPosition = generateStartPosition(ignite, currentWorkers, config);
        long endPosition = generateEndPosition(config, startPosition);
        Worker worker = createWorker(ignite, config, startPosition, endPosition);

        worker.setName(config.getTestName() + "-worker-" + currentWorkers);
        worker.start();
        workers.add(worker);
    }
    Statistics.recordWorkersThreadStarted(config.getThreads());
    logger.info("Workers started");
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:18,代码来源:LoadTestDriver.java

示例8: writeBatchSafe

import org.apache.ignite.Ignite; //导入依赖的package包/类
private static <K, V> void writeBatchSafe(Ignite ignite, String cacheName, Map<K, V> entries) {
    int batchLimit = PREPOPULATION_BATCH_LIMIT;

    if (entries.size() <= batchLimit) {
        ignite.compute().run(new BatchWriter(cacheName, entries));
        return;
    }
    Map<K, V> batch = new HashMap<>(batchLimit);

    for (Map.Entry<K, V> entry : entries.entrySet()) {
        if (batch.size() == batchLimit) {
            ignite.compute().run(new BatchWriter(cacheName, batch));
            batch.clear();
        }
        batch.put(entry.getKey(), entry.getValue());
    }
    if (!batch.isEmpty()) {
        ignite.compute().run(new BatchWriter(cacheName, batch));
    }
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:21,代码来源:SimulationUtil.java

示例9: main

import org.apache.ignite.Ignite; //导入依赖的package包/类
/** */
public static void main(String[] args) throws IOException {
    Ignite ignite = TestsHelper.getClusterClient();
    StatisticsCollector collector = new StatisticsCollectorBuilder()
        .enableDebugReporting(TestsHelper.isLoadTestsStatisticsDebugReporEnabled())
        .enableNodeOverloadStop(TestsHelper.isLoadTestsStatisticsOverloadStopEnabled())
        .setLatencyThreshold(TestsHelper.getLoadTestsStatisticsLatencyThreshold())
        .setQuantile(TestsHelper.getLoadTestsStatisticsLatencyThresholdQuantile())
        .setReportFrequency(TestsHelper.getLoadTestsStatisticsReportFrequency())
        .enableCsvReporting(TestsHelper.isLoadTestsStatisticsAggregatedReportEnabled())
        .setCsvReportDirectory(TestsHelper.getLoadTestsStatisticsAggregatedReportLocation())
        .enableGangliaReporting(TestsHelper.isLoadTestsStatisticsGangliaReportingEnabled())
        .setGangliaAddress(TestsHelper.getLoadTestsStatisticsGangliaAddress())
        .build(ignite);
    Statistics.enable(ignite, collector);
    LoadTestDriversCoordinator.runCoordinator(ignite, LoadTestConfig.defaultConfig());
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:18,代码来源:LoadTestsStatisticsDriver.java

示例10: Commander

import org.apache.ignite.Ignite; //导入依赖的package包/类
@Inject
public Commander(
    Ignite ignite,
    RPCManager manager,
    @Named(DataCapturerBusConfiguration.CLUSTER_ID) UUID clusterId,
    @Named(DataCapturerBusConfiguration.RPC_ADDRESS) String address,
    @Named(DataCapturerBusConfiguration.SUPER_CLUSTER_ADDRESS) String superClusterAddress,
    DataRecoveryConfig dataRecoveryConfig,
    Provider<ActiveCacheStoreService> mainInterfaceProvider,
    PublisherReplicaService replicaService
) {
    this.ignite = ignite;
    this.manager = manager;
    this.clusterId = clusterId;
    this.address = address;
    this.superClusterAddress = superClusterAddress;
    this.dataRecoveryConfig = dataRecoveryConfig;
    this.mainInterfaceProvider = mainInterfaceProvider;
    this.replicaService = replicaService;
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:21,代码来源:Commander.java

示例11: IgniteOperationRepository

import org.apache.ignite.Ignite; //导入依赖的package包/类
@Autowired
public IgniteOperationRepository(@Qualifier("operationIgniteClient") Ignite ignite, KafkaTemplate kafkaTemplate) {
    this.ignite = ignite;
    operationCache = ignite.cache("operationCache");

    this.kafkaTemplate = kafkaTemplate;
}
 
开发者ID:kloiasoft,项目名称:eventapis,代码行数:8,代码来源:IgniteOperationRepository.java

示例12: getGenesInOrderForChromosome

import org.apache.ignite.Ignite; //导入依赖的package包/类
/**
 * 
 * Retrieve genes in order
 * 
 * @param ignite
 * @param chromosome
 * @return List<Gene>
 */

public static List<Gene> getGenesInOrderForChromosome(Ignite ignite, Chromosome chromosome) {
    List<Gene> genes = new ArrayList();
    IgniteCache<Long, Gene> cache = ignite.cache(GAGridConstants.GENE_CACHE);
  
    long[] primaryKeys = chromosome.getGenes();
    
    for (int k =0; k< primaryKeys.length; k++)
    {
    
      StringBuffer sbSqlClause = new StringBuffer();
      sbSqlClause.append("_key IN ");
      sbSqlClause.append("(");
      sbSqlClause.append(primaryKeys[k]);
      sbSqlClause.append(")");
      
      SqlQuery sql = new SqlQuery(Gene.class, sbSqlClause.toString());

       try (QueryCursor<Entry<Long, Gene>> cursor = cache.query(sql)) {
        for (Entry<Long, Gene> e : cursor)
            genes.add(e.getValue());
        }
    }
   
    return genes;
}
 
开发者ID:techbysample,项目名称:gagrid,代码行数:35,代码来源:GAGridUtils.java

示例13: LeadContextLoader

import org.apache.ignite.Ignite; //导入依赖的package包/类
public LeadContextLoader(Ignite ignite, KafkaFactory kafkaFactory, UUID leadId,
    DataRecoveryConfig dataRecoveryConfig,  Reference<Long> storedLastDenseCommitted,
    ClusterGroupService clusterGroupService, PublisherKafkaService kafkaService) {
    this.ignite = ignite;
    this.kafkaFactory = kafkaFactory;
    this.leadId = leadId;
    this.dataRecoveryConfig = dataRecoveryConfig;
    this.storedLastDenseCommitted = storedLastDenseCommitted;
    this.clusterGroupService = clusterGroupService;
    this.kafkaService = kafkaService;
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:12,代码来源:LeadContextLoader.java

示例14: Reader

import org.apache.ignite.Ignite; //导入依赖的package包/类
public Reader(Ignite ignite, KafkaFactory kafkaFactory, ClusterConfig config,
              Serializer serializer, CommitStrategy commitStrategy,
              UUID readerId, Predicate<Map<Long, TransactionData>> bufferOverflowCondition) {
    this(ignite, kafkaFactory, config, serializer, commitStrategy,
            new PeriodicIterationCondition(DEFAULT_COMMIT_ITERATION_PERIOD), DEFAULT_BUFFER_CLEAR_PERIOD,
            readerId, bufferOverflowCondition, DEFAULT_BUFFER_CHECK_PERIOD);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:8,代码来源:Reader.java

示例15: reader

import org.apache.ignite.Ignite; //导入依赖的package包/类
@Bean
public Reader reader(@Qualifier("ignite-bean") Ignite ignite, KafkaFactory kafkaFactory, ClusterConfig config,
                     Serializer serializer, CommitStrategy commitStrategy, @Qualifier("readerId") UUID readerId,
                     @Qualifier("buffer-overflow") Predicate<Map<Long, TransactionData>> bufferOverflowCondition
) {
    return new Reader(ignite, kafkaFactory, config, serializer, commitStrategy, readerId,
            bufferOverflowCondition);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:9,代码来源:ReaderConfig.java


注:本文中的org.apache.ignite.Ignite类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。