Changed all 'def foo(): Unit = { .. }' to 'def foo() { .. }'
This commit is contained in:
parent
07b29c0627
commit
db8a20ea37
49 changed files with 153 additions and 152 deletions
|
|
@ -181,7 +181,7 @@ public class JavaFutureTests {
|
|||
}));
|
||||
}
|
||||
|
||||
Future<String> result = fold("", 15000,listFutures, new Function2<String,String,String>(){
|
||||
Future<String> result = fold("", 15000,listFutures, new Function2<String,String,String>() {
|
||||
public String apply(String r, String t) {
|
||||
return r + t;
|
||||
}
|
||||
|
|
@ -203,7 +203,7 @@ public class JavaFutureTests {
|
|||
}));
|
||||
}
|
||||
|
||||
Future<String> result = reduce(listFutures, 15000, new Function2<String,String,String>(){
|
||||
Future<String> result = reduce(listFutures, 15000, new Function2<String,String,String>() {
|
||||
public String apply(String r, String t) {
|
||||
return r + t;
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ public class JavaFutureTests {
|
|||
listStrings.add("test");
|
||||
}
|
||||
|
||||
Future<Iterable<String>> result = traverse(listStrings, new Function<String,Future<String>>(){
|
||||
Future<Iterable<String>> result = traverse(listStrings, new Function<String,Future<String>>() {
|
||||
public Future<String> apply(final String r) {
|
||||
return future(new Callable<String>() {
|
||||
public String call() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class AkkaExceptionSpec extends WordSpec with MustMatchers {
|
|||
}
|
||||
}
|
||||
|
||||
def verify(clazz: java.lang.Class[_]): Unit = {
|
||||
def verify(clazz: java.lang.Class[_]) {
|
||||
clazz.getConstructor(Array(classOf[String]): _*)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ object IOActorSpec {
|
|||
|
||||
var socket: SocketHandle = _
|
||||
|
||||
override def preStart: Unit = {
|
||||
override def preStart {
|
||||
socket = connect(ioManager, host, port)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ abstract class ActorModelSpec extends JUnitSuite {
|
|||
}
|
||||
|
||||
@Test
|
||||
def dispatcherShouldProcessMessagesInParallel: Unit = {
|
||||
def dispatcherShouldProcessMessagesInParallel {
|
||||
implicit val dispatcher = newInterceptedDispatcher
|
||||
val aStart, aStop, bParallel = new CountDownLatch(1)
|
||||
val a, b = newTestActor
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Report(
|
|||
val legendTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm")
|
||||
val fileTimestampFormat = new SimpleDateFormat("yyyyMMddHHmmss")
|
||||
|
||||
def html(statistics: Seq[Stats]): Unit = {
|
||||
def html(statistics: Seq[Stats]) {
|
||||
|
||||
val current = statistics.last
|
||||
val sb = new StringBuilder
|
||||
|
|
|
|||
|
|
@ -12,23 +12,23 @@ import akka.actor.ActorRef;
|
|||
public class JavaEventHandler {
|
||||
|
||||
|
||||
public static void notify(Object message){
|
||||
public static void notify(Object message) {
|
||||
EventHandler$.MODULE$.notify(message);
|
||||
}
|
||||
|
||||
public static void debug(ActorRef instance, Object message){
|
||||
public static void debug(ActorRef instance, Object message) {
|
||||
EventHandler$.MODULE$.debug(instance, message);
|
||||
}
|
||||
|
||||
public static void info(ActorRef instance, Object message){
|
||||
public static void info(ActorRef instance, Object message) {
|
||||
EventHandler$.MODULE$.info(instance,message);
|
||||
}
|
||||
|
||||
public static void warning(ActorRef instance, Object message){
|
||||
public static void warning(ActorRef instance, Object message) {
|
||||
EventHandler$.MODULE$.warning(instance,message);
|
||||
}
|
||||
|
||||
public static void error(ActorRef instance, Object message){
|
||||
public static void error(ActorRef instance, Object message) {
|
||||
EventHandler$.MODULE$.debug(instance,message);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ object Actor {
|
|||
* }
|
||||
* </pre>
|
||||
*/
|
||||
def spawn(body: ⇒ Unit)(implicit dispatcher: MessageDispatcher = Dispatchers.defaultGlobalDispatcher): Unit = {
|
||||
def spawn(body: ⇒ Unit)(implicit dispatcher: MessageDispatcher = Dispatchers.defaultGlobalDispatcher) {
|
||||
actorOf(Props(self ⇒ { case "go" ⇒ try { body } finally { self.stop() } }).withDispatcher(dispatcher)) ! "go"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ private[akka] class ActorCell(
|
|||
@volatile
|
||||
var mailbox: Mailbox = _
|
||||
|
||||
def start(): Unit = {
|
||||
def start() {
|
||||
if (props.supervisor.isDefined) props.supervisor.get.link(self)
|
||||
mailbox = dispatcher.createMailbox(this)
|
||||
Actor.registry.register(self)
|
||||
|
|
@ -200,7 +200,7 @@ private[akka] class ActorCell(
|
|||
case msg ⇒ msg.channel
|
||||
}
|
||||
|
||||
def systemInvoke(envelope: SystemEnvelope): Unit = {
|
||||
def systemInvoke(envelope: SystemEnvelope) {
|
||||
def create(recreation: Boolean): Unit = try {
|
||||
actor.get() match {
|
||||
case null ⇒
|
||||
|
|
@ -226,7 +226,7 @@ private[akka] class ActorCell(
|
|||
|
||||
def resume(): Unit = dispatcher resume this
|
||||
|
||||
def terminate(): Unit = {
|
||||
def terminate() {
|
||||
receiveTimeout = None
|
||||
cancelReceiveTimeout
|
||||
Actor.provider.evict(self.address)
|
||||
|
|
@ -279,7 +279,7 @@ private[akka] class ActorCell(
|
|||
}
|
||||
}
|
||||
|
||||
def invoke(messageHandle: Envelope): Unit = {
|
||||
def invoke(messageHandle: Envelope) {
|
||||
guard.lock.lock()
|
||||
try {
|
||||
if (!mailbox.isClosed) {
|
||||
|
|
@ -320,7 +320,7 @@ private[akka] class ActorCell(
|
|||
}
|
||||
}
|
||||
|
||||
def handleFailure(fail: Failed): Unit = {
|
||||
def handleFailure(fail: Failed) {
|
||||
props.faultHandler match {
|
||||
case AllForOnePermanentStrategy(trapExit, maxRetries, within) if trapExit.exists(_.isAssignableFrom(fail.cause.getClass)) ⇒
|
||||
restartLinkedActors(fail.cause, maxRetries, within)
|
||||
|
|
@ -426,7 +426,7 @@ private[akka] class ActorCell(
|
|||
denied == false // if we weren't denied, we have a go
|
||||
}
|
||||
|
||||
protected[akka] def restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = {
|
||||
protected[akka] def restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]) {
|
||||
props.faultHandler.lifeCycle match {
|
||||
case Temporary ⇒
|
||||
val i = _linkedActors.values.iterator
|
||||
|
|
@ -466,7 +466,7 @@ private[akka] class ActorCell(
|
|||
|
||||
def clearActorContext(): Unit = setActorContext(null)
|
||||
|
||||
def setActorContext(newContext: ActorContext): Unit = {
|
||||
def setActorContext(newContext: ActorContext) {
|
||||
@tailrec
|
||||
def lookupAndSetSelfFields(clazz: Class[_], actor: Actor, newContext: ActorContext): Boolean = {
|
||||
val success = try {
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ private[akka] case class RemoteActorRef private[akka] (
|
|||
|
||||
protected[akka] override def timeout: Long = _timeout
|
||||
|
||||
def postMessageToMailbox(message: Any, channel: UntypedChannel): Unit = {
|
||||
def postMessageToMailbox(message: Any, channel: UntypedChannel) {
|
||||
val chSender = if (channel.isInstanceOf[ActorRef]) Some(channel.asInstanceOf[ActorRef]) else None
|
||||
Actor.remote.send[Any](message, chSender, None, remoteAddress, timeout, true, this, loader)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ private[actor] final class ActorRegistry private[actor] () extends ListenerManag
|
|||
notifyListeners(ActorRegistered(address, actor))
|
||||
}
|
||||
|
||||
private[akka] def registerTypedActor(actorRef: ActorRef, proxy: AnyRef): Unit = {
|
||||
private[akka] def registerTypedActor(actorRef: ActorRef, proxy: AnyRef) {
|
||||
if (typedActorsByUuid.putIfAbsent(actorRef.uuid, proxy) eq null)
|
||||
notifyListeners(TypedActorRegistered(actorRef.address, actorRef, proxy))
|
||||
}
|
||||
|
||||
private[akka] def unregisterTypedActor(actorRef: ActorRef, proxy: AnyRef): Unit = {
|
||||
private[akka] def unregisterTypedActor(actorRef: ActorRef, proxy: AnyRef) {
|
||||
if (typedActorsByUuid.remove(actorRef.uuid, proxy))
|
||||
notifyListeners(TypedActorUnregistered(actorRef.address, actorRef, proxy))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,12 +487,12 @@ trait FSM[S, D] extends ListenerManagement {
|
|||
}
|
||||
}
|
||||
|
||||
private def processMsg(value: Any, source: AnyRef): Unit = {
|
||||
private def processMsg(value: Any, source: AnyRef) {
|
||||
val event = Event(value, currentState.stateData)
|
||||
processEvent(event, source)
|
||||
}
|
||||
|
||||
private[akka] def processEvent(event: Event, source: AnyRef): Unit = {
|
||||
private[akka] def processEvent(event: Event, source: AnyRef) {
|
||||
val stateFunc = stateFunctions(currentState.stateName)
|
||||
val nextState = if (stateFunc isDefinedAt event) {
|
||||
stateFunc(event)
|
||||
|
|
@ -503,7 +503,7 @@ trait FSM[S, D] extends ListenerManagement {
|
|||
applyState(nextState)
|
||||
}
|
||||
|
||||
private[akka] def applyState(nextState: State): Unit = {
|
||||
private[akka] def applyState(nextState: State) {
|
||||
nextState.stopReason match {
|
||||
case None ⇒ makeTransition(nextState)
|
||||
case _ ⇒
|
||||
|
|
@ -513,7 +513,7 @@ trait FSM[S, D] extends ListenerManagement {
|
|||
}
|
||||
}
|
||||
|
||||
private[akka] def makeTransition(nextState: State): Unit = {
|
||||
private[akka] def makeTransition(nextState: State) {
|
||||
if (!stateFunctions.contains(nextState.stateName)) {
|
||||
terminate(stay withStopReason Failure("Next state %s does not exist".format(nextState.stateName)))
|
||||
} else {
|
||||
|
|
@ -535,7 +535,7 @@ trait FSM[S, D] extends ListenerManagement {
|
|||
|
||||
override def postStop() { terminate(stay withStopReason Shutdown) }
|
||||
|
||||
private def terminate(nextState: State): Unit = {
|
||||
private def terminate(nextState: State) {
|
||||
if (!currentState.stopReason.isDefined) {
|
||||
val reason = nextState.stopReason.get
|
||||
reason match {
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ trait IO {
|
|||
|
||||
// only reinvoke messages from the original message to avoid stack overflow
|
||||
private var reinvoked = false
|
||||
private def reinvoke(): Unit = {
|
||||
private def reinvoke() {
|
||||
if (!reinvoked && (_next eq Idle) && _messages.nonEmpty) {
|
||||
try {
|
||||
reinvoked = true
|
||||
|
|
@ -208,7 +208,7 @@ trait IO {
|
|||
}
|
||||
|
||||
@tailrec
|
||||
private def run(): Unit = {
|
||||
private def run() {
|
||||
_next match {
|
||||
case ByteStringLength(continuation, handle, message, waitingFor) ⇒
|
||||
context.currentMessage = message
|
||||
|
|
@ -256,7 +256,7 @@ class IOManager(bufferSize: Int = 8192) extends Actor {
|
|||
|
||||
var worker: IOWorker = _
|
||||
|
||||
override def preStart: Unit = {
|
||||
override def preStart {
|
||||
worker = new IOWorker(self, bufferSize)
|
||||
worker.start()
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ class IOManager(bufferSize: Int = 8192) extends Actor {
|
|||
case IO.Close(handle) ⇒ worker(Close(handle))
|
||||
}
|
||||
|
||||
override def postStop: Unit = {
|
||||
override def postStop {
|
||||
worker(Shutdown)
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ private[akka] class IOWorker(ioManager: ActorRef, val bufferSize: Int) {
|
|||
private val buffer = ByteBuffer.allocate(bufferSize)
|
||||
|
||||
private val thread = new Thread("io-worker") {
|
||||
override def run(): Unit = {
|
||||
override def run() {
|
||||
while (selector.isOpen) {
|
||||
selector select ()
|
||||
val keys = selector.selectedKeys.iterator
|
||||
|
|
@ -359,7 +359,7 @@ private[akka] class IOWorker(ioManager: ActorRef, val bufferSize: Int) {
|
|||
}
|
||||
}
|
||||
|
||||
private def process(key: SelectionKey): Unit = {
|
||||
private def process(key: SelectionKey) {
|
||||
val handle = key.attachment.asInstanceOf[IO.Handle]
|
||||
try {
|
||||
if (key.isConnectable) key.channel match {
|
||||
|
|
@ -387,7 +387,7 @@ private[akka] class IOWorker(ioManager: ActorRef, val bufferSize: Int) {
|
|||
}
|
||||
}
|
||||
|
||||
private def cleanup(handle: IO.Handle, cause: Option[Exception]): Unit = {
|
||||
private def cleanup(handle: IO.Handle, cause: Option[Exception]) {
|
||||
handle match {
|
||||
case server: IO.ServerHandle ⇒ accepted -= server
|
||||
case writable: IO.WriteHandle ⇒ writes -= writable
|
||||
|
|
@ -409,19 +409,19 @@ private[akka] class IOWorker(ioManager: ActorRef, val bufferSize: Int) {
|
|||
private def setOps(handle: IO.Handle, ops: Int): Unit =
|
||||
channels(handle) keyFor selector interestOps ops
|
||||
|
||||
private def addOps(handle: IO.Handle, ops: Int): Unit = {
|
||||
private def addOps(handle: IO.Handle, ops: Int) {
|
||||
val key = channels(handle) keyFor selector
|
||||
val cur = key.interestOps
|
||||
key interestOps (cur | ops)
|
||||
}
|
||||
|
||||
private def removeOps(handle: IO.Handle, ops: Int): Unit = {
|
||||
private def removeOps(handle: IO.Handle, ops: Int) {
|
||||
val key = channels(handle) keyFor selector
|
||||
val cur = key.interestOps
|
||||
key interestOps (cur - (cur & ops))
|
||||
}
|
||||
|
||||
private def connect(socket: IO.SocketHandle, channel: SocketChannel): Unit = {
|
||||
private def connect(socket: IO.SocketHandle, channel: SocketChannel) {
|
||||
if (channel.finishConnect) {
|
||||
removeOps(socket, OP_CONNECT)
|
||||
socket.owner ! IO.Connected(socket)
|
||||
|
|
@ -431,7 +431,7 @@ private[akka] class IOWorker(ioManager: ActorRef, val bufferSize: Int) {
|
|||
}
|
||||
|
||||
@tailrec
|
||||
private def accept(server: IO.ServerHandle, channel: ServerSocketChannel): Unit = {
|
||||
private def accept(server: IO.ServerHandle, channel: ServerSocketChannel) {
|
||||
val socket = channel.accept
|
||||
if (socket ne null) {
|
||||
socket configureBlocking false
|
||||
|
|
@ -442,7 +442,7 @@ private[akka] class IOWorker(ioManager: ActorRef, val bufferSize: Int) {
|
|||
}
|
||||
|
||||
@tailrec
|
||||
private def read(handle: IO.ReadHandle, channel: ReadChannel): Unit = {
|
||||
private def read(handle: IO.ReadHandle, channel: ReadChannel) {
|
||||
buffer.clear
|
||||
val readLen = channel read buffer
|
||||
if (readLen == -1) {
|
||||
|
|
@ -455,7 +455,7 @@ private[akka] class IOWorker(ioManager: ActorRef, val bufferSize: Int) {
|
|||
}
|
||||
|
||||
@tailrec
|
||||
private def write(handle: IO.WriteHandle, channel: WriteChannel): Unit = {
|
||||
private def write(handle: IO.WriteHandle, channel: WriteChannel) {
|
||||
val queue = writes(handle)
|
||||
if (queue.nonEmpty) {
|
||||
val (buf, bufs) = queue.dequeue
|
||||
|
|
@ -473,7 +473,7 @@ private[akka] class IOWorker(ioManager: ActorRef, val bufferSize: Int) {
|
|||
}
|
||||
|
||||
@tailrec
|
||||
private def addRequest(req: Request): Unit = {
|
||||
private def addRequest(req: Request) {
|
||||
val requests = _requests.get
|
||||
if (_requests compareAndSet (requests, req :: requests))
|
||||
selector wakeup ()
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ sealed class Supervisor(handler: FaultHandlingStrategy, maxRestartsHandler: (Act
|
|||
*/
|
||||
final class SupervisorActor private[akka] (maxRestartsHandler: (ActorRef, MaximumNumberOfRestartsWithinTimeRangeReached) ⇒ Unit) extends Actor {
|
||||
|
||||
override def postStop(): Unit = {
|
||||
override def postStop() {
|
||||
val i = linkedActors.iterator
|
||||
while (i.hasNext) {
|
||||
val ref = i.next
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class BalancingDispatcher(
|
|||
registerForExecution(buddy.mailbox, false, false)
|
||||
}
|
||||
|
||||
protected[akka] override def shutdown(): Unit = {
|
||||
protected[akka] override def shutdown() {
|
||||
super.shutdown()
|
||||
buddies.clear()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class Dispatcher(
|
|||
registerForExecution(mbox, false, true)
|
||||
}
|
||||
|
||||
protected[akka] def executeTask(invocation: TaskInvocation): Unit = {
|
||||
protected[akka] def executeTask(invocation: TaskInvocation) {
|
||||
try {
|
||||
executorService.get() execute invocation
|
||||
} catch {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ abstract class Mailbox extends MessageQueue with SystemMessageQueue with Runnabl
|
|||
* Internal method to enforce a volatile write of the status
|
||||
*/
|
||||
@tailrec
|
||||
final def acknowledgeStatus(): Unit = {
|
||||
final def acknowledgeStatus() {
|
||||
val s = _status.get()
|
||||
if (_status.compareAndSet(s, s)) ()
|
||||
else acknowledgeStatus()
|
||||
|
|
@ -112,7 +112,7 @@ abstract class Mailbox extends MessageQueue with SystemMessageQueue with Runnabl
|
|||
}
|
||||
}
|
||||
|
||||
def processAllSystemMessages(): Unit = {
|
||||
def processAllSystemMessages() {
|
||||
var nextMessage = systemDequeue()
|
||||
while (nextMessage ne null) {
|
||||
nextMessage.invoke()
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ final case class SystemEnvelope(val receiver: ActorCell, val message: SystemMess
|
|||
/**
|
||||
* @return whether to proceed with processing other messages
|
||||
*/
|
||||
final def invoke(): Unit = {
|
||||
final def invoke() {
|
||||
receiver systemInvoke this
|
||||
}
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ abstract class MessageDispatcher extends Serializable {
|
|||
/**
|
||||
* Attaches the specified actor instance to this dispatcher
|
||||
*/
|
||||
final def attach(actor: ActorCell): Unit = {
|
||||
final def attach(actor: ActorCell) {
|
||||
guard.lock.lock()
|
||||
try {
|
||||
startIfUnstarted()
|
||||
|
|
@ -118,7 +118,7 @@ abstract class MessageDispatcher extends Serializable {
|
|||
/**
|
||||
* Detaches the specified actor instance from this dispatcher
|
||||
*/
|
||||
final def detach(actor: ActorCell): Unit = {
|
||||
final def detach(actor: ActorCell) {
|
||||
guard withGuard {
|
||||
unregister(actor)
|
||||
if (uuids.isEmpty && _tasks.get == 0) {
|
||||
|
|
@ -134,11 +134,11 @@ abstract class MessageDispatcher extends Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
protected final def startIfUnstarted(): Unit = {
|
||||
protected final def startIfUnstarted() {
|
||||
if (active.isOff) guard withGuard { active.switchOn { start() } }
|
||||
}
|
||||
|
||||
protected[akka] final def dispatchTask(block: () ⇒ Unit): Unit = {
|
||||
protected[akka] final def dispatchTask(block: () ⇒ Unit) {
|
||||
_tasks.getAndIncrement()
|
||||
try {
|
||||
startIfUnstarted()
|
||||
|
|
@ -170,7 +170,7 @@ abstract class MessageDispatcher extends Serializable {
|
|||
* Only "private[akka] for the sake of intercepting calls, DO NOT CALL THIS OUTSIDE OF THE DISPATCHER,
|
||||
* and only call it under the dispatcher-guard, see "attach" for the only invocation
|
||||
*/
|
||||
protected[akka] def register(actor: ActorCell): Unit = {
|
||||
protected[akka] def register(actor: ActorCell) {
|
||||
if (uuids add actor.uuid) {
|
||||
systemDispatch(SystemEnvelope(actor, Create, NullChannel)) //FIXME should this be here or moved into ActorCell.start perhaps?
|
||||
} else System.err.println("Couldn't register: " + actor)
|
||||
|
|
@ -180,7 +180,7 @@ abstract class MessageDispatcher extends Serializable {
|
|||
* Only "private[akka] for the sake of intercepting calls, DO NOT CALL THIS OUTSIDE OF THE DISPATCHER,
|
||||
* and only call it under the dispatcher-guard, see "detach" for the only invocation
|
||||
*/
|
||||
protected[akka] def unregister(actor: ActorCell): Unit = {
|
||||
protected[akka] def unregister(actor: ActorCell) {
|
||||
if (uuids remove actor.uuid) {
|
||||
val mailBox = actor.mailbox
|
||||
mailBox.become(Mailbox.Closed)
|
||||
|
|
@ -193,7 +193,7 @@ abstract class MessageDispatcher extends Serializable {
|
|||
* Overridable callback to clean up the mailbox for a given actor,
|
||||
* called when an actor is unregistered.
|
||||
*/
|
||||
protected def cleanUpMailboxFor(actor: ActorCell, mailBox: Mailbox): Unit = {
|
||||
protected def cleanUpMailboxFor(actor: ActorCell, mailBox: Mailbox) {
|
||||
|
||||
if (mailBox.hasSystemMessages) {
|
||||
var envelope = mailBox.systemDequeue()
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ trait PromiseStreamIn[A] {
|
|||
final def enqueue(elem: Future[A]): Unit =
|
||||
elem foreach (enqueue(_))
|
||||
|
||||
final def enqueue(elem1: Future[A], elem2: Future[A], elems: Future[A]*): Unit = {
|
||||
final def enqueue(elem1: Future[A], elem2: Future[A], elems: Future[A]*) {
|
||||
this += elem1 += elem2
|
||||
elems foreach (enqueue(_))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ trait Supervision { self: DeathWatch =>
|
|||
val activeEntries = new ConcurrentHashMap[ActorRef, ActiveEntry](1024)
|
||||
val passiveEntries = new ConcurrentHashMap[ActorRef, PassiveEntry](1024)
|
||||
|
||||
def registerMonitorable(monitor: ActorRef, monitorsSupervisor: Option[ActorRef], faultHandlingStrategy: FaultHandlingStrategy): Unit = {
|
||||
def registerMonitorable(monitor: ActorRef, monitorsSupervisor: Option[ActorRef], faultHandlingStrategy: FaultHandlingStrategy) {
|
||||
read.lock()
|
||||
try {
|
||||
activeEntries.putIfAbsent(monitor, ActiveEntry(strategy = faultHandlingStrategy))
|
||||
|
|
@ -39,7 +39,7 @@ trait Supervision { self: DeathWatch =>
|
|||
}
|
||||
}
|
||||
|
||||
def deregisterMonitorable(monitor: ActorRef): Unit = {
|
||||
def deregisterMonitorable(monitor: ActorRef) {
|
||||
read.lock()
|
||||
try {
|
||||
activeEntries.remove(monitor)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class BoundedBlockingQueue[E <: AnyRef](
|
|||
private val notEmpty = lock.newCondition()
|
||||
private val notFull = lock.newCondition()
|
||||
|
||||
def put(e: E): Unit = { //Blocks until not full
|
||||
def put(e: E) { //Blocks until not full
|
||||
if (e eq null) throw new NullPointerException
|
||||
lock.lock()
|
||||
try {
|
||||
|
|
@ -157,7 +157,7 @@ class BoundedBlockingQueue[E <: AnyRef](
|
|||
}
|
||||
}
|
||||
|
||||
override def clear(): Unit = {
|
||||
override def clear() {
|
||||
lock.lock()
|
||||
try {
|
||||
backing.clear
|
||||
|
|
@ -273,7 +273,7 @@ class BoundedBlockingQueue[E <: AnyRef](
|
|||
elements(last).asInstanceOf[E]
|
||||
}
|
||||
|
||||
def remove(): Unit = {
|
||||
def remove() {
|
||||
if (last < 0) throw new IllegalStateException
|
||||
val target = elements(last)
|
||||
last = -1 //To avoid 2 subsequent removes without a next in between
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class TypedConsumerPublishRequestorTest extends JUnitSuite {
|
|||
r1.method.getName < r2.method.getName
|
||||
|
||||
@Before
|
||||
def setUp: Unit = {
|
||||
def setUp{
|
||||
publisher = actorOf(new TypedConsumerPublisherMock)
|
||||
requestor = actorOf(new TypedConsumerPublishRequestor)
|
||||
requestor ! InitPublishRequestor(publisher)
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ trait ProducerSupport { this: Actor ⇒
|
|||
* @param msg message to produce
|
||||
* @param pattern exchange pattern
|
||||
*/
|
||||
protected def produce(msg: Any, pattern: ExchangePattern): Unit = {
|
||||
protected def produce(msg: Any, pattern: ExchangePattern) {
|
||||
val cmsg = Message.canonicalize(msg)
|
||||
val exchange = createExchange(pattern).fromRequestMessage(cmsg)
|
||||
processor.process(exchange, new AsyncCallback {
|
||||
|
|
@ -101,7 +101,7 @@ trait ProducerSupport { this: Actor ⇒
|
|||
// later by another thread.
|
||||
val replyChannel = channel
|
||||
|
||||
def done(doneSync: Boolean): Unit = {
|
||||
def done(doneSync: Boolean) {
|
||||
(doneSync, exchange.isFailed) match {
|
||||
case (true, true) ⇒ dispatchSync(exchange.toFailureMessage(cmsg.headers(headersToCopy)))
|
||||
case (true, false) ⇒ dispatchSync(exchange.toResponseMessage(cmsg.headers(headersToCopy)))
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ private[akka] class AsyncCallbackAdapter(exchange: Exchange, callback: AsyncCall
|
|||
|
||||
def resume(): Unit = ()
|
||||
|
||||
def stop(): Unit = {
|
||||
def stop() {
|
||||
running = false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class ConsumerPublishRequestorTest extends JUnitSuite {
|
|||
var consumer: LocalActorRef = _
|
||||
|
||||
@Before
|
||||
def setUp: Unit = {
|
||||
def setUp{
|
||||
publisher = actorOf(new ConsumerPublisherMock)
|
||||
requestor = actorOf(new ConsumerPublishRequestor)
|
||||
requestor ! InitPublishRequestor(publisher)
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ class ActorProducerTest extends JUnitSuite with BeforeAndAfterAll {
|
|||
}
|
||||
|
||||
@Test
|
||||
def shouldThrowExceptionWhenIdNotSet: Unit = {
|
||||
def shouldThrowExceptionWhenIdNotSet{
|
||||
val actor = actorOf[Tester1]
|
||||
val latch = (actor ? SetExpectedMessageCount(1)).as[CountDownLatch].get
|
||||
val endpoint = actorEndpoint("actor:id:")
|
||||
|
|
@ -218,7 +218,7 @@ class ActorProducerTest extends JUnitSuite with BeforeAndAfterAll {
|
|||
}
|
||||
|
||||
@Test
|
||||
def shouldThrowExceptionWhenUuidNotSet: Unit = {
|
||||
def shouldThrowExceptionWhenUuidNotSet{
|
||||
val actor = actorOf[Tester1]
|
||||
val latch = (actor ? SetExpectedMessageCount(1)).as[CountDownLatch].get
|
||||
val endpoint = actorEndpoint("actor:uuid:")
|
||||
|
|
@ -228,7 +228,7 @@ class ActorProducerTest extends JUnitSuite with BeforeAndAfterAll {
|
|||
}
|
||||
|
||||
@Test
|
||||
def shouldSendMessageToActorAndTimeout(): Unit = {
|
||||
def shouldSendMessageToActorAndTimeout() {
|
||||
val actor = actorOf(Props[Tester3].withTimeout(Timeout(1)))
|
||||
val endpoint = actorEndpoint("actor:uuid:%s" format actor.uuid)
|
||||
val exchange = endpoint.createExchange(ExchangePattern.InOut)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class LocalBookKeeper {
|
|||
numberOfBookies = 3;
|
||||
}
|
||||
|
||||
public LocalBookKeeper(int numberOfBookies){
|
||||
public LocalBookKeeper(int numberOfBookies) {
|
||||
this();
|
||||
this.numberOfBookies = numberOfBookies;
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ public class LocalBookKeeper {
|
|||
boolean b = waitForServerUp(HOSTPORT, CONNECTION_TIMEOUT);
|
||||
}
|
||||
|
||||
public void initializeZookeper(){
|
||||
public void initializeZookeper() {
|
||||
//initialize the zk client with values
|
||||
try {
|
||||
zkc = new ZooKeeper("127.0.0.1", ZooKeeperDefaultPort, new emptyWatcher());
|
||||
|
|
@ -107,7 +107,7 @@ public class LocalBookKeeper {
|
|||
tmpDirs = new File[numberOfBookies];
|
||||
bs = new BookieServer[numberOfBookies];
|
||||
|
||||
for(int i = 0; i < numberOfBookies; i++){
|
||||
for(int i = 0; i < numberOfBookies; i++) {
|
||||
tmpDirs[i] = File.createTempFile("bookie" + Integer.toString(i), "test");
|
||||
tmpDirs[i].delete();
|
||||
tmpDirs[i].mkdir();
|
||||
|
|
@ -119,7 +119,7 @@ public class LocalBookKeeper {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws IOException, InterruptedException {
|
||||
if(args.length < 1){
|
||||
if(args.length < 1) {
|
||||
usage();
|
||||
System.exit(-1);
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ public class LocalBookKeeper {
|
|||
lb.runZookeeper(1000);
|
||||
lb.initializeZookeper();
|
||||
lb.runBookies();
|
||||
while (true){
|
||||
while (true) {
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ public class DistributedQueue {
|
|||
private final String prefix = "qn-";
|
||||
|
||||
|
||||
public DistributedQueue(ZooKeeper zookeeper, String dir, List<ACL> acl){
|
||||
public DistributedQueue(ZooKeeper zookeeper, String dir, List<ACL> acl) {
|
||||
this.dir = dir;
|
||||
|
||||
if(acl != null){
|
||||
if(acl != null) {
|
||||
this.acl = acl;
|
||||
}
|
||||
this.zookeeper = zookeeper;
|
||||
|
|
@ -73,21 +73,21 @@ public class DistributedQueue {
|
|||
List<String> childNames = null;
|
||||
try{
|
||||
childNames = zookeeper.getChildren(dir, watcher);
|
||||
}catch (KeeperException.NoNodeException e){
|
||||
}catch (KeeperException.NoNodeException e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
for(String childName : childNames){
|
||||
for(String childName : childNames) {
|
||||
try{
|
||||
//Check format
|
||||
if(!childName.regionMatches(0, prefix, 0, prefix.length())){
|
||||
if(!childName.regionMatches(0, prefix, 0, prefix.length())) {
|
||||
LOG.warn("Found child node with improper name: " + childName);
|
||||
continue;
|
||||
}
|
||||
String suffix = childName.substring(prefix.length());
|
||||
Long childId = new Long(suffix);
|
||||
orderedChildren.put(childId,childName);
|
||||
}catch(NumberFormatException e){
|
||||
}catch(NumberFormatException e) {
|
||||
LOG.warn("Found child node with improper format : " + childName + " " + e,e);
|
||||
}
|
||||
}
|
||||
|
|
@ -107,31 +107,31 @@ public class DistributedQueue {
|
|||
|
||||
try{
|
||||
childNames = zookeeper.getChildren(dir, false);
|
||||
}catch(KeeperException.NoNodeException e){
|
||||
}catch(KeeperException.NoNodeException e) {
|
||||
LOG.warn("Caught: " +e,e);
|
||||
return null;
|
||||
}
|
||||
|
||||
for(String childName : childNames){
|
||||
for(String childName : childNames) {
|
||||
try{
|
||||
//Check format
|
||||
if(!childName.regionMatches(0, prefix, 0, prefix.length())){
|
||||
if(!childName.regionMatches(0, prefix, 0, prefix.length())) {
|
||||
LOG.warn("Found child node with improper name: " + childName);
|
||||
continue;
|
||||
}
|
||||
String suffix = childName.substring(prefix.length());
|
||||
long childId = Long.parseLong(suffix);
|
||||
if(childId < minId){
|
||||
if(childId < minId) {
|
||||
minId = childId;
|
||||
minName = childName;
|
||||
}
|
||||
}catch(NumberFormatException e){
|
||||
}catch(NumberFormatException e) {
|
||||
LOG.warn("Found child node with improper format : " + childName + " " + e,e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(minId < Long.MAX_VALUE){
|
||||
if(minId < Long.MAX_VALUE) {
|
||||
return minName;
|
||||
}else{
|
||||
return null;
|
||||
|
|
@ -153,19 +153,19 @@ public class DistributedQueue {
|
|||
// Since other clients are remove()ing and take()ing nodes concurrently,
|
||||
// the child with the smallest sequence number in orderedChildren might be gone by the time we check.
|
||||
// We don't call getChildren again until we have tried the rest of the nodes in sequence order.
|
||||
while(true){
|
||||
while(true) {
|
||||
try{
|
||||
orderedChildren = orderedChildren(null);
|
||||
}catch(KeeperException.NoNodeException e){
|
||||
}catch(KeeperException.NoNodeException e) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
if(orderedChildren.size() == 0 ) throw new NoSuchElementException();
|
||||
|
||||
for(String headNode : orderedChildren.values()){
|
||||
if(headNode != null){
|
||||
for(String headNode : orderedChildren.values()) {
|
||||
if(headNode != null) {
|
||||
try{
|
||||
return zookeeper.getData(dir+"/"+headNode, false, null);
|
||||
}catch(KeeperException.NoNodeException e){
|
||||
}catch(KeeperException.NoNodeException e) {
|
||||
//Another client removed the node first, try next
|
||||
}
|
||||
}
|
||||
|
|
@ -185,21 +185,21 @@ public class DistributedQueue {
|
|||
public byte[] remove() throws NoSuchElementException, KeeperException, InterruptedException {
|
||||
TreeMap<Long,String> orderedChildren;
|
||||
// Same as for element. Should refactor this.
|
||||
while(true){
|
||||
while(true) {
|
||||
try{
|
||||
orderedChildren = orderedChildren(null);
|
||||
}catch(KeeperException.NoNodeException e){
|
||||
}catch(KeeperException.NoNodeException e) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
if(orderedChildren.size() == 0) throw new NoSuchElementException();
|
||||
|
||||
for(String headNode : orderedChildren.values()){
|
||||
for(String headNode : orderedChildren.values()) {
|
||||
String path = dir +"/"+headNode;
|
||||
try{
|
||||
byte[] data = zookeeper.getData(path, false, null);
|
||||
zookeeper.delete(path, -1);
|
||||
return data;
|
||||
}catch(KeeperException.NoNodeException e){
|
||||
}catch(KeeperException.NoNodeException e) {
|
||||
// Another client deleted the node first.
|
||||
}
|
||||
}
|
||||
|
|
@ -211,11 +211,11 @@ public class DistributedQueue {
|
|||
|
||||
CountDownLatch latch;
|
||||
|
||||
public LatchChildWatcher(){
|
||||
public LatchChildWatcher() {
|
||||
latch = new CountDownLatch(1);
|
||||
}
|
||||
|
||||
public void process(WatchedEvent event){
|
||||
public void process(WatchedEvent event) {
|
||||
LOG.debug("Watcher fired on path: " + event.getPath() + " state: " +
|
||||
event.getState() + " type " + event.getType());
|
||||
latch.countDown();
|
||||
|
|
@ -235,26 +235,26 @@ public class DistributedQueue {
|
|||
public byte[] take() throws KeeperException, InterruptedException {
|
||||
TreeMap<Long,String> orderedChildren;
|
||||
// Same as for element. Should refactor this.
|
||||
while(true){
|
||||
while(true) {
|
||||
LatchChildWatcher childWatcher = new LatchChildWatcher();
|
||||
try{
|
||||
orderedChildren = orderedChildren(childWatcher);
|
||||
}catch(KeeperException.NoNodeException e){
|
||||
}catch(KeeperException.NoNodeException e) {
|
||||
zookeeper.create(dir, new byte[0], acl, CreateMode.PERSISTENT);
|
||||
continue;
|
||||
}
|
||||
if(orderedChildren.size() == 0){
|
||||
if(orderedChildren.size() == 0) {
|
||||
childWatcher.await();
|
||||
continue;
|
||||
}
|
||||
|
||||
for(String headNode : orderedChildren.values()){
|
||||
for(String headNode : orderedChildren.values()) {
|
||||
String path = dir +"/"+headNode;
|
||||
try{
|
||||
byte[] data = zookeeper.getData(path, false, null);
|
||||
zookeeper.delete(path, -1);
|
||||
return data;
|
||||
}catch(KeeperException.NoNodeException e){
|
||||
}catch(KeeperException.NoNodeException e) {
|
||||
// Another client deleted the node first.
|
||||
}
|
||||
}
|
||||
|
|
@ -267,11 +267,11 @@ public class DistributedQueue {
|
|||
* @return true if data was successfully added
|
||||
*/
|
||||
public boolean offer(byte[] data) throws KeeperException, InterruptedException{
|
||||
for(;;){
|
||||
for(;;) {
|
||||
try{
|
||||
zookeeper.create(dir+"/"+prefix, data, acl, CreateMode.PERSISTENT_SEQUENTIAL);
|
||||
return true;
|
||||
}catch(KeeperException.NoNodeException e){
|
||||
}catch(KeeperException.NoNodeException e) {
|
||||
zookeeper.create(dir, new byte[0], acl, CreateMode.PERSISTENT);
|
||||
}
|
||||
}
|
||||
|
|
@ -287,7 +287,7 @@ public class DistributedQueue {
|
|||
public byte[] peek() throws KeeperException, InterruptedException{
|
||||
try{
|
||||
return element();
|
||||
}catch(NoSuchElementException e){
|
||||
}catch(NoSuchElementException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ public class DistributedQueue {
|
|||
public byte[] poll() throws KeeperException, InterruptedException {
|
||||
try{
|
||||
return remove();
|
||||
}catch(NoSuchElementException e){
|
||||
}catch(NoSuchElementException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ object TransactionLog {
|
|||
/**
|
||||
* Starts up the transaction log.
|
||||
*/
|
||||
def start(): Unit = {
|
||||
def start() {
|
||||
isConnected switchOn {
|
||||
bookieClient = new BookKeeper(zooKeeperServers)
|
||||
zkClient = new AkkaZkClient(zooKeeperServers, sessionTimeout, connectionTimeout)
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ In order to get better metrics, please put "sigar.jar" to the classpath, and add
|
|||
/*
|
||||
* Refreshes locally cached metrics from ZooKeeper, and invokes plugged monitors
|
||||
*/
|
||||
private[akka] def refresh(): Unit = {
|
||||
private[akka] def refresh() {
|
||||
|
||||
storeMetricsInZK(getLocalMetrics)
|
||||
refreshMetricsCacheFromZK()
|
||||
|
|
@ -172,7 +172,7 @@ In order to get better metrics, please put "sigar.jar" to the classpath, and add
|
|||
/*
|
||||
* Refreshes metrics manager cache from ZooKeeper
|
||||
*/
|
||||
private def refreshMetricsCacheFromZK(): Unit = {
|
||||
private def refreshMetricsCacheFromZK() {
|
||||
val allMetricsFromZK = getAllMetricsFromZK
|
||||
|
||||
localNodeMetricsCache.keySet.foreach { key ⇒
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ The ``traverse`` method is similar to ``sequence``, but it takes a sequence of `
|
|||
|
||||
Iterable<String> listStrings = ... //Just a sequence of Strings
|
||||
|
||||
Future<Iterable<String>> result = traverse(listStrings, new Function<String,Future<String>>(){
|
||||
Future<Iterable<String>> result = traverse(listStrings, new Function<String,Future<String>>() {
|
||||
public Future<String> apply(final String r) {
|
||||
return future(new Callable<String>() {
|
||||
public String call() {
|
||||
|
|
@ -229,7 +229,7 @@ Then there's a method that's called ``fold`` that takes a start-value, a sequenc
|
|||
|
||||
Iterable<Future<String>> futures = ... //A sequence of Futures, in this case Strings
|
||||
|
||||
Future<String> result = fold("", 15000, futures, new Function2<String, String, String>(){ //Start value is the empty string, timeout is 15 seconds
|
||||
Future<String> result = fold("", 15000, futures, new Function2<String, String, String>() { //Start value is the empty string, timeout is 15 seconds
|
||||
public String apply(String r, String t) {
|
||||
return r + t; //Just concatenate
|
||||
}
|
||||
|
|
@ -251,7 +251,7 @@ If the sequence passed to ``fold`` is empty, it will return the start-value, in
|
|||
|
||||
Iterable<Future<String>> futures = ... //A sequence of Futures, in this case Strings
|
||||
|
||||
Future<String> result = reduce(futures, 15000, new Function2<String, String, String>(){ //Timeout is 15 seconds
|
||||
Future<String> result = reduce(futures, 15000, new Function2<String, String, String>() { //Timeout is 15 seconds
|
||||
public String apply(String r, String t) {
|
||||
return r + t; //Just concatenate
|
||||
}
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@ The API for server managed remote typed actors is nearly the same as for untyped
|
|||
.. code-block:: scala
|
||||
|
||||
class RegistrationServiceImpl extends TypedActor with RegistrationService {
|
||||
def registerUser(user: User): Unit = {
|
||||
def registerUser(user: User) {
|
||||
... // register user
|
||||
}
|
||||
}
|
||||
|
|
@ -489,7 +489,7 @@ They are also useful if you need to perform some cleanup when a client disconnec
|
|||
.. code-block:: scala
|
||||
|
||||
class RegistrationServiceImpl extends TypedActor with RegistrationService {
|
||||
def registerUser(user: User): Unit = {
|
||||
def registerUser(user: User) {
|
||||
... // register user
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ If you have a POJO with an interface implementation separation like this:
|
|||
.. code-block:: scala
|
||||
|
||||
public class RegistrationServiceImpl extends TypedActor with RegistrationService {
|
||||
def register(user: User, cred: Credentials): Unit = {
|
||||
def register(user: User, cred: Credentials) {
|
||||
... // register user
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,15 +62,15 @@ class Journal(queuePath: String, syncJournal: ⇒ Boolean) {
|
|||
private val CMD_CONFIRM_REMOVE = 6
|
||||
private val CMD_ADD_XID = 7
|
||||
|
||||
private def open(file: File): Unit = {
|
||||
private def open(file: File) {
|
||||
writer = new FileOutputStream(file, true).getChannel
|
||||
}
|
||||
|
||||
def open(): Unit = {
|
||||
def open() {
|
||||
open(queueFile)
|
||||
}
|
||||
|
||||
def roll(xid: Int, openItems: List[QItem], queue: Iterable[QItem]): Unit = {
|
||||
def roll(xid: Int, openItems: List[QItem], queue: Iterable[QItem]) {
|
||||
writer.close
|
||||
val tmpFile = new File(queuePath + "~~" + System.currentTimeMillis)
|
||||
open(tmpFile)
|
||||
|
|
@ -89,13 +89,13 @@ class Journal(queuePath: String, syncJournal: ⇒ Boolean) {
|
|||
open
|
||||
}
|
||||
|
||||
def close(): Unit = {
|
||||
def close() {
|
||||
writer.close
|
||||
for (r ← reader) r.close
|
||||
reader = None
|
||||
}
|
||||
|
||||
def erase(): Unit = {
|
||||
def erase() {
|
||||
try {
|
||||
close()
|
||||
queueFile.delete
|
||||
|
|
@ -108,7 +108,7 @@ class Journal(queuePath: String, syncJournal: ⇒ Boolean) {
|
|||
|
||||
def isReplaying(): Boolean = replayer.isDefined
|
||||
|
||||
private def add(allowSync: Boolean, item: QItem): Unit = {
|
||||
private def add(allowSync: Boolean, item: QItem) {
|
||||
val blob = ByteBuffer.wrap(item.pack())
|
||||
size += write(false, CMD_ADDX.toByte, blob.limit)
|
||||
do {
|
||||
|
|
@ -136,7 +136,7 @@ class Journal(queuePath: String, syncJournal: ⇒ Boolean) {
|
|||
size += write(true, CMD_REMOVE.toByte)
|
||||
}
|
||||
|
||||
private def removeTentative(allowSync: Boolean): Unit = {
|
||||
private def removeTentative(allowSync: Boolean) {
|
||||
size += write(allowSync, CMD_REMOVE_TENTATIVE.toByte)
|
||||
}
|
||||
|
||||
|
|
@ -155,14 +155,14 @@ class Journal(queuePath: String, syncJournal: ⇒ Boolean) {
|
|||
size += write(true, CMD_CONFIRM_REMOVE.toByte, xid)
|
||||
}
|
||||
|
||||
def startReadBehind(): Unit = {
|
||||
def startReadBehind() {
|
||||
val pos = if (replayer.isDefined) replayer.get.position else writer.position
|
||||
val rj = new FileInputStream(queueFile).getChannel
|
||||
rj.position(pos)
|
||||
reader = Some(rj)
|
||||
}
|
||||
|
||||
def fillReadBehind(f: QItem ⇒ Unit): Unit = {
|
||||
def fillReadBehind(f: QItem ⇒ Unit) {
|
||||
val pos = if (replayer.isDefined) replayer.get.position else writer.position
|
||||
for (rj ← reader) {
|
||||
if (rj.position == pos) {
|
||||
|
|
@ -178,7 +178,7 @@ class Journal(queuePath: String, syncJournal: ⇒ Boolean) {
|
|||
}
|
||||
}
|
||||
|
||||
def replay(name: String)(f: JournalItem ⇒ Unit): Unit = {
|
||||
def replay(name: String)(f: JournalItem ⇒ Unit) {
|
||||
size = 0
|
||||
var lastUpdate = 0L
|
||||
val TEN_MB = 10L * 1024 * 1024
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ class PersistentQueue(persistencePath: String, val name: String, val config: Con
|
|||
* Return a transactionally-removed item to the queue. This is a rolled-
|
||||
* back transaction.
|
||||
*/
|
||||
def unremove(xid: Int): Unit = {
|
||||
def unremove(xid: Int) {
|
||||
synchronized {
|
||||
if (!closed) {
|
||||
if (keepJournal()) journal.unremove(xid)
|
||||
|
|
@ -279,7 +279,7 @@ class PersistentQueue(persistencePath: String, val name: String, val config: Con
|
|||
}
|
||||
}
|
||||
|
||||
def confirmRemove(xid: Int): Unit = {
|
||||
def confirmRemove(xid: Int) {
|
||||
synchronized {
|
||||
if (!closed) {
|
||||
if (keepJournal()) journal.confirmRemove(xid)
|
||||
|
|
@ -288,7 +288,7 @@ class PersistentQueue(persistencePath: String, val name: String, val config: Con
|
|||
}
|
||||
}
|
||||
|
||||
def flush(): Unit = {
|
||||
def flush() {
|
||||
while (remove(false).isDefined) {}
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ class PersistentQueue(persistencePath: String, val name: String, val config: Con
|
|||
xidCounter
|
||||
}
|
||||
|
||||
private final def fillReadBehind(): Unit = {
|
||||
private final def fillReadBehind() {
|
||||
// if we're in read-behind mode, scan forward in the journal to keep memory as full as
|
||||
// possible. this amortizes the disk overhead across all reads.
|
||||
while (keepJournal() && journal.inReadBehind && _memoryBytes < maxMemorySize()) {
|
||||
|
|
@ -338,7 +338,7 @@ class PersistentQueue(persistencePath: String, val name: String, val config: Con
|
|||
}
|
||||
}
|
||||
|
||||
def replayJournal(): Unit = {
|
||||
def replayJournal() {
|
||||
if (!keepJournal()) return
|
||||
|
||||
EventHandler.debug(this, "Replaying transaction journal for '%s'".format(name))
|
||||
|
|
@ -380,7 +380,7 @@ class PersistentQueue(persistencePath: String, val name: String, val config: Con
|
|||
|
||||
// ----- internal implementations
|
||||
|
||||
private def _add(item: QItem): Unit = {
|
||||
private def _add(item: QItem) {
|
||||
discardExpired
|
||||
if (!journal.inReadBehind) {
|
||||
queue += item
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class QueueCollection(queueFolder: String, private var queueConfigs: Configurati
|
|||
* Retrieve an item from a queue and pass it to a continuation. If no item is available within
|
||||
* the requested time, or the server is shutting down, None is passed.
|
||||
*/
|
||||
def remove(key: String, timeout: Int, transaction: Boolean, peek: Boolean)(f: Option[QItem] ⇒ Unit): Unit = {
|
||||
def remove(key: String, timeout: Int, transaction: Boolean, peek: Boolean)(f: Option[QItem] ⇒ Unit) {
|
||||
queue(key) match {
|
||||
case None ⇒
|
||||
queueMisses.incr
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ case class DurableDispatcher(
|
|||
|
||||
override def createMailbox(actorRef: LocalActorRef): AnyRef = _storage.createFor(actorRef)
|
||||
|
||||
protected[akka] override def dispatch(invocation: MessageInvocation): Unit = {
|
||||
protected[akka] override def dispatch(invocation: MessageInvocation) {
|
||||
if (invocation.channel.isInstanceOf[ActorPromise])
|
||||
throw new IllegalArgumentException("Durable mailboxes do not support Future-based messages from ?")
|
||||
super.dispatch(invocation)
|
||||
|
|
@ -125,7 +125,7 @@ case class DurablePinnedDispatcher(
|
|||
|
||||
override def createMailbox(actorRef: LocalActorRef): AnyRef = _storage.createFor(actorRef)
|
||||
|
||||
protected[akka] override def dispatch(invocation: MessageInvocation): Unit = {
|
||||
protected[akka] override def dispatch(invocation: MessageInvocation) {
|
||||
if (invocation.channel.isInstanceOf[ActorPromise])
|
||||
throw new IllegalArgumentException("Actor has a durable mailbox that does not support ?")
|
||||
super.dispatch(invocation)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ trait EmbeddedAppServer extends Bootable {
|
|||
server = Option(configuration.configure.asInstanceOf[Server]) map { s ⇒ //Set the correct classloader to our contexts
|
||||
applicationLoader foreach { loader ⇒
|
||||
//We need to provide the correct classloader to the servlets
|
||||
def setClassLoader(handlers: Seq[Handler]): Unit = {
|
||||
def setClassLoader(handlers: Seq[Handler]) {
|
||||
handlers foreach {
|
||||
case c: ContextHandler ⇒ c.setClassLoader(loader)
|
||||
case c: HandlerCollection ⇒ setClassLoader(c.getHandlers)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class RemoteActorRefProvider extends ActorRefProvider {
|
|||
}
|
||||
|
||||
case deploy ⇒ None // non-remote actor
|
||||
}
|
||||
} catch {
|
||||
case e: Exception ⇒
|
||||
newFuture completeWithException e // so the other threads gets notified of error
|
||||
|
|
|
|||
|
|
@ -812,7 +812,7 @@ trait NettyRemoteServerModule extends RemoteServerModule {
|
|||
* <p/>
|
||||
* NOTE: You need to call this method if you have registered an actor by a custom ID.
|
||||
*/
|
||||
def unregisterPerSession(id: String): Unit = {
|
||||
def unregisterPerSession(id: String) {
|
||||
|
||||
if (_isRunning.isOn) {
|
||||
EventHandler.info(this, "Unregistering server side remote actor with id [%s]".format(id))
|
||||
|
|
@ -890,10 +890,10 @@ class RemoteServerHandler(
|
|||
val sessionActors = new ChannelLocal[ConcurrentHashMap[String, ActorRef]]()
|
||||
|
||||
//Writes the specified message to the specified channel and propagates write errors to listeners
|
||||
private def write(channel: Channel, payload: AkkaRemoteProtocol): Unit = {
|
||||
private def write(channel: Channel, payload: AkkaRemoteProtocol) {
|
||||
channel.write(payload).addListener(
|
||||
new ChannelFutureListener {
|
||||
def operationComplete(future: ChannelFuture): Unit = {
|
||||
def operationComplete(future: ChannelFuture) {
|
||||
if (future.isCancelled) {
|
||||
//Not interesting at the moment
|
||||
} else if (!future.isSuccess) {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ trait MultiJvmSync extends WordSpec with MustMatchers with BeforeAndAfterAll {
|
|||
MultiJvmSync.start(getClass.getName, nodes)
|
||||
}
|
||||
|
||||
def onStart(): Unit = {}
|
||||
def onStart() {}
|
||||
|
||||
override def afterAll() = {
|
||||
MultiJvmSync.end(getClass.getName, nodes)
|
||||
onEnd()
|
||||
}
|
||||
|
||||
def onEnd(): Unit = {}
|
||||
def onEnd() {}
|
||||
|
||||
def barrier(name: String, timeout: Duration = FileBasedBarrier.DefaultTimeout) = {
|
||||
MultiJvmSync.barrier(name, nodes, getClass.getName, timeout)
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ class QuietReporter(inColor: Boolean) extends StandardOutReporter(false, inColor
|
|||
case _ ⇒ super.apply(event)
|
||||
}
|
||||
|
||||
override def makeFinalReport(resourceName: String, duration: Option[Long], summaryOption: Option[Summary]): Unit = {}
|
||||
override def makeFinalReport(resourceName: String, duration: Option[Long], summaryOption: Option[Summary]) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class HttpConcurrencyTestStress extends JUnitSuite {
|
|||
|
||||
object HttpConcurrencyTestStress {
|
||||
@BeforeClass
|
||||
def beforeClass: Unit = {
|
||||
def beforeClass{
|
||||
startCamelService
|
||||
|
||||
val workers = for (i ← 1 to 8) yield actorOf[HttpServerWorker]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ object ScalaDom {
|
|||
.getDOMImplementation
|
||||
.createDocument(null, null, null)
|
||||
|
||||
def build(node: Node, parent: JNode): Unit = {
|
||||
def build(node: Node, parent: JNode) {
|
||||
val jnode: JNode = node match {
|
||||
case e: Elem ⇒ {
|
||||
val jn = doc.createElement(e.label)
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class Agent[T](initialValue: T) {
|
|||
/**
|
||||
* Dispatch a function to update the internal state.
|
||||
*/
|
||||
def send(f: T ⇒ T): Unit = {
|
||||
def send(f: T ⇒ T) {
|
||||
def dispatch = updater ! Update(f)
|
||||
if (Stm.activeTransaction) { get; deferred(dispatch) }
|
||||
else dispatch
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ abstract class UntypedTransactor extends UntypedActor {
|
|||
* Implement a general pattern for using coordinated transactions.
|
||||
*/
|
||||
@throws(classOf[Exception])
|
||||
final def onReceive(message: Any): Unit = {
|
||||
final def onReceive(message: Any) {
|
||||
message match {
|
||||
case coordinated @ Coordinated(message) ⇒ {
|
||||
val others = coordinate(message)
|
||||
|
|
@ -87,19 +87,19 @@ abstract class UntypedTransactor extends UntypedActor {
|
|||
* A Receive block that runs before the coordinated transaction is entered.
|
||||
*/
|
||||
@throws(classOf[Exception])
|
||||
def before(message: Any): Unit = {}
|
||||
def before(message: Any) {}
|
||||
|
||||
/**
|
||||
* The Receive block to run inside the coordinated transaction.
|
||||
*/
|
||||
@throws(classOf[Exception])
|
||||
def atomically(message: Any): Unit = {}
|
||||
def atomically(message: Any) {}
|
||||
|
||||
/**
|
||||
* A Receive block that runs after the coordinated transaction.
|
||||
*/
|
||||
@throws(classOf[Exception])
|
||||
def after(message: Any): Unit = {}
|
||||
def after(message: Any) {}
|
||||
|
||||
/**
|
||||
* Bypass transactionality and behave like a normal actor.
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class TestBarrier(count: Int) {
|
|||
|
||||
def await(): Unit = await(TestBarrier.DefaultTimeout)
|
||||
|
||||
def await(timeout: Duration): Unit = {
|
||||
def await(timeout: Duration) {
|
||||
try {
|
||||
barrier.await(Testing.testTime(timeout.toNanos), TimeUnit.NANOSECONDS)
|
||||
} catch {
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class TestEventListener extends EventHandler.DefaultListener {
|
|||
|
||||
def addFilter(filter: EventFilter): Unit = filters ::= filter
|
||||
|
||||
def removeFilter(filter: EventFilter): Unit = {
|
||||
def removeFilter(filter: EventFilter) {
|
||||
@scala.annotation.tailrec
|
||||
def removeFirst(list: List[EventFilter], zipped: List[EventFilter] = Nil): List[EventFilter] = list match {
|
||||
case head :: tail if head == filter ⇒ tail.reverse_:::(zipped)
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ class AkkaParentProject(info: ProjectInfo) extends ParentProject(info) with Exec
|
|||
case s if s.startsWith("akka-") => Iterator.single(s.drop(5))
|
||||
case _ => Iterator.empty
|
||||
}
|
||||
val (repos, configs) = (project.moduleConfigurations ++ extraConfigs).foldLeft((Set.empty[String], Set.empty[String])){
|
||||
val (repos, configs) = (project.moduleConfigurations ++ extraConfigs).foldLeft((Set.empty[String], Set.empty[String])) {
|
||||
case ((repos, configs), ModuleConfiguration(org, name, ver, MavenRepository(repoName, repoPath))) =>
|
||||
val repoId = repoName.replaceAll("""[^a-zA-Z]""", "_")
|
||||
val configId = org.replaceAll("""[^a-zA-Z]""", "_") +
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ object JvmIO {
|
|||
|
||||
def ignoreOutputStream = (out: OutputStream) => ()
|
||||
|
||||
def transfer(in: InputStream, out: OutputStream): Unit = {
|
||||
def transfer(in: InputStream, out: OutputStream) {
|
||||
try {
|
||||
val buffer = new Array[Byte](BufferSize)
|
||||
def read {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue