This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Base trait for all classes that wants to be able use the logging infrastructure. | |
* | |
* @author <a href="http://jonasboner.com">Jonas Bonér</a> | |
*/ | |
trait Logging { | |
@transient var log = Logger.get(this.getClass.getName) | |
} | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.facebook.thrift.{TBase, TDeserializer} | |
import java.io.{BufferedInputStream, DataInputStream, File, FileInputStream, InputStream} | |
import java.util.zip.GZIPInputStream | |
import net.lag.logging.Logger | |
import scala.reflect.Manifest | |
// you'll want to import your generated Thrift package too! | |
class ThriftFileScanner[T <: TBase](implicit man: Manifest[T]) { | |
val log = Logger.get | |
var bufferedIn: BufferedInputStream = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.{BufferedReader, File, InputStream, InputStreamReader, IOException, PrintWriter, Writer} | |
import java.net.{InetAddress, ServerSocket, Socket, SocketException} | |
import java.util.concurrent.Executors | |
import net.lag.logging.Logger | |
import scala.actors.Actor | |
import scala.actors.Actor._ | |
import scala.tools.nsc._ | |
class RemoteDebugServer(port: Int) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Example of Akka/Spring integration --> | |
<beans> | |
<!-- Create an active object --> | |
<akka:active-object id="myActiveObject" | |
target="com.biz.MyPOJO" | |
transactional="true" | |
timeout="1000" /> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.zip._ | |
import java.io._ | |
class InMemZip(compressionLevel: Int) { | |
private val _outBytes = new ByteArrayOutputStream | |
private val _zipOutStream = { | |
val s = new ZipOutputStream(_outBytes) | |
s.setLevel(compressionLevel) | |
s | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shutdown HawtDispatch GlobalQueue | |
org.fusesource.hawtdispatch.ScalaDispatch.globalQueue.asInstanceOf[org.fusesource.hawtdispatch.internal.GlobalDispatchQueue].shutdown | |
// Clear Thread.subclassAudits | |
val tf = classOf[java.lang.Thread].getDeclaredField("subclassAudits") | |
tf.setAccessible(true) | |
val subclassAudits = tf.get(null).asInstanceOf[java.util.Map[_,_]] | |
subclassAudits.synchronized {subclassAudits.clear} | |
// Clear and reset j.u.l.Level.known (due to Configgy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable.ListBuffer | |
import akka.actor.{Actor,ActorRef} | |
import akka.actor.Actor._ | |
import akka.routing.{ Listeners, Listen } | |
//Represents a domain event | |
trait Event | |
//A builder to create domain entities | |
trait EntityBuilder[Entity] { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.earldouglas.remoteakka | |
import akka.actor.Actor | |
import akka.actor.Actor._ | |
case object Greeting | |
case class Jar(val bytes: Array[Byte]) | |
case class RegisterRemote(val name: String, val className: String) | |
object Runner { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"cmd": ["sbt-no-color compile"], | |
"file_regex": "^\\[error\\] ([.a-zA-Z0-9/-]+[.]scala):([0-9]+):", | |
"selector": "source.scala", | |
"working_dir": "${project_path:${folder}}", | |
"shell": "true" | |
} |