type: PIN
Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys
type: PIN
Consumer key: IQKbtAYlXLripLGPWd0HUA
| /* | |
| Dependencies: | |
| - scala 2.13.1 | |
| - zio 1.0.0-RC18-1+44-24f507c2+20200310-2150-SNAPSHOT (local build on master on 2020-03-10) | |
| - with openjdk 11.0.4+11 | |
| */ | |
| package some.pkg | |
| import zio.Runtime |
| object TestRuntime { | |
| object internal { | |
| val platform : _root_.zio.internal.Platform = _root_.zio.internal.Platform.makeDefault() | |
| // a local runtime just to build first zlayer | |
| private val r = Runtime((), platform) | |
| // non memomized env | |
| val env = ZEnv.live | |
| val runtime = Runtime.unsafeFromLayer(env, platform) |
| package com.normation | |
| import scala.concurrent.Future | |
| object CheckMemoryReleaseFlatMap { | |
| def getFreeMem = (Runtime.getRuntime().freeMemory() / (1024*1024)).toString + " MB" | |
| def doGC = { | |
| System.gc() | |
| System.runFinalization() |
| 2019-11-30 17:28:06 | |
| Full thread dump OpenJDK 64-Bit Server VM (11.0.4+11 mixed mode): | |
| Threads class SMR info: | |
| _java_thread_list=0x00007f2104006610, length=92, elements={ | |
| 0x00007f21bc099800, 0x00007f21bc618000, 0x00007f21bc629000, 0x00007f21bc63b800, | |
| 0x00007f21bc63d000, 0x00007f21bc63f000, 0x00007f21bc641000, 0x00007f21bc77e800, | |
| 0x00007f21bcc56000, 0x00007f21bcc5a800, 0x00007f21bcc5d800, 0x00007f21bccad800, | |
| 0x00007f2160001800, 0x00007f21bccb6800, 0x00007f2144476800, 0x00007f2140066000, |
| 2019-11-30 16:28:59 | |
| Full thread dump OpenJDK 64-Bit Server VM (11.0.4+11 mixed mode): | |
| Threads class SMR info: | |
| _java_thread_list=0x00007fe294127730, length=113, elements={ | |
| 0x00007fe370098800, 0x00007fe370617000, 0x00007fe370628000, 0x00007fe37063a800, | |
| 0x00007fe37063c000, 0x00007fe37063e800, 0x00007fe370640800, 0x00007fe37075d800, | |
| 0x00007fe370c06000, 0x00007fe370c32000, 0x00007fe370c33800, 0x00007fe304456000, | |
| 0x00007fe300062800, 0x00007fe300064000, 0x00007fe300066000, 0x00007fe370c93800, |
| class Callbacks[A, E, CE] { | |
| // callbacks are all returning Units with a generic callback error `CE` type. | |
| type READER = IO[E, (Int, IO[CE, Unit])] | |
| def reader1(): READER = ??? | |
| def reader2(): READER = ??? | |
| def reader3(): READER = ??? | |
| // manager function call readers, does its business decision algo and return according callback | |
| def manager(readers: List[READER]): READER = { | |
| // default callback (if no readers // no reader with positive value) does nothing |
| package test | |
| import net.sourceforge.sizeof.SizeOf | |
| object CountSetMemory { | |
| def bigArray = new Array(1024*1024) | |
| def main(args: Array[String]): Unit = { | |
| val map = Map(1 -> bigArray, 2 -> bigArray, 3 -> bigArray) | |
| val keys1 = map.keySet | |
| val keys2 = map.keySet.toSeq.toSet |
| import zio._ | |
| import zio.syntax._ | |
| // ZIO version 2.12-1.0.0-RC9.4 | |
| object Deadlock { | |
| val runtime = new DefaultRuntime {} | |
| trait Logger { |
| // this was driving me crazy, so here we are, for everyone. | |
| // inspiration from https://stackoverflow.com/questions/19058722/creating-an-outputstreamappender-for-logback | |
| import ch.qos.logback.classic.Logger | |
| import ch.qos.logback.classic.LoggerContext | |
| import ch.qos.logback.classic.encoder.PatternLayoutEncoder | |
| import ch.qos.logback.classic.spi.ILoggingEvent | |
| import ch.qos.logback.core.OutputStreamAppender | |
| import org.slf4j.LoggerFactory |