Skip to content

Instantly share code, notes, and snippets.

// Auto generated by io.soabase.recordbuilder.core.RecordBuilder: https://github.com/Randgalt/record-builder
package io.soabase.recordbuilder.test;
import java.util.AbstractMap;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Stream;
import javax.annotation.processing.Generated;
@Generated("io.soabase.recordbuilder.core.RecordBuilder")
// Auto generated by io.soabase.recordbuilder.core.RecordBuilder: https://github.com/Randgalt/record-builder
package io.soabase.recordbuilder.test;
import io.soabase.recordbuilder.core.RecordBuilder;
import javax.annotation.processing.Generated;
@Generated("io.soabase.recordbuilder.core.RecordInterface")
@RecordBuilder
public record PersonRecord(String name, int age) implements Person {}
// change to checkSessionExpiration()
else if ( currentConnectionState == ConnectionState.LOST )
{
try
{
if ( client.getZookeeperClient().isConnected() )
{
log.warn("ConnectionState is LOST but isConnected() is true. Resetting connection.");
client.getZookeeperClient().reset();
package org.apache.curator.framework.recipes.cache;
import com.google.common.collect.Iterators;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.NoSuchElementException;
class TreeCacheIterator implements Iterator<ChildData>
{
private final LinkedList<Current> stack = new LinkedList<>();
package org.apache.curator.framework.recipes.cache;
public class CuratorCacheListenerAdaptor implements CuratorCacheListener
{
@Override
public void event(Type type, ChildData oldData, ChildData data)
{
switch ( type )
{
case NODE_CREATED:
package org.apache.curator.framework.recipes.leader;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.api.transaction.CuratorOp;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Objects;
@Test
public void testValidateConnectionEventRaces() throws Exception
{
try (CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1)))
{
CuratorFrameworkImpl clientImpl = (CuratorFrameworkImpl)client;
client.start();
client.getChildren().forPath("/");
@Randgalt
Randgalt / CuratorFrameworkImpl.java
Created June 6, 2019 13:19
checkBackgroundRetry() change
@VisibleForTesting
volatile CountDownLatch debugCheckBackgroundRetryLatch;
@VisibleForTesting
volatile CountDownLatch debugCheckBackgroundRetryReadyLatch;
@SuppressWarnings({"ThrowableResultOfMethodCallIgnored"})
private <DATA_TYPE> boolean checkBackgroundRetry(OperationAndData<DATA_TYPE> operationAndData, CuratorEvent event)
{
boolean doRetry = false;
if ( client.getRetryPolicy().allowRetry(operationAndData.getThenIncrementRetryCount(), operationAndData.getElapsedTimeMs(), operationAndData) )
@Randgalt
Randgalt / Nonchalantly.java
Created December 21, 2017 17:11 — forked from poetix/Nonchalantly.java
A Java 8 class for when you just don't give a fuck about that checked exception
public interface Nonchalantly<T> {
static <T, E extends Throwable> T invoke(Nonchalantly<T> f) throws E {
try {
return f.run();
} catch (Throwable e) {
throw (E) e;
}
}
T run() throws Throwable;

Keybase proof

I hereby claim:

  • I am randgalt on github.
  • I am randgalt (https://keybase.io/randgalt) on keybase.
  • I have a public key ASBZzr2GAs6DsSbzTjVdf73ONwS70kmRfYjhEiyyCr4vtgo

To claim this, I am signing this object: