本文整理汇总了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);
}
示例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);
}
示例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)))}
};
}
示例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);
}
示例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;
}
示例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);
}
示例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");
}
示例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));
}
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}