Skip to content

Instantly share code, notes, and snippets.

@TanyaGaleyev
TanyaGaleyev / example-cache.xml
Created June 26, 2018 13:45
Ignite instance config
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
import org.springframework.test.web.reactive.server.EntityExchangeResult;
import org.springframework.test.web.reactive.server.WebTestClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.DispatcherHandler;
import org.springframework.web.reactive.config.DelegatingWebFluxConfiguration;
@TanyaGaleyev
TanyaGaleyev / NoBodyResponseTest.java
Last active May 18, 2017 13:26
Vertx HttpServer and no-message-body responses
package org.ivan.vertx.nobody;
import io.vertx.core.Vertx;
import org.junit.Assert;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
@TanyaGaleyev
TanyaGaleyev / HundredCpu.java
Last active July 8, 2016 09:05
Disruptor 100% CPU consumption when using SleepingWaitStrategy on 32 bit Linux
package org.ivan.experiments.disruptor;
import com.lmax.disruptor.*;
import com.lmax.disruptor.dsl.Disruptor;
import com.lmax.disruptor.dsl.ProducerType;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;
@TanyaGaleyev
TanyaGaleyev / FullCpu.java
Created July 5, 2016 14:13
Simple application utilizing reactor to demonstrate 100% CPU load on 32 bit Linux
package org.ivan.experiments.reactor;
import reactor.core.publisher.WorkQueueProcessor;
import reactor.core.subscriber.SubmissionEmitter;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.time.Duration;
@TanyaGaleyev
TanyaGaleyev / HangingElement.java
Last active June 14, 2016 16:03
Demonstrates that element hangs in time buffered WorkQueueProcessor if it is submitted at the same time when other elements are consumed. Completion with exception means problem reproduction. Java 8 and Reactor 2.5.0.M4 are used. Async Log4j2 with SLF4J is used for logging. Logging can be comment out to simplify setup.
package org.ivan.experiments.reactor;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.WorkQueueProcessor;
import reactor.core.scheduler.Schedulers;
import reactor.core.scheduler.TimedScheduler;
import reactor.core.subscriber.SubmissionEmitter;
alert('boom')
@TanyaGaleyev
TanyaGaleyev / AbstractChildHolder.java
Created April 9, 2015 15:33
Static initializer deadlock proof of concept
package com.fsecure.pavlukhin.concurrentclinit;
abstract public class AbstractChildHolder {
public static class Child1 extends AbstractChildHolder {
static {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
@TanyaGaleyev
TanyaGaleyev / InetFailureTest.java
Created November 2, 2014 11:58
Cloudbees tcp syslog test
package org.ivan.cloudbees;
import com.cloudbees.syslog.Facility;
import com.cloudbees.syslog.Severity;
import com.cloudbees.syslog.sender.TcpSyslogMessageSender;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
package org.ivan.rmi;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.rmi.AlreadyBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;