Skip to content

Instantly share code, notes, and snippets.

View ptupitsyn's full-sized avatar

Pavel Tupitsyn ptupitsyn

View GitHub Profile
@ptupitsyn
ptupitsyn / StreamVsLoopBenchmark.java
Last active September 9, 2021 08:18
Java streams vs loops benchmark
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@ptupitsyn
ptupitsyn / IgniteOracleLoader.csproj
Created January 26, 2022 08:03
Load data into Ignite from Oracle
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@ptupitsyn
ptupitsyn / IgniteClientPool.cs
Last active February 11, 2022 13:12
Apache Ignite.NET Thin Client Pool
using Apache.Ignite.Core;
using Apache.Ignite.Core.Client;
using Microsoft.Extensions.ObjectPool;
namespace IgniteThinClientConnectionPool;
public class IgniteClientPool
{
private const int ReconnectRetryLimit = 3;
@ptupitsyn
ptupitsyn / IgniteThinAtomicLong.csproj
Created March 11, 2022 16:02
Ignite.NET Thin Client AtomicLong usage via Services
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@ptupitsyn
ptupitsyn / IgniteStreamerWithExpiry.csproj
Created May 31, 2022 10:55
Ignite.NET DataStreamer with ExpiryPolicy
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@ptupitsyn
ptupitsyn / Program.cs
Last active July 17, 2022 19:17
Linux Dir Sync - copy files to external HDD on Linux with sync command after every file
using System.Diagnostics;
using System.Runtime.InteropServices;
var cts = new CancellationTokenSource();
var cancelEvt = new ManualResetEventSlim();
Console.CancelKeyPress += delegate {
cts.Cancel();
cancelEvt.Wait();
};
@ptupitsyn
ptupitsyn / EntryProcessorComputeTask.java
Created September 14, 2022 12:24
Ignite.NET mixed cluster Cache.Invoke
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.compute.ComputeJob;
import org.apache.ignite.compute.ComputeJobAdapter;
import org.apache.ignite.compute.ComputeJobResult;
import org.apache.ignite.compute.ComputeTaskAdapter;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ptupitsyn
ptupitsyn / Program.cs
Last active October 3, 2022 18:27
Apache Ignite.NET SQL indexes: compound, individual, parts of key and value
using Apache.Ignite.Core;
using Apache.Ignite.Core.Cache.Configuration;
using Apache.Ignite.Core.Cache.Query;
using var ignite = Ignition.Start();
var cacheCfg = new CacheConfiguration("people")
{
QueryEntities = new[]
{
@ptupitsyn
ptupitsyn / IgniteLinqDynamicExpr.csproj
Created November 18, 2022 05:45
Apache Ignite.NET Dynamic LINQ Expression Query
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
@ptupitsyn
ptupitsyn / Main.java
Created January 10, 2023 17:30
Apache Ignite JTA example
package org.example;
import org.apache.ignite.Ignite;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionState;