Skip to content

Instantly share code, notes, and snippets.

View ktoso's full-sized avatar
🗻
Life is Study!

Konrad `ktoso` Malawski ktoso

🗻
Life is Study!
View GitHub Profile
@ktoso
ktoso / SerializableLambdaMethodCodeSize.java
Last active August 29, 2015 14:21
`Java 1.8.0_25` is unable to compile a class with more than `449` **serializable** lambdas, because the `deserializeLambda` method grows too big.
import java.lang.FunctionalInterface;
import java.util.function.*;
import java.io.Serializable;
import java.util.function.Function;
public class SerializableLambdaMethodCodeSize {
@FunctionalInterface
public static interface MyFunction<I, O>
extends java.util.function.Function<I, O>,
warn] /Users/ktoso/code/akka/akka-persistence/src/test/scala/akka/persistence/PersistentActorFailureSpec.scala:108: a type was inferred to be `Any`; this may indicate a programming error.
[warn] override def receiveRecover: Receive = failingRecover orElse super.receiveRecover
[warn] ^
[warn] one warning found
[info] Compiling 11 Scala sources to /Users/ktoso/code/akka/akka-bench-jmh/target/classes...
[warn] /Users/ktoso/code/akka/akka-bench-jmh/src/main/scala/akka/actor/ActorPathValidationBenchmark.scala:14: imported `Scope' is permanently hidden by definition of trait Scope in package actor
[warn] import org.openjdk.jmh.annotations.Scope
[warn] ^
[error] missing or invalid dependency detected while loading class file 'LeveldbIdMapping.class'.
[error] Could not access term iq80 in package org,
/*
* Copyright (C) 2015 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.actor
import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicInteger
import akka.routing.{NoRoutee, Routee}
import org.openjdk.jmh.annotations._
bidProjection.latestOffset.foreach { startFromOffset =>
readJournal
.query(EventsByTag("bid", startFromOffset))
.mapAsync(8) { envelope => (writer ? envelope.event).map(_ => envelope.offset) }
.mapAsync(1) { offset => bidProjection.saveProgress(offset) }
.runWith(Sink.ignore)
kka-stream-tests-experimental > testOnly *TcpSpec*
[info] TcpSpec:
Coroner Thread Count starts at 15 in akka.stream.io.TcpSpec
[info] Outgoing TCP stream
[WARN] [07/07/2015 13:11:40.739] [TcpSpec-akka.actor.default-dispatcher-3] [akka://TcpSpec/user/$b] received dead letter from Actor[akka://TcpSpec/system/IO-TCP/selectors/$a/0#2045015129]: Unbound
[WARN] [07/07/2015 13:11:40.749] [TcpSpec-akka.actor.default-dispatcher-2] [akka://TcpSpec/system/IO-TCP/selectors/$a/1] received dead letter from Actor[akka://TcpSpec/deadLetters]: ChannelReadable
[info] - must work in the happy case (2 seconds, 417 milliseconds)
[info] - must be able to write a sequence of ByteStrings (272 milliseconds)
[info] - must be able to read a sequence of ByteStrings (399 milliseconds)
[WARN] [07/07/2015 13:11:41.582] [TcpSpec-akka.actor.default-dispatcher-2] [akka://TcpSpec/system/IO-TCP/selectors/$a/7] unhandled message from Actor[akka://TcpSpec/system/IO-TCP-STREAM/client-3-%2F127.0.0.1%3A50097#-231405531]: ResumeReading
ktoso @ 月~/code/akka/akka-actor/target/classes [wip-ActorSelection-in-ALOD-ktoso*]
$ jol estimates -cp '.:/Users/ktoso/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.10.5.jar' akka.actor.ActorSelection
WARNING: Unable to attach Serviceability Agent. You can try again with super-user privileges. Use -Djol.tryWithSudo=true to try with sudo.
WARNING: VM details, e.g. object alignment, reference size, compressed references info will be guessed.
Running 64-bit HotSpot VM.
Using compressed oop with 3-bit shift.
Using compressed klass with 3-bit shift.
Objects are 8 bytes aligned.
[error] error: incompatible types: String cannot be converted to int
[error] /Users/ktoso/code/akka/akka-docs-dev/rst/java/code/docs/http/javadsl/LambdaRoutingExample.java:49: error: invalid method reference
[error] handleWith(x, y, this::multiply)
[error] ^
[error] static bound method reference
[error] /Users/ktoso/code/akka/akka-docs-dev/rst/java/code/docs/http/javadsl/LambdaRoutingExample.java:61: error: no suitable method found for handleWith(PathMatcher<Integer>,PathMatcher<Integer>,LambdaRout[...]Async)
[error] handleWith(xSegment, ySegment, LambdaRoutingExample::multiplyAsync)
[error] ^
[error] method BasicDirectivesBoilerplate.<T1#1>handleWith(RequestVal<T1#1>,Function2<RequestContext,T1#1,RouteResult>) is not applicable
[error] (cannot infer type-variable(s) T1#1
package test
import org.openjdk.jmh.annotations._
import scala.collection.immutable.Stack
import scala.collection.mutable
/*
Benchmark Mode Cnt Score Error Units
TestBenchmark.stack_1000 thrpt 20 7.446 ± 0.338 ops/ms
/*
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.stream.scaladsl
import akka.actor._
import akka.stream.Supervision._
import akka.stream.impl._
import akka.stream.impl.fusing.ActorInterpreter
import akka.stream.stage.Stage
@ktoso
ktoso / echos.scala
Last active November 10, 2015 15:29
package example
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpEntity.Chunked
import akka.http.scaladsl.model.{ ContentTypes, HttpRequest, HttpResponse }
import akka.http.scaladsl.server.Directives
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.{ Flow, Tcp }
import akka.util.ByteString