Skip to content

Instantly share code, notes, and snippets.

@maiha
maiha / probeActorRef.scala
Created August 27, 2014 04:34
check a selection has active Actor or not
private def probeActorRef(sel: ActorSelection): Unit = {
import scala.util.{Success, Failure}
import scala.concurrent.ExecutionContext.Implicits.global
import akka.util.Timeout
import scala.concurrent.duration._
implicit val timeout = Timeout(300.millis) // Timeout for the resolveOne call
sel.resolveOne().onComplete {
case Success(ref) =>
@maiha
maiha / DeadLetterWatcher.scala
Created August 27, 2014 09:03
DeadLetterWatcher
import akka.actor._
import com.typesafe.scalalogging.slf4j.StrictLogging
/** DeadLetterを監視するactor
*/
object DeadLetterWatcher {
val actorName = "dead_letter_watcher"
def props(): Props = Props(new DeadLetterWatcher)
def apply(context: ActorRefFactory): ActorRef = context.actorOf(props(), actorName)
}
scalaVersion := "2.11.2"
libraryDependencies ++= {
val v = "0.8.1"
("com.typesafe.akka" %% "akka-remote" % "2.3.5") ::
("org.scalaz" %% "scalaz-core" % "7.1.0") ::
("net.databinder" %% "unfiltered-jetty" % v) ::
("net.databinder" %% "unfiltered-filter" % v) ::
("com.chuusai" %% "shapeless" % "2.0.0") ::
("com.github.nscala-time" %% "nscala-time" % "1.4.0") ::
@maiha
maiha / InspectSession.scala
Created September 5, 2014 06:34
gatling-inspect-session
package study
/** gatling-2.0.0-RC3
* @example{
* ./bin/gatling.sh -nr -s study.InspectSession
* }
*/
import io.gatling.core.Predef._
import io.gatling.http.Predef._
@maiha
maiha / gatling.log
Created September 9, 2014 08:48
NPE at gatling-2.0.0-RC3
17:39:00.605 [WARN ] i.g.h.a.AsyncHandlerActor - Request '/v1/jsevents' failed: java.lang.NullPointerException
[ERROR] [09/09/2014 17:39:00.642] [GatlingSystem-akka.actor.default-dispatcher-14] [akka://GatlingSystem/user/$h] null
java.io.IOException
at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithCachedChannel(NettyRequestSender.java:222)
at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequestWithCertainForceConnect(NettyRequestSender.java:136)
at com.ning.http.client.providers.netty.request.NettyRequestSender.sendRequest(NettyRequestSender.java:113)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.execute(NettyAsyncHttpProvider.java:86)
at com.ning.http.client.AsyncHttpClient.executeRequest(AsyncHttpClient.java:491)
at io.gatling.http.ahc.HttpEngine.startHttpTransaction(HttpEngine.scala:249)
at io.gatling.http.action.HttpRequestAction$.startHttpTransaction$1(HttpRequestAction.scala:3
@maiha
maiha / 1.Maiha.scala
Created September 22, 2014 07:15
FastCharSequence breaks EL (gatling-snapshot)
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class Maiha extends Simulation {
val top =
exec(http("gatling.io")
.get("/")
.check(regex("""href="(.*?)"""").saveAs("url")) // should be "/assets/images/favicon.ico"
)
.exec(http("1st link")
@maiha
maiha / 1.候補(OSS)
Last active August 29, 2015 14:07
scalaで使えるjob schedulerの調査 (2014.10.03)
a) akka.actor.Scheduler
* akka bundle
* 生akka系
* 永続化: なし
* 使用例: 'system.scheduler.scheduleOnce(8 hours, self, StartDeliveryWorkers)'
* akka: 2.3 ready
* 開発: 活発 (akkaに依存)
b) akka-quartz-scheduler
* https://github.com/enragedginger/akka-quartz-scheduler
@maiha
maiha / deadletter
Created October 3, 2014 12:10
akka
(akka.remote.RemoteWatcher.Heartbeat$,1)
(akka.remote.transport.ActorTransportAdapter.DisassociateUnderlying,6)
(akka.remote.transport.AssociationHandle.InboundPayload,152)
(akka.remote.EndpointWriter.AckIdleCheckTimer$,12)
(akka.remote.EndpointWriter.BackoffTimer$,2)
(akka.remote.transport.AssociationHandle.Disassociated,8)
(akka.remote.transport.ProtocolStateActor.HandleListenerRegistered,4)
(akka.actor.FSM.Timer,4)
@maiha
maiha / gist:4c039c23c16616a6bcd3
Created November 7, 2014 06:26
implicitいろいろ
implicit
- implicit parameter
- implicit parameter method
- play request派
- implicit parameter constructor
- env派(環境引き回し)
- dynamic派
- implicit conversions
- Int seconds派
- implicit class
@maiha
maiha / 1.候補
Last active August 29, 2015 14:09
SNMPのscalaライブラリ候補まとめ (追加情報welcome)
snmpget
コマンドライン
snmp4j
デファクトのJavaライブラリ
http://www.snmp4j.org/
snmpbulk