Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.marshalling.Marshaller | |
import akka.http.scaladsl.marshalling.ToResponseMarshallable.apply | |
import akka.http.scaladsl.marshalling.ToResponseMarshaller | |
import akka.http.scaladsl.model.{ ContentTypes, HttpEntity } | |
import akka.http.scaladsl.model.HttpEntity.ChunkStreamPart | |
import akka.http.scaladsl.model.HttpResponse | |
import akka.http.scaladsl.server.Directive.addByNameNullaryApply |
import akka.NotUsed | |
import akka.actor.ActorSystem | |
import akka.http.scaladsl.Http | |
import akka.http.scaladsl.common.{ EntityStreamingSupport, JsonEntityStreamingSupport } | |
import akka.http.scaladsl.model.{ HttpEntity, StatusCodes, _ } | |
import akka.http.scaladsl.server.Directives._ | |
import akka.stream.ActorMaterializer | |
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._ | |
import akka.http.scaladsl.marshalling.{ Marshaller, ToEntityMarshaller, ToResponseMarshaller } | |
import akka.http.scaladsl.model.TransferEncodings.gzip |
import akka.actor.{Actor, ActorRef, ActorSystem, CoordinatedShutdown, Props} | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.math.BigInt | |
import scala.util.Success | |
import akka.pattern._ | |
import akka.util.Timeout | |
import scala.concurrent.duration._ |
IAM | |
IAM => Identity And Access Management | |
It contains Users, Groups, Roles | |
Users => Normal Person As An User. | |
Groups => Based On Functions Designate it to particular groups. Example: Dev-Ops, Engineering. | |
Roles => Machine. | |
Policies Are In Json. | |
Lease Privilege Principles. |
/** | |
* @author ShankarShastri | |
* Algorithm: JumpingMario (https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2864) | |
*/ | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Scanner; | |
import java.util.Vector; | |
import java.util.function.BiFunction; |
/** | |
* @author ShankarShastri | |
* Algorithm: JumpingMario (https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2864) | |
*/ | |
import scala.io.StdIn._ | |
object JumpingMario { | |
def main(args: Array[String]): Unit = { | |
val n = readLine().toInt | |
loopWithIndex(n) { i => |
import akka.actor._ | |
import akka.routing.{ Broadcast, DefaultResizer, RoundRobinPool } | |
case object Init | |
case object Pong | |
case object Ping | |
class PingActor(pongActorRef: ActorRef) extends Actor { | |
def receive: Receive = { | |
case Init => |
package protoser | |
import java.util.concurrent.atomic.AtomicReference | |
import akka.actor.ExtendedActorSystem | |
import akka.serialization.BaseSerializer | |
import com.trueaccord.scalapb.GeneratedMessageCompanion | |
class ScalaPbSerializer(val system: ExtendedActorSystem) extends BaseSerializer { | |
private val classToCompanionMapRef = new AtomicReference[Map[Class[_], GeneratedMessageCompanion[_]]](Map.empty) |