This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2020-03-08T06:56:02.888Z WARN pool-14-thread-4 Step - - [nsx@6876 comp="cluster-boot-manager" level="WARNING" subcomp="step"] java.util.concurrent.CompletionException: java | |
.lang.RuntimeException: java.util.concurrent.TimeoutException | |
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273) | |
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280) | |
at java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:888) | |
at java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:866) | |
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488) | |
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990) | |
at org.corfudb.util.CFUtils.lambda$failAfter$0(CFUtils.java:118) | |
at java.util.concurrent.FutureTask.run(FutureTask.java:266) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package linkedlists; | |
public class SortLinkedList { | |
static class ListNode { | |
int val; | |
ListNode next; | |
ListNode(int x) { | |
this.val = x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package strings; | |
import java.util.Arrays; | |
public class KMP { | |
static int [] buildKMPTable(String pattern){ | |
if(pattern.isEmpty()){ | |
return new int [0]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bitmanipulation; | |
import java.util.function.Predicate; | |
public class Utf8Validation { | |
enum Order{ | |
TWO_BYTE, | |
THREE_BYTE, | |
FOUR_BYTE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
private static boolean isPowerOfTwo(int i){ | |
return (i & (i - 1)) == 0; | |
} | |
public static void main(String[] args) { | |
System.out.println(isPowerOfTwo(4)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2019-05-09T05:12:52.432Z | WARN | CorfuRuntime-0 | o.corfudb.runtime.CorfuRuntime | Tried to get layout from localhost:9000 but failed by timeout | |
2019-05-09T05:12:52.432Z | WARN | CorfuRuntime-0 | o.corfudb.runtime.CorfuRuntime | Couldn't connect to any up-to-date layout servers, retrying in PT1S, Retried 9 times, systemDownHandlerTriggerLimit = 60 | |
2019-05-09T05:12:52.515Z | DEBUG | client-1 | o.c.r.c.NettyClientRouter | connectAsync[tcp://localhost:9000/]: Channel connection failed, reconnecting... | |
2019-05-09T05:12:53.433Z | DEBUG | CorfuRuntime-0 | o.corfudb.runtime.CorfuRuntime | Trying connection to layout server localhost:9000 | |
2019-05-09T05:12:53.522Z | DEBUG | client-0 | o.c.r.c.NettyClientRouter | connectAsync[tcp://localhost:9000/]: Channel connection failed, reconnecting... | |
2019-05-09T05:12:53.934Z | WARN | CorfuRuntime-0 | o.corfudb.runtime.CorfuRuntime | Tried to get layout from |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait Option[+A] | |
case class Some[+A](get: A) extends Option[A] | |
case object None extends Option[Nothing] | |
sealed trait EitherError[Exception, +A] | |
case class RecoverableError(e: Exception) | |
extends EitherError[Exception, Nothing] | |
case class Result[+A](value: A) extends EitherError[Exception, A] | |
object Option { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Reader[E, A](run: E => A) | |
object Reader { | |
def andThen[E, A, B, C](fa: A => Reader[E, B], | |
fb: B => Reader[E, C]): A => Reader[E, C] = { | |
input: A => | |
val readerB: Reader[E, B] = fa(input) | |
Reader { x => | |
val readerBResult: B = readerB.run(x) | |
fb(readerBResult).run(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait IO[A] { | |
def run: A // case class parameters may not be call-by-name | |
// so we put unit in a singleton | |
} | |
object IO { | |
def pure[A](input: => A): IO[A] = new IO[A] { def run: A = input } | |
// again in terms of flatMap | |
def map[A, B](a: IO[A])(f: A => B): IO[B] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent.ExecutionContext | |
case class Async[A, E](cb: (A => E) => E) | |
object Async { | |
def run[A, E](async: Async[A, E])( | |
implicit ec: ExecutionContext): (A => E) => E = async match { | |
case Async(callback) => | |
f => |
NewerOlder