Refactored code into ActorRef, LocalActorRef and RemoteActorRef
This commit is contained in:
parent
48c6dbc1af
commit
dfc45e0a71
33 changed files with 806 additions and 443 deletions
|
|
@ -5,7 +5,6 @@
|
|||
package se.scalablesolutions.akka.util
|
||||
|
||||
import java.security.MessageDigest
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock
|
||||
|
||||
class SystemFailure(cause: Throwable) extends RuntimeException(cause)
|
||||
|
||||
|
|
@ -38,30 +37,5 @@ object Helpers extends Logging {
|
|||
})
|
||||
sb.toString
|
||||
}
|
||||
|
||||
// ================================================
|
||||
class ReadWriteLock {
|
||||
private val rwl = new ReentrantReadWriteLock
|
||||
private val readLock = rwl.readLock
|
||||
private val writeLock = rwl.writeLock
|
||||
|
||||
def withWriteLock[T](body: => T): T = {
|
||||
writeLock.lock
|
||||
try {
|
||||
body
|
||||
} finally {
|
||||
writeLock.unlock
|
||||
}
|
||||
}
|
||||
|
||||
def withReadLock[T](body: => T): T = {
|
||||
readLock.lock
|
||||
try {
|
||||
body
|
||||
} finally {
|
||||
readLock.unlock
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue