Skip to content

Instantly share code, notes, and snippets.

View mp911de's full-sized avatar
🚑
I may be slow to respond…

Mark Paluch mp911de

🚑
I may be slow to respond…
View GitHub Profile
/*
* Copyright 2020 the original author or authors.
*
* Licensed 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mp911de
mp911de / DefaultRepositoryTagsProvider.java
Created July 8, 2020 07:49
Spring Data Repository Metrics Spring Data Rep
/*
* Copyright 2020 the original author or authors.
*
* Licensed 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
*
* Unless required by applicable law or agreed to in writing, software
@mp911de
mp911de / StatementBenchmarks.java
Created October 29, 2019 15:20
R2DBC Postgres benchmarks
/*
* Copyright 2019 the original author or authors.
*
* Licensed 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mp911de
mp911de / Benchmarks.java
Last active February 11, 2022 20:04
Benchmark using Optional/Streams vs. imperative variants of the same code
/*
* Copyright 2019 the original author or authors.
*
* Licensed 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
*
* Unless required by applicable law or agreed to in writing, software
public class MultithreadedExample {
public static void main(String[] args) throws Exception{
// Syntax: redis://[password@]host[:port][/databaseNumber]
RedisClient redisClient = RedisClient.create(RedisURI.create("redis://localhost:6379/0"));
CountDownLatch latch = new CountDownLatch(1);
List<RedisThread> threads = IntStream.range(0, 100).mapToObj(ignore -> new RedisThread(redisClient, latch))
@mp911de
mp911de / R2dbcWithAkkaStreams.scala
Created June 20, 2019 21:42
R2DBC with Akka Streams
/*
* Copyright 2019 the original author or authors.
*
* Licensed 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
*
* Unless required by applicable law or agreed to in writing, software
import io.r2dbc.mssql.MssqlConnectionConfiguration;
import io.r2dbc.mssql.MssqlConnectionFactory;
public class Reproducer {
public static void main(String[] args) {
MssqlConnectionConfiguration config = MssqlConnectionConfiguration.builder()
.host("abcbookstore.database.windows.net")
.database("foo")
@mp911de
mp911de / HelloMySQL.java
Last active October 19, 2020 09:16
Spring Data R2DBC with MySQL via jasync-sql
/*
* Copyright 2019 the original author or authors.
*
* Licensed 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
*
* Unless required by applicable law or agreed to in writing, software
@mp911de
mp911de / Parameter.java
Created March 6, 2019 13:44
R2DBC Stored Procedures Proposal
/**
* OUT and IN/OUT parameter wrapper for stored procedures (callable functions).
*
* @param <T>
*/
class Parameter<T> {
@Nullable
private final T value;
@mp911de
mp911de / JdbcTransactionPlayground.java
Created February 2, 2019 17:44
Playing with Postgres and locking
/*
* Copyright 2019 the original author or authors.
*
* Licensed 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
*