based remoting protocol Protobuf + added SBinary, Scala-JSON, Java-JSON and Protobuf serialization traits and protocols for remote and storage usage

This commit is contained in:
jboner 2009-07-23 20:01:37 +02:00
parent a3fac4338f
commit 4878c9fa9b
27 changed files with 1012 additions and 1174 deletions

View file

@ -4,6 +4,8 @@
package se.scalablesolutions.akka.kernel.util
import java.io.UnsupportedEncodingException
import java.security.{NoSuchAlgorithmException, MessageDigest}
import java.util.concurrent.locks.ReentrantReadWriteLock
import scala.actors._
@ -18,6 +20,20 @@ class SystemFailure(cause: Throwable) extends RuntimeException(cause)
*/
object Helpers extends Logging {
def getDigestFor(s: String) = {
val digest = MessageDigest.getInstance("MD5")
digest.update(s.getBytes("ASCII"))
val bytes = digest.digest
val sb = new StringBuilder
val hex = "0123456789ABCDEF"
bytes.foreach(b => {
val n = b.asInstanceOf[Int]
sb.append(hex.charAt((n & 0xF) >> 4)).append(hex.charAt(n & 0xF))
})
sb.toString
}
// ================================================
@serializable
class ReadWriteLock {