Skip to content

Instantly share code, notes, and snippets.

View jmcardon's full-sized avatar
💭
Why on earth do we need statuses

Jose C jmcardon

💭
Why on earth do we need statuses
View GitHub Profile
package io.chrisdavenport
import cats._
import cats.implicits._
import cats.effect.{IO, Sync}
import java.util.UUID
abstract class FUUIDModule {
type FUUID
import java.nio.charset.StandardCharsets.UTF_8
import java.util.concurrent.atomic.{AtomicInteger, AtomicReference}
import cats.effect.{Concurrent, Sync}
import cats.syntax.all._
import fs2.async.mutable.Queue
import fs2.{Sink, Stream}
import org.http4s.websocket.WebsocketBits._
import WebsocketMsg._
import cats.effect.IO
import cats.implicits._
import fs2._
import fs2.async.mutable.Signal
import scala.concurrent.ExecutionContext
import scala.concurrent.duration._
import java.util.Random
package org.http4s
import cats.effect.IO
import cats.implicits._
import fs2._
import org.http4s.client.Client
import org.http4s.circe._
import org.http4s.dsl.io._
import org.http4s.client.blaze.Http1Client

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@jmcardon
jmcardon / HotSpot JVM intrinsics
Created April 14, 2018 01:51 — forked from apangin/HotSpot JVM intrinsics
HotSpot JVM intrinsics
_hashCode java/lang/Object.hashCode()I
_getClass java/lang/Object.getClass()Ljava/lang/Class;
_clone java/lang/Object.clone()Ljava/lang/Object;
_dabs java/lang/Math.abs(D)D
_dsin java/lang/Math.sin(D)D
_dcos java/lang/Math.cos(D)D
_dtan java/lang/Math.tan(D)D
_datan2 java/lang/Math.atan2(DD)D
_dsqrt java/lang/Math.sqrt(D)D
_dlog java/lang/Math.log(D)D
import java.nio.charset.StandardCharsets
import cats.effect._
import cats.implicits.{catsSyntaxEither => _, _}
import fs2._
import org.http4s._
import org.http4s.multipart._
import org.http4s.util._
/** A low-level multipart-parsing pipe. Most end users will prefer EntityDecoder[Multipart]. */
import cats.{Applicative, Monad}
import cats.syntax.all._
import org.http4s._
sealed trait Route[F[_]] {
def run(r: Request[F]): F[Response[F]]
def <+>(other: Route[F]): Route[F]
}
import java.util.concurrent.Executors
import cats.effect._
import fs2._
import org.scalatest.{FlatSpec, MustMatchers}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext
class TestNStuff extends FlatSpec with MustMatchers {
/** Method in question:
* https://github.com/circe/circe/blob/master/modules/core/shared/src/main/scala/io/circe/JsonObject.scala#L260
*/
object GucciMane extends App {
println(classOf[io.circe.JsonObject$].getMethod("fromLinkedHashMap")) //Throws NoSuchMethodException
}