diff --git a/akka-core/src/main/scala/actor/ActiveObject.scala b/akka-core/src/main/scala/actor/ActiveObject.scala index 114e5c854b..aa7a179b83 100644 --- a/akka-core/src/main/scala/actor/ActiveObject.scala +++ b/akka-core/src/main/scala/actor/ActiveObject.scala @@ -457,7 +457,6 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, val callbacks: Op if (arg.getClass.getName.contains(ActiveObject.AW_PROXY_PREFIX)) unserializable = true } if (!unserializable && hasMutableArgument) { - // FIXME: can we have another default deep cloner? val copyOfArgs = Serializer.Java.deepClone(args) joinPoint.getRtti.asInstanceOf[MethodRtti].setParameterValues(copyOfArgs.asInstanceOf[Array[AnyRef]]) } @@ -480,7 +479,7 @@ ublic class CamelInvocationHandler implements InvocationHandler { BeanInvocation invocation = new BeanInvocation(method, args); ExchangePattern pattern = ExchangePattern.InOut; MethodInfo methodInfo = methodInfoCache.getMethodInfo(method); - if (methodInfo != null) { + if (methodInfo ne null) { pattern = methodInfo.getPattern(); } Exchange exchange = new DefaultExchange(endpoint, pattern); @@ -488,7 +487,7 @@ ublic class CamelInvocationHandler implements InvocationHandler { producer.process(exchange); Throwable fault = exchange.getException(); - if (fault != null) { + if (fault ne null) { throw new InvocationTargetException(fault); } if (pattern.isOutCapable()) { @@ -511,7 +510,7 @@ ublic class CamelInvocationHandler implements InvocationHandler { exchange.getIn().setBody(joinpoint) producer.process(exchange) val fault = exchange.getException(); - if (fault != null) throw new InvocationTargetException(fault) + if (fault ne null) throw new InvocationTargetException(fault) // FIXME: need some timeout and future here... exchange.getOut.getBody diff --git a/akka-core/src/main/scala/actor/Actor.scala b/akka-core/src/main/scala/actor/Actor.scala index 8d7ce9f7c1..351d1b7b4b 100644 --- a/akka-core/src/main/scala/actor/Actor.scala +++ b/akka-core/src/main/scala/actor/Actor.scala @@ -815,7 +815,7 @@ trait Actor extends TransactionManagement { if (sender.isDefined) { requestBuilder.setSourceTarget(sender.get.getClass.getName) requestBuilder.setSourceUuid(sender.get.uuid) - log.debug("Setting sending actor as " + sender.get.getClass.getName + ", " + _contactAddress) + log.debug("Setting sending actor as %s, %s", sender.get.getClass.getName, _contactAddress) if (sender.get._contactAddress.isDefined) { val addr = sender.get._contactAddress.get @@ -839,7 +839,6 @@ trait Actor extends TransactionManagement { } } - // FIXME support local and remote sender as postMessageToMailbox above private def postMessageToMailboxAndCreateFutureResultWithTimeout( message: Any, timeout: Long): CompletableFutureResult = { if (_remoteAddress.isDefined) { @@ -962,7 +961,7 @@ trait Actor extends TransactionManagement { if (trapExit.exists(_.isAssignableFrom(reason.getClass))) { if (faultHandler.isDefined) { faultHandler.get match { - // FIXME: implement support for maxNrOfRetries and withinTimeRange in RestartStrategy + // FIXME: implement support for maxNrOfRetries and withinTimeRange in RestartStrategy case AllForOneStrategy(maxNrOfRetries, withinTimeRange) => restartLinkedActors(reason) case OneForOneStrategy(maxNrOfRetries, withinTimeRange) => dead.restart(reason) } diff --git a/akka-core/src/main/scala/actor/ActorRegistry.scala b/akka-core/src/main/scala/actor/ActorRegistry.scala index 6cba33b7ba..2367e372b0 100755 --- a/akka-core/src/main/scala/actor/ActorRegistry.scala +++ b/akka-core/src/main/scala/actor/ActorRegistry.scala @@ -38,7 +38,7 @@ object ActorRegistry extends Logging { case None => actorsByClassName + (className -> (actor :: Nil)) } val id = actor.id - if (id == null) throw new IllegalStateException("Actor.id is null " + actor) + if (id eq null) throw new IllegalStateException("Actor.id is null " + actor) actorsById.get(id) match { case Some(instances) => actorsById + (id -> (actor :: instances)) case None => actorsById + (id -> (actor :: Nil)) @@ -50,7 +50,6 @@ object ActorRegistry extends Logging { actorsById - actor.getClass.getName } - // TODO: document ActorRegistry.shutdownAll def shutdownAll = { log.info("Shutting down all actors in the system...") actorsById.foreach(entry => entry._2.map(_.stop)) diff --git a/akka-core/src/main/scala/actor/BootableActorLoaderService.scala b/akka-core/src/main/scala/actor/BootableActorLoaderService.scala index ef6d8f7eab..f305711934 100644 --- a/akka-core/src/main/scala/actor/BootableActorLoaderService.scala +++ b/akka-core/src/main/scala/actor/BootableActorLoaderService.scala @@ -30,7 +30,7 @@ trait BootableActorLoaderService extends Bootable with Logging { val toDeploy = for (f <- DEPLOY_DIR.listFiles().toArray.toList.asInstanceOf[List[File]]) yield f.toURL log.info("Deploying applications from [%s]: [%s]", DEPLOY, toDeploy.toArray.toList) new URLClassLoader(toDeploy.toArray, getClass.getClassLoader) - } else if (getClass.getClassLoader.getResourceAsStream("akka.conf") != null) { + } else if (getClass.getClassLoader.getResourceAsStream("akka.conf") ne null) { getClass.getClassLoader } else throw new IllegalStateException( "AKKA_HOME is not defined and no 'akka.conf' can be found on the classpath, aborting") diff --git a/akka-core/src/main/scala/config/ActiveObjectGuiceConfigurator.scala b/akka-core/src/main/scala/config/ActiveObjectGuiceConfigurator.scala index 6edd5ed6d3..32191bd303 100644 --- a/akka-core/src/main/scala/config/ActiveObjectGuiceConfigurator.scala +++ b/akka-core/src/main/scala/config/ActiveObjectGuiceConfigurator.scala @@ -46,7 +46,7 @@ private[akka] class ActiveObjectGuiceConfigurator extends ActiveObjectConfigurat */ override def getInstance[T](clazz: Class[T]): T = synchronized { log.debug("Retrieving active object [%s]", clazz.getName) - if (injector == null) throw new IllegalStateException( + if (injector eq null) throw new IllegalStateException( "inject() and/or supervise() must be called before invoking getInstance(clazz)") val (proxy, targetInstance, component) = activeObjectRegistry.getOrElse(clazz, throw new IllegalStateException( @@ -132,13 +132,13 @@ private[akka] class ActiveObjectGuiceConfigurator extends ActiveObjectConfigurat } override def inject: ActiveObjectConfiguratorBase = synchronized { - if (injector != null) throw new IllegalStateException("inject() has already been called on this configurator") + if (injector ne null) throw new IllegalStateException("inject() has already been called on this configurator") injector = Guice.createInjector(modules) this } override def supervise: ActiveObjectConfiguratorBase = synchronized { - if (injector == null) inject + if (injector eq null) inject supervisor = Some(ActiveObject.supervise(restartStrategy, supervised)) //camelContext.addComponent(AKKA_CAMEL_ROUTING_SCHEME, new ActiveObjectComponent(this)) //camelContext.start diff --git a/akka-core/src/main/scala/config/Config.scala b/akka-core/src/main/scala/config/Config.scala index 8f2cfe71fc..b8e4c8aab8 100644 --- a/akka-core/src/main/scala/config/Config.scala +++ b/akka-core/src/main/scala/config/Config.scala @@ -40,7 +40,7 @@ object ScalaConfig { def apply(scope: Scope) = new LifeCycle(scope, None) } case class RestartCallbacks(preRestart: String, postRestart: String) { - if (preRestart == null || postRestart == null) throw new IllegalArgumentException("Restart callback methods can't be null") + if ((preRestart eq null) || (postRestart eq null)) throw new IllegalArgumentException("Restart callback methods can't be null") } case object Permanent extends Scope @@ -56,9 +56,9 @@ object ScalaConfig { _dispatcher: MessageDispatcher, // optional _remoteAddress: RemoteAddress // optional ) extends Server { - val intf: Option[Class[_]] = if (_intf == null) None else Some(_intf) - val dispatcher: Option[MessageDispatcher] = if (_dispatcher == null) None else Some(_dispatcher) - val remoteAddress: Option[RemoteAddress] = if (_remoteAddress == null) None else Some(_remoteAddress) + val intf: Option[Class[_]] = if (_intf eq null) None else Some(_intf) + val dispatcher: Option[MessageDispatcher] = if (_dispatcher eq null) None else Some(_dispatcher) + val remoteAddress: Option[RemoteAddress] = if (_remoteAddress eq null) None else Some(_remoteAddress) } object Component { def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int) = @@ -131,7 +131,7 @@ object JavaConfig { class LifeCycle(@BeanProperty val scope: Scope, @BeanProperty val callbacks: RestartCallbacks) extends ConfigElement { def this(scope: Scope) = this(scope, null) def transform = { - val callbackOption = if (callbacks == null) None else Some(callbacks.transform) + val callbackOption = if (callbacks eq null) None else Some(callbacks.transform) se.scalablesolutions.akka.config.ScalaConfig.LifeCycle(scope.transform, callbackOption) } } @@ -217,7 +217,7 @@ object JavaConfig { def transform = se.scalablesolutions.akka.config.ScalaConfig.Component( intf, target, lifeCycle.transform, timeout, transactionRequired, dispatcher, - if (remoteAddress != null) se.scalablesolutions.akka.config.ScalaConfig.RemoteAddress(remoteAddress.hostname, remoteAddress.port) else null) + if (remoteAddress ne null) se.scalablesolutions.akka.config.ScalaConfig.RemoteAddress(remoteAddress.hostname, remoteAddress.port) else null) def newSupervised(actor: Actor) = se.scalablesolutions.akka.config.ScalaConfig.Supervise(actor, lifeCycle.transform) diff --git a/akka-core/src/main/scala/dispatch/AbstractReactorBasedEventDrivenDispatcher.scala b/akka-core/src/main/scala/dispatch/AbstractReactorBasedEventDrivenDispatcher.scala index a7aa241180..9d92163627 100644 --- a/akka-core/src/main/scala/dispatch/AbstractReactorBasedEventDrivenDispatcher.scala +++ b/akka-core/src/main/scala/dispatch/AbstractReactorBasedEventDrivenDispatcher.scala @@ -49,11 +49,6 @@ class ReactiveMessageQueue(name: String) extends MessageQueue { queue.notifyAll } - def prepend(handle: MessageInvocation) = queue.synchronized { - queue.add(handle) - queue.notifyAll - } - def read(destination: List[MessageInvocation]) = queue.synchronized { while (queue.isEmpty && !interrupted) queue.wait if (!interrupted) while (!queue.isEmpty) destination.add(queue.remove) diff --git a/akka-core/src/main/scala/dispatch/Reactor.scala b/akka-core/src/main/scala/dispatch/Reactor.scala index 8b12b0b5bc..0b0936fc34 100644 --- a/akka-core/src/main/scala/dispatch/Reactor.scala +++ b/akka-core/src/main/scala/dispatch/Reactor.scala @@ -17,8 +17,7 @@ final class MessageInvocation(val receiver: Actor, val future: Option[CompletableFutureResult], val sender: Option[Actor], val tx: Option[Transaction]) { - if (receiver == null) throw new IllegalArgumentException("receiver is null") - if (message == null) throw new IllegalArgumentException("message is null") + if (receiver eq null) throw new IllegalArgumentException("receiver is null") def invoke = receiver.invoke(this) @@ -51,7 +50,6 @@ final class MessageInvocation(val receiver: Actor, trait MessageQueue { def append(handle: MessageInvocation) - def prepend(handle: MessageInvocation) } trait MessageInvoker { diff --git a/akka-core/src/main/scala/dispatch/ReactorBasedSingleThreadEventDrivenDispatcher.scala b/akka-core/src/main/scala/dispatch/ReactorBasedSingleThreadEventDrivenDispatcher.scala index 6131b43858..c9b51dfa92 100644 --- a/akka-core/src/main/scala/dispatch/ReactorBasedSingleThreadEventDrivenDispatcher.scala +++ b/akka-core/src/main/scala/dispatch/ReactorBasedSingleThreadEventDrivenDispatcher.scala @@ -27,7 +27,7 @@ class ReactorBasedSingleThreadEventDrivenDispatcher(name: String) extends Abstra while (iter.hasNext) { val invocation = iter.next val invoker = messageInvokers.get(invocation.receiver) - if (invoker != null) invoker.invoke(invocation) + if (invoker ne null) invoker.invoke(invocation) iter.remove } } diff --git a/akka-core/src/main/scala/dispatch/ReactorBasedThreadPoolEventDrivenDispatcher.scala b/akka-core/src/main/scala/dispatch/ReactorBasedThreadPoolEventDrivenDispatcher.scala index e6bccb70bb..efc7198720 100644 --- a/akka-core/src/main/scala/dispatch/ReactorBasedThreadPoolEventDrivenDispatcher.scala +++ b/akka-core/src/main/scala/dispatch/ReactorBasedThreadPoolEventDrivenDispatcher.scala @@ -105,10 +105,10 @@ class ReactorBasedThreadPoolEventDrivenDispatcher(_name: String) val invocations = selectedInvocations.iterator while (invocations.hasNext && totalNrOfActors > totalNrOfBusyActors && passFairnessCheck(nrOfBusyMessages)) { val invocation = invocations.next - if (invocation == null) throw new IllegalStateException("Message invocation is null [" + invocation + "]") + if (invocation eq null) throw new IllegalStateException("Message invocation is null [" + invocation + "]") if (!busyActors.contains(invocation.receiver)) { val invoker = messageInvokers.get(invocation.receiver) - if (invoker == null) throw new IllegalStateException("Message invoker for invocation [" + invocation + "] is null") + if (invoker eq null) throw new IllegalStateException("Message invoker for invocation [" + invocation + "] is null") resume(invocation.receiver) invocations.remove executor.execute(new Runnable() { diff --git a/akka-core/src/main/scala/dispatch/ThreadBasedDispatcher.scala b/akka-core/src/main/scala/dispatch/ThreadBasedDispatcher.scala index fed90d6ba7..71c3c222fb 100644 --- a/akka-core/src/main/scala/dispatch/ThreadBasedDispatcher.scala +++ b/akka-core/src/main/scala/dispatch/ThreadBasedDispatcher.scala @@ -49,7 +49,6 @@ class BlockingMessageQueue(name: String) extends MessageQueue { // FIXME: configure the LinkedBlockingQueue in BlockingMessageQueue, use a Builder like in the ReactorBasedThreadPoolEventDrivenDispatcher private val queue = new LinkedBlockingQueue[MessageInvocation] def append(invocation: MessageInvocation) = queue.put(invocation) - def prepend(invocation: MessageInvocation) = queue.add(invocation) // FIXME is add prepend??? def take: MessageInvocation = queue.take def read(destination: Queue[MessageInvocation]) = throw new UnsupportedOperationException def interrupt = throw new UnsupportedOperationException diff --git a/akka-core/src/main/scala/dispatch/ThreadPoolBuilder.scala b/akka-core/src/main/scala/dispatch/ThreadPoolBuilder.scala index 6e975e885d..b18eb262a4 100644 --- a/akka-core/src/main/scala/dispatch/ThreadPoolBuilder.scala +++ b/akka-core/src/main/scala/dispatch/ThreadPoolBuilder.scala @@ -9,6 +9,7 @@ import atomic.{AtomicLong, AtomicInteger} import ThreadPoolExecutor.CallerRunsPolicy import java.util.Collection +import se.scalablesolutions.akka.util.Logging trait ThreadPoolBuilder { val name: String @@ -207,8 +208,8 @@ trait ThreadPoolBuilder { protected val counter = new AtomicLong def newThread(runnable: Runnable) = - //new MonitorableThread(runnable, name) - new Thread(runnable, name + "-" + counter.getAndIncrement) + new MonitorableThread(runnable, name) + // new Thread(runnable, name + "-" + counter.getAndIncrement) } /** @@ -218,7 +219,7 @@ trait ThreadPoolBuilder { val DEFAULT_NAME = "MonitorableThread" val created = new AtomicInteger val alive = new AtomicInteger - @volatile val debugLifecycle = false + @volatile var debugLifecycle = false } // FIXME fix the issues with using the monitoring in MonitorableThread @@ -227,20 +228,21 @@ trait ThreadPoolBuilder { * @author Jonas Bonér */ class MonitorableThread(runnable: Runnable, name: String) - extends Thread(runnable, name + "-" + MonitorableThread.created.incrementAndGet) { //with Logging { + extends Thread(runnable, name + "-" + MonitorableThread.created.incrementAndGet) with Logging { + setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { - def uncaughtException(thread: Thread, cause: Throwable) = {} //log.error("UNCAUGHT in thread [%s] cause [%s]", thread.getName, cause) + def uncaughtException(thread: Thread, cause: Throwable) = log.error(cause, "UNCAUGHT in thread [%s]", thread.getName) }) override def run = { val debug = MonitorableThread.debugLifecycle - //if (debug) log.debug("Created %s", getName) + log.debug("Created %s", getName) try { MonitorableThread.alive.incrementAndGet super.run } finally { MonitorableThread.alive.decrementAndGet - //if (debug) log.debug("Exiting %s", getName) + log.debug("Exiting %s", getName) } } } diff --git a/akka-core/src/main/scala/remote/RemoteClient.scala b/akka-core/src/main/scala/remote/RemoteClient.scala index 6b0ddec6c8..aa71e90a4b 100644 --- a/akka-core/src/main/scala/remote/RemoteClient.scala +++ b/akka-core/src/main/scala/remote/RemoteClient.scala @@ -23,7 +23,16 @@ import org.jboss.netty.util.{TimerTask, Timeout, HashedWheelTimer} import java.net.InetSocketAddress import java.util.concurrent.{TimeUnit, Executors, ConcurrentMap, ConcurrentHashMap} - +import java.util.concurrent.atomic.AtomicLong + +import org.codehaus.aspectwerkz.proxy.Uuid + +object RemoteRequestIdFactory { + private val nodeId = Uuid.newUuid + private val id = new AtomicLong + def nextId: Long = id.getAndIncrement + nodeId +} + /** * @author Jonas Bonér */ @@ -31,8 +40,6 @@ object RemoteClient extends Logging { val READ_TIMEOUT = config.getInt("akka.remote.client.read-timeout", 10000) val RECONNECT_DELAY = config.getInt("akka.remote.client.reconnect-delay", 5000) - // TODO: add configuration optons: 'HashedWheelTimer(long tickDuration, TimeUnit unit, int ticksPerWheel)' -// private[akka] val TIMER = new HashedWheelTimer private val clients = new HashMap[String, RemoteClient] def clientFor(address: InetSocketAddress): RemoteClient = synchronized { @@ -54,7 +61,6 @@ object RemoteClient extends Logging { def shutdownAll() = synchronized { clients.foreach({case (addr, client) => client.shutdown}) clients.clear -// TIMER.stop } } @@ -68,7 +74,6 @@ class RemoteClient(hostname: String, port: Int) extends Logging { private val futures = new ConcurrentHashMap[Long, CompletableFutureResult] private val supervisors = new ConcurrentHashMap[String, Actor] - // TODO is this Netty channelFactory and other options always the best or should it be configurable? private val channelFactory = new NioClientSocketChannelFactory( Executors.newCachedThreadPool, Executors.newCachedThreadPool) diff --git a/akka-core/src/main/scala/remote/RemoteServer.scala b/akka-core/src/main/scala/remote/RemoteServer.scala index e37edbc5d3..907477fcbd 100755 --- a/akka-core/src/main/scala/remote/RemoteServer.scala +++ b/akka-core/src/main/scala/remote/RemoteServer.scala @@ -189,7 +189,7 @@ class RemoteServerHandler(val name: String, openChannels: ChannelGroup, val appl override def messageReceived(ctx: ChannelHandlerContext, event: MessageEvent) = { val message = event.getMessage - if (message == null) throw new IllegalStateException( + if (message eq null) throw new IllegalStateException( "Message in remote MessageEvent is null: " + event) if (message.isInstanceOf[RemoteRequest]) { handleRemoteRequest(message.asInstanceOf[RemoteRequest], event.getChannel) @@ -340,7 +340,7 @@ class RemoteServerHandler(val name: String, openChannels: ChannelGroup, val appl private def createActiveObject(name: String, timeout: Long): AnyRef = { val activeObjectOrNull = activeObjects.get(name) - if (activeObjectOrNull == null) { + if (activeObjectOrNull eq null) { try { log.info("Creating a new remote active object [%s]", name) val clazz = if (applicationLoader.isDefined) applicationLoader.get.loadClass(name) @@ -358,7 +358,7 @@ class RemoteServerHandler(val name: String, openChannels: ChannelGroup, val appl private def createActor(name: String, uuid: String, timeout: Long): Actor = { val actorOrNull = actors.get(uuid) - if (actorOrNull == null) { + if (actorOrNull eq null) { try { log.info("Creating a new remote actor [%s:%s]", name, uuid) val clazz = if (applicationLoader.isDefined) applicationLoader.get.loadClass(name) diff --git a/akka-core/src/main/scala/remote/RequestReply.scala b/akka-core/src/main/scala/remote/RequestReply.scala deleted file mode 100644 index a4a0cc8924..0000000000 --- a/akka-core/src/main/scala/remote/RequestReply.scala +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright (C) 2009 Scalable Solutions. - */ - -package se.scalablesolutions.akka.remote - -import java.util.concurrent.atomic.AtomicLong -import stm.Transaction -import util.HashCode - -// FIXME: will not work - can clash with other host's requests - need te prepend with hostname -object RemoteRequestIdFactory { - private val id = new AtomicLong - def nextId = id.getAndIncrement -} - -/* -@serializable class RemoteRequest(val message: AnyRef, - val method: String, - val target: String, - val timeout: Long, - val supervisorUuid: Option[String], - val isActor: Boolean, - val isOneWay: Boolean, - val isEscaped: Boolean) { - private[RemoteRequest] var _id = IdFactory.nextId - def id = _id - - override def toString: String = synchronized { - "RemoteRequest[isActor: " + isActor + " | message: " + message + " | timeout: " + timeout + " | method: " + method + - " | target: " + target + " | isOneWay: " + isOneWay + " | supervisorUuid: " + supervisorUuid + "]" - } - - override def hashCode(): Int = synchronized { - var result = HashCode.SEED - result = HashCode.hash(result, isActor) - result = HashCode.hash(result, message) - result = HashCode.hash(result, method) - result = HashCode.hash(result, target) - result = HashCode.hash(result, timeout) - result = HashCode.hash(result, isOneWay) - result = HashCode.hash(result, isEscaped) - result = if (supervisorUuid.isDefined) HashCode.hash(result, supervisorUuid.get) else result - result - } - - override def equals(that: Any): Boolean = synchronized { - that != null && - that.isInstanceOf[RemoteRequest] && - that.asInstanceOf[RemoteRequest].isActor == isActor && - that.asInstanceOf[RemoteRequest].message == message && - that.asInstanceOf[RemoteRequest].method == method && - that.asInstanceOf[RemoteRequest].target == target && - that.asInstanceOf[RemoteRequest].timeout == timeout && - that.asInstanceOf[RemoteRequest].isOneWay == isOneWay && - that.asInstanceOf[RemoteRequest].isEscaped == isEscaped && - that.asInstanceOf[RemoteRequest].supervisorUuid.isDefined == supervisorUuid.isDefined && - that.asInstanceOf[RemoteRequest].supervisorUuid.get == supervisorUuid.get - } - - def newReplyWithMessage(message: AnyRef, tx: Option[Transaction]) = synchronized { - new RemoteReply(true, id, message, null, supervisorUuid) - } - - def newReplyWithException(error: Throwable) = synchronized { - new RemoteReply(false, id, null, error, supervisorUuid) - } - - def cloneWithNewMessage(message: AnyRef, isEscaped: Boolean) = synchronized { - val request = new RemoteRequest(message, method, target, timeout, supervisorUuid, isActor, isOneWay, isEscaped) - request._id = id - request - } -} - -@serializable class RemoteReply(val successful: Boolean, - val id: Long, - val message: AnyRef, - val exception: Throwable, - val supervisorUuid: Option[String]) { - override def toString: String = synchronized { - "RemoteReply[successful: " + successful + " | id: " + id + " | message: " + message + - " | exception: " + exception + " | supervisorUuid: " + supervisorUuid + "]" - } - - override def hashCode(): Int = synchronized { - var result = HashCode.SEED - result = HashCode.hash(result, successful) - result = HashCode.hash(result, id) - result = HashCode.hash(result, message) - result = HashCode.hash(result, exception) - result = if (supervisorUuid.isDefined) HashCode.hash(result, supervisorUuid.get) else result - result - } - - override def equals(that: Any): Boolean = synchronized { - that != null && - that.isInstanceOf[RemoteReply] && - that.asInstanceOf[RemoteReply].successful == successful && - that.asInstanceOf[RemoteReply].id == id && - that.asInstanceOf[RemoteReply].message == message && - that.asInstanceOf[RemoteReply].exception == exception && - that.asInstanceOf[RemoteRequest].supervisorUuid.isDefined == supervisorUuid.isDefined && - that.asInstanceOf[RemoteRequest].supervisorUuid.get == supervisorUuid.get - } -} -*/ \ No newline at end of file diff --git a/akka-core/src/main/scala/serialization/Serializable.scala b/akka-core/src/main/scala/serialization/Serializable.scala index 9312a859c8..f8ab5a2dcf 100644 --- a/akka-core/src/main/scala/serialization/Serializable.scala +++ b/akka-core/src/main/scala/serialization/Serializable.scala @@ -79,7 +79,6 @@ object Serializable { def toJSON: String = { val out = new StringWriter - // FIXME: is this mapper expensive to create? Should I cache it away? val mapper = new ObjectMapper mapper.writeValue(out, this) out.close diff --git a/akka-core/src/main/scala/serialization/Serializer.scala b/akka-core/src/main/scala/serialization/Serializer.scala index a79938e33f..c086fd9ff8 100644 --- a/akka-core/src/main/scala/serialization/Serializer.scala +++ b/akka-core/src/main/scala/serialization/Serializer.scala @@ -88,7 +88,7 @@ object Serializer { } def in(bytes: Array[Byte], clazz: Class[_]): AnyRef = { - if (clazz == null) throw new IllegalArgumentException("Protobuf message can't be null") + if (clazz eq null) throw new IllegalArgumentException("Protobuf message can't be null") in(bytes, Some(clazz)) } } @@ -119,7 +119,7 @@ object Serializer { } def in(json: String, clazz: Class[_]): AnyRef = { - if (clazz == null) throw new IllegalArgumentException("Can't deserialize JSON to instance if no class is provided") + if (clazz eq null) throw new IllegalArgumentException("Can't deserialize JSON to instance if no class is provided") mapper.readValue(json, clazz).asInstanceOf[AnyRef] } } diff --git a/akka-core/src/main/scala/stm/HashTrie.scala b/akka-core/src/main/scala/stm/HashTrie.scala index 7da4ec5557..c41ad85006 100644 --- a/akka-core/src/main/scala/stm/HashTrie.scala +++ b/akka-core/src/main/scala/stm/HashTrie.scala @@ -270,11 +270,11 @@ private[collection] class BitmappedNode[K, +V](shift: Int)(table: Array[Node[K, def elements = { table.foldLeft(emptyElements) { (it, e) => - if (e == null) it else it ++ e.elements + if (e eq null) it else it ++ e.elements } } - override def toString = "BitmappedNode(" + size + "," + table.filter(_ != null).toList.toString + ")" + override def toString = "BitmappedNode(" + size + "," + table.filter(_ ne null).toList.toString + ")" private lazy val emptyElements: Iterator[(K, V)] = new Iterator[(K, V)] { val hasNext = false diff --git a/akka-core/src/main/scala/stm/Transaction.scala b/akka-core/src/main/scala/stm/Transaction.scala index 0c1aaf9f93..bed7093ede 100644 --- a/akka-core/src/main/scala/stm/Transaction.scala +++ b/akka-core/src/main/scala/stm/Transaction.scala @@ -270,7 +270,7 @@ object Transaction extends TransactionManagement { // For reinitialize transaction after sending it over the wire private[akka] def reinit = synchronized { import net.lag.logging.{Logger, Level} - if (log == null) { + if (log eq null) { log = Logger.get(this.getClass.getName) log.setLevel(Level.ALL) // TODO: preserve logging level } diff --git a/akka-core/src/main/scala/stm/TransactionWatcher.scala b/akka-core/src/main/scala/stm/TransactionWatcher.scala index 2dd966c7ba..6c1644430d 100644 --- a/akka-core/src/main/scala/stm/TransactionWatcher.scala +++ b/akka-core/src/main/scala/stm/TransactionWatcher.scala @@ -48,7 +48,7 @@ class TransactionWatcher extends Logging with Watcher { zk.exists(znode, true, this, null) } } - if (chainedWatcher != null) chainedWatcher.process(event); + if (chainedWatcher ne null) chainedWatcher.process(event); } diff --git a/akka-core/src/main/scala/stm/Vector.scala b/akka-core/src/main/scala/stm/Vector.scala index 27729c0a07..e341875990 100644 --- a/akka-core/src/main/scala/stm/Vector.scala +++ b/akka-core/src/main/scala/stm/Vector.scala @@ -117,7 +117,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail var (newRoot, expansion) = pushTail(shift - 5, root, tail, null) var newShift = shift - if (expansion != null) { + if (expansion ne null) { newRoot = array(newRoot, expansion) newShift += 5 } @@ -130,7 +130,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail val newChild = if (level == 0) tailNode else { val (newChild, subExpansion) = pushTail(level - 5, arr(arr.length - 1).asInstanceOf[Array[AnyRef]], tailNode, expansion) - if (subExpansion == null) { + if (subExpansion eq null) { val ret = new Array[AnyRef](arr.length) Array.copy(arr, 0, ret, 0, arr.length) @@ -169,7 +169,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail var (newRoot, pTail) = popTail(shift - 5, root, null) var newShift = shift - if (newRoot == null) { + if (newRoot eq null) { newRoot = EmptyArray } @@ -186,7 +186,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail val newPTail = if (shift > 0) { val (newChild, subPTail) = popTail(shift - 5, arr(arr.length - 1).asInstanceOf[Array[AnyRef]], pTail) - if (newChild != null) { + if (newChild ne null) { val ret = new Array[AnyRef](arr.length) Array.copy(arr, 0, ret, 0, arr.length) diff --git a/akka-core/src/test/scala/ForwardActor.scala b/akka-core/src/test/scala/ForwardActor.scala index dc9054f2bf..d44c53d63b 100644 --- a/akka-core/src/test/scala/ForwardActor.scala +++ b/akka-core/src/test/scala/ForwardActor.scala @@ -38,7 +38,7 @@ class ForwardActorTest extends JUnitSuite { val senderActor = new SenderActor senderActor.start Thread.sleep(1000) - assert(ForwardState.sender != null) + assert(ForwardState.sender ne null) assert(senderActor === ForwardState.sender) } } diff --git a/akka-core/src/test/scala/Messages.scala b/akka-core/src/test/scala/Messages.scala index 5fead04d41..1b016d95ac 100644 --- a/akka-core/src/test/scala/Messages.scala +++ b/akka-core/src/test/scala/Messages.scala @@ -13,7 +13,6 @@ case object OneWay extends TestMessage case object Die extends TestMessage case object NotifySupervisorExit extends TestMessage -// FIXME: add this User class to document on how to use SBinary case class User(val usernamePassword: Tuple2[String, String], val email: String, val age: Int) diff --git a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/InMemNestedStateTest.java b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/InMemNestedStateTest.java index ae400d9382..6d93c18ac2 100644 --- a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/InMemNestedStateTest.java +++ b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/InMemNestedStateTest.java @@ -21,7 +21,6 @@ public class InMemNestedStateTest extends TestCase { conf.configure( new RestartStrategy(new AllForOne(), 3, 5000, new Class[]{Exception.class}), new Component[]{ - // FIXME: remove string-name, add ctor to only accept target class new Component(InMemStateful.class, new LifeCycle(new Permanent()), 10000000), new Component(InMemStatefulNested.class, new LifeCycle(new Permanent()), 10000000), new Component(InMemFailer.class, new LifeCycle(new Permanent()), 1000) diff --git a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java index 973ac14b6b..5bccda4d4c 100644 --- a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java +++ b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java @@ -158,20 +158,6 @@ class InMemClasherImpl implements InMemClasher { public void clash() { state.put("clasher", "was here"); - // spend some time here - // for (long i = 0; i < 1000000000; i++) { - // for (long j = 0; j < 10000000; j++) { - // j += i; - // } - // } - - // FIXME: this statement gives me this error: - // se.scalablesolutions.akka.kernel.ActiveObjectException: - // Unexpected message [!(scala.actors.Channel@c2b2f6,ResultOrFailure[Right(null)])] - // to - // [GenericServer[se.scalablesolutions.akka.api.StatefulImpl]] from - // [GenericServer[se.scalablesolutions.akka.api.ClasherImpl]]] - // try { Thread.sleep(1000); } catch (InterruptedException e) {} } } */ diff --git a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentClasher.java b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentClasher.java index 059b81c1e8..d5360da3bc 100644 --- a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentClasher.java +++ b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentClasher.java @@ -21,14 +21,5 @@ public class PersistentClasher { public void clash() { state.put("clasher", "was here"); - // spend some time here - - // FIXME: this statement gives me this error: - // se.scalablesolutions.akka.kernel.ActiveObjectException: - // Unexpected message [!(scala.actors.Channel@c2b2f6,ResultOrFailure[Right(null)])] - // to - // [GenericServer[se.scalablesolutions.akka.api.StatefulImpl]] from - // [GenericServer[se.scalablesolutions.akka.api.ClasherImpl]]] - // try { Thread.sleep(1000); } catch (InterruptedException e) {} } } \ No newline at end of file diff --git a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentNestedStateTest.java b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentNestedStateTest.java index 4c74a8b1a2..c6368e4a0c 100644 --- a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentNestedStateTest.java +++ b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/PersistentNestedStateTest.java @@ -22,7 +22,6 @@ public class PersistentNestedStateTest extends TestCase { conf.configure( new RestartStrategy(new AllForOne(), 3, 5000, new Class[] {Exception.class}), new Component[]{ - // FIXME: remove string-name, add ctor to only accept target class new Component(PersistentStateful.class, new LifeCycle(new Permanent()), 10000000), new Component(PersistentStatefulNested.class, new LifeCycle(new Permanent()), 10000000), new Component(PersistentFailer.class, new LifeCycle(new Permanent()), 1000) diff --git a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/ProtobufProtocol.proto b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/ProtobufProtocol.proto index 3ff0784949..b36c1dc5e1 100644 --- a/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/ProtobufProtocol.proto +++ b/akka-fun-test-java/src/test/java/se/scalablesolutions/akka/api/ProtobufProtocol.proto @@ -6,7 +6,7 @@ package se.scalablesolutions.akka.api; /* Compile with: - cd ./fun-test-java/src/test/java + cd ./akka-fun-test-java/src/test/java protoc se/scalablesolutions/akka/api/ProtobufProtocol.proto --java_out . */ diff --git a/akka-kernel/src/main/scala/Kernel.scala b/akka-kernel/src/main/scala/Kernel.scala index e555aa377b..e449387fff 100644 --- a/akka-kernel/src/main/scala/Kernel.scala +++ b/akka-kernel/src/main/scala/Kernel.scala @@ -21,7 +21,6 @@ object Main { * @author Jonas Bonér */ object Kernel extends Logging { - // FIXME add API to shut server down gracefully @volatile private var hasBooted = false private val startTime = System.currentTimeMillis @@ -62,7 +61,6 @@ object Kernel extends Logging { } } - //FIXME This is only being called by a test def startRemoteService = Bundles.startRemoteService private def printBanner = { diff --git a/akka-persistence-cassandra/src/main/scala/CassandraStorageBackend.scala b/akka-persistence-cassandra/src/main/scala/CassandraStorageBackend.scala index f5719625c7..b20582a8e6 100644 --- a/akka-persistence-cassandra/src/main/scala/CassandraStorageBackend.scala +++ b/akka-persistence-cassandra/src/main/scala/CassandraStorageBackend.scala @@ -93,9 +93,8 @@ private[akka] object CassandraStorageBackend extends } } - // FIXME implement insertVectorStorageEntriesFor def insertVectorStorageEntriesFor(name: String, elements: List[Array[Byte]]) = { - throw new UnsupportedOperationException("insertVectorStorageEntriesFor for CassandraStorageBackend is not implemented yet") + throw new UnsupportedOperationException("CassandraStorageBackend::insertVectorStorageEntriesFor is not implemented") } def updateVectorStorageEntryFor(name: String, index: Int, elem: Array[Byte]) = { @@ -197,7 +196,7 @@ private[akka] object CassandraStorageBackend extends def removeMapStorageFor(name: String): Unit = removeMapStorageFor(name, null) def removeMapStorageFor(name: String, key: Array[Byte]): Unit = { - val keyBytes = if (key == null) null else key + val keyBytes = if (key eq null) null else key sessions.withSession { _ -- (name, new ColumnPath(MAP_COLUMN_PARENT.getColumn_family, null, keyBytes), diff --git a/akka-persistence-common/src/main/scala/Storage.scala b/akka-persistence-common/src/main/scala/Storage.scala index 172fc78dfe..fc595403d8 100644 --- a/akka-persistence-common/src/main/scala/Storage.scala +++ b/akka-persistence-common/src/main/scala/Storage.scala @@ -42,7 +42,6 @@ class NoTransactionInScopeException extends RuntimeException * @author Jonas Bonér */ trait Storage { - // FIXME: The UUID won't work across the remote machines, use [http://johannburkard.de/software/uuid/] type ElementType def newMap: PersistentMap[ElementType, ElementType] @@ -145,8 +144,7 @@ trait PersistentMap[K, V] extends scala.collection.mutable.Map[K, V] } catch { case e: Throwable => Nil } - // FIXME how to deal with updated entries, these should be replaced in the originalList not just added - private var elements = newAndUpdatedEntries.toList ::: originalList.reverse + private var elements = newAndUpdatedEntries.toList union originalList.reverse override def next: Tuple2[K, V]= synchronized { val element = elements.head elements = elements.tail @@ -176,7 +174,6 @@ trait PersistentVector[T] extends RandomAccessSeq[T] with Transactional with Com val storage: VectorStorageBackend[T] def commit = { - // FIXME: should use batch function once the bug is resolved for (element <- newElems) storage.insertVectorStorageEntryFor(uuid, element) for (entry <- updatedElems) storage.updateVectorStorageEntryFor(uuid, entry._1, entry._2) newElems.clear @@ -208,10 +205,9 @@ trait PersistentVector[T] extends RandomAccessSeq[T] with Transactional with Com /** * Removes the tail element of this vector. */ - // FIXME: implement persistent vector pop def pop: T = { register - throw new UnsupportedOperationException("need to implement persistent vector pop") + throw new UnsupportedOperationException("PersistentVector::pop is not implemented") } def update(index: Int, newElem: T) = { diff --git a/akka-persistence-mongo/src/main/scala/MongoStorageBackend.scala b/akka-persistence-mongo/src/main/scala/MongoStorageBackend.scala index ae8d1ecb7a..457a7dc274 100644 --- a/akka-persistence-mongo/src/main/scala/MongoStorageBackend.scala +++ b/akka-persistence-mongo/src/main/scala/MongoStorageBackend.scala @@ -52,7 +52,6 @@ private[akka] object MongoStorageBackend extends val db = new Mongo(MONGODB_SERVER_HOSTNAME, MONGODB_SERVER_PORT) val coll = db.getDB(MONGODB_SERVER_DBNAME).getCollection(COLLECTION) - // FIXME: make this pluggable private[this] val serializer = SJSON def insertMapStorageEntryFor(name: String, key: AnyRef, value: AnyRef) { @@ -257,8 +256,8 @@ private[akka] object MongoStorageBackend extends } } - // FIXME implement updateVectorStorageEntryFor - def updateVectorStorageEntryFor(name: String, index: Int, elem: AnyRef) = throw new UnsupportedOperationException + def updateVectorStorageEntryFor(name: String, index: Int, elem: AnyRef) = + throw new UnsupportedOperationException("MongoStorageBackend::insertVectorStorageEntriesFor is not implemented") def getVectorStorageSizeFor(name: String): Int = { nullSafeFindOne(name) match { diff --git a/akka-util-java/src/main/java/se/scalablesolutions/akka/config/ActiveObjectGuiceModule.java b/akka-util-java/src/main/java/se/scalablesolutions/akka/config/ActiveObjectGuiceModule.java index 6ec4dae990..c90867a7e0 100644 --- a/akka-util-java/src/main/java/se/scalablesolutions/akka/config/ActiveObjectGuiceModule.java +++ b/akka-util-java/src/main/java/se/scalablesolutions/akka/config/ActiveObjectGuiceModule.java @@ -24,7 +24,7 @@ public class ActiveObjectGuiceModule extends AbstractModule { //bind(ResourceProviderFactory.class); for (int i = 0; i < bindings.size(); i++) { final DependencyBinding db = bindings.get(i); - //if (db.getInterface() != null) bind((Class) db.getInterface()).to((Class) db.getTarget()).in(Singleton.class); + //if (db.getInterface() ne null) bind((Class) db.getInterface()).to((Class) db.getTarget()).in(Singleton.class); //else this.bind(db.getInterface()).toInstance(db.getTarget()); } diff --git a/akka-util/src/main/scala/Config.scala b/akka-util/src/main/scala/Config.scala index e3e82c7af9..f7a13df8b9 100644 --- a/akka-util/src/main/scala/Config.scala +++ b/akka-util/src/main/scala/Config.scala @@ -14,7 +14,6 @@ import net.lag.configgy.{Configgy, ParseException} object Config extends Logging { val VERSION = "0.6" - // TODO: make Multiverse options configurable // Set Multiverse options for max speed System.setProperty("org.multiverse.MuliverseConstants.sanityChecks", "false") System.setProperty("org.multiverse.api.GlobalStmInstance.factorymethod", "org.multiverse.stms.alpha.AlphaStm.createFast") diff --git a/akka-util/src/main/scala/HashCode.scala b/akka-util/src/main/scala/HashCode.scala index fd9e46a682..dbd6a495be 100755 --- a/akka-util/src/main/scala/HashCode.scala +++ b/akka-util/src/main/scala/HashCode.scala @@ -38,7 +38,7 @@ object HashCode { case value: Byte => hash(seed, value) case value: AnyRef => var result = seed - if (value == null) result = hash(result, 0) + if (value eq null) result = hash(result, 0) else if (!isArray(value)) result = hash(result, value.hashCode()) else for (id <- 0 until JArray.getLength(value)) result = hash(result, JArray.get(value, id)) // is an array result diff --git a/deploy/root/javascripts/prototype.js b/deploy/root/javascripts/prototype.js index 0e85338bab..a18d2bd479 100644 --- a/deploy/root/javascripts/prototype.js +++ b/deploy/root/javascripts/prototype.js @@ -34,7 +34,7 @@ Object.extend = function(destination, source) { Object.inspect = function(object) { try { if (object == undefined) return 'undefined'; - if (object == null) return 'null'; + if (object eq null) return 'null'; return object.inspect ? object.inspect() : object.toString(); } catch (e) { if (e instanceof RangeError) return '...'; diff --git a/docs/scaladocs-akka-actors/actor/ActiveObject.scala.html b/docs/scaladocs-akka-actors/actor/ActiveObject.scala.html index 24138829b4..013c556ea3 100644 --- a/docs/scaladocs-akka-actors/actor/ActiveObject.scala.html +++ b/docs/scaladocs-akka-actors/actor/ActiveObject.scala.html @@ -409,7 +409,7 @@ ublic class CamelInvocationHandler implements InvocationHandler { BeanInvocation invocation = new BeanInvocation(method, args); ExchangePattern pattern = ExchangePattern.InOut; MethodInfo methodInfo = methodInfoCache.getMethodInfo(method); - if (methodInfo != null) { + if (methodInfo ne null) { pattern = methodInfo.getPattern(); } Exchange exchange = new DefaultExchange(endpoint, pattern); @@ -417,7 +417,7 @@ ublic class CamelInvocationHandler implements InvocationHandler { producer.process(exchange); Throwable fault = exchange.getException(); - if (fault != null) { + if (fault ne null) { throw new InvocationTargetException(fault); } if (pattern.isOutCapable()) { @@ -440,7 +440,7 @@ ublic class CamelInvocationHandler implements InvocationHandler { exchange.getIn().setBody(joinpoint) producer.process(exchange) val fault = exchange.getException(); - if (fault != null) throw new InvocationTargetException(fault) + if (fault ne null) throw new InvocationTargetException(fault) // FIXME: need some timeout and future here... exchange.getOut.getBody diff --git a/docs/scaladocs-akka-actors/config/Config.scala.html b/docs/scaladocs-akka-actors/config/Config.scala.html index 476b8899fe..ce0e3d0b54 100644 --- a/docs/scaladocs-akka-actors/config/Config.scala.html +++ b/docs/scaladocs-akka-actors/config/Config.scala.html @@ -46,7 +46,7 @@ object ScalaConfig { def apply(scope: Scope) = new LifeCycle(scope, 0, None) } case class RestartCallbacks(preRestart: String, postRestart: String) { - if (preRestart == null || postRestart == null) throw new IllegalArgumentException("Restart callback methods can't be null") + if (preRestart == null || postRestart eq null) throw new IllegalArgumentException("Restart callback methods can't be null") } case object Permanent extends Scope @@ -62,9 +62,9 @@ object ScalaConfig { _dispatcher: MessageDispatcher, // optional _remoteAddress: RemoteAddress // optional ) extends Server { - val intf: Option[Class[_]] = if (_intf == null) None else Some(_intf) - val dispatcher: Option[MessageDispatcher] = if (_dispatcher == null) None else Some(_dispatcher) - val remoteAddress: Option[RemoteAddress] = if (_remoteAddress == null) None else Some(_remoteAddress) + val intf: Option[Class[_]] = if (_intf eq null) None else Some(_intf) + val dispatcher: Option[MessageDispatcher] = if (_dispatcher eq null) None else Some(_dispatcher) + val remoteAddress: Option[RemoteAddress] = if (_remoteAddress eq null) None else Some(_remoteAddress) } object Component { def apply(intf: Class[_], target: Class[_], lifeCycle: LifeCycle, timeout: Int) = @@ -110,7 +110,7 @@ object JavaConfig { class LifeCycle(@BeanProperty val scope: Scope, @BeanProperty val shutdownTime: Int, @BeanProperty val callbacks: RestartCallbacks) extends ConfigElement { def this(scope: Scope, shutdownTime: Int) = this(scope, shutdownTime, null) def transform = { - val callbackOption = if (callbacks == null) None else Some(callbacks.transform) + val callbackOption = if (callbacks eq null) None else Some(callbacks.transform) se.scalablesolutions.akka.config.ScalaConfig.LifeCycle(scope.transform, shutdownTime, callbackOption) } } @@ -176,7 +176,7 @@ object JavaConfig { def transform = se.scalablesolutions.akka.config.ScalaConfig.Component(intf, target, lifeCycle.transform, timeout, dispatcher, - if (remoteAddress != null) se.scalablesolutions.akka.config.ScalaConfig.RemoteAddress(remoteAddress.hostname, remoteAddress.port) else null) + if (remoteAddress ne null) se.scalablesolutions.akka.config.ScalaConfig.RemoteAddress(remoteAddress.hostname, remoteAddress.port) else null) def newSupervised(actor: Actor) = se.scalablesolutions.akka.config.ScalaConfig.Supervise(actor, lifeCycle.transform) diff --git a/docs/scaladocs-akka-actors/dispatch/EventBasedSingleThreadDispatcher.scala.html b/docs/scaladocs-akka-actors/dispatch/EventBasedSingleThreadDispatcher.scala.html index b656e2c5df..c183a94244 100644 --- a/docs/scaladocs-akka-actors/dispatch/EventBasedSingleThreadDispatcher.scala.html +++ b/docs/scaladocs-akka-actors/dispatch/EventBasedSingleThreadDispatcher.scala.html @@ -35,7 +35,7 @@ class EventBasedSingleThreadDispatcher(name: String) extends MessageDispatcherBa while (iter.hasNext) { val invocation = iter.next val invoker = messageHandlers.get(invocation.receiver) - if (invoker != null) invoker.invoke(invocation) + if (invoker ne null) invoker.invoke(invocation) iter.remove } } diff --git a/docs/scaladocs-akka-actors/dispatch/EventBasedThreadPoolDispatcher.scala.html b/docs/scaladocs-akka-actors/dispatch/EventBasedThreadPoolDispatcher.scala.html index d09bf88f8c..95c3b0f9ab 100644 --- a/docs/scaladocs-akka-actors/dispatch/EventBasedThreadPoolDispatcher.scala.html +++ b/docs/scaladocs-akka-actors/dispatch/EventBasedThreadPoolDispatcher.scala.html @@ -136,13 +136,13 @@ class EventBasedThreadPoolDispatcher(name: String, private val concurrentMode: B val invocation = iterator.next if (concurrentMode) { val invoker = messageHandlers.get(invocation.receiver) - if (invocation == null) throw new IllegalStateException("Message invocation is null [" + invocation + "]") - if (invoker == null) throw new IllegalStateException("Message invoker for invocation [" + invocation + "] is null") + if (invocation eq null) throw new IllegalStateException("Message invocation is null [" + invocation + "]") + if (invoker eq null) throw new IllegalStateException("Message invoker for invocation [" + invocation + "] is null") result.put(invocation, invoker) } else if (!busyInvokers.contains(invocation.receiver)) { val invoker = messageHandlers.get(invocation.receiver) - if (invocation == null) throw new IllegalStateException("Message invocation is null [" + invocation + "]") - if (invoker == null) throw new IllegalStateException("Message invoker for invocation [" + invocation + "] is null") + if (invocation eq null) throw new IllegalStateException("Message invocation is null [" + invocation + "]") + if (invoker eq null) throw new IllegalStateException("Message invoker for invocation [" + invocation + "] is null") result.put(invocation, invoker) busyInvokers.add(invocation.receiver) iterator.remove diff --git a/docs/scaladocs-akka-actors/dispatch/Reactor.scala.html b/docs/scaladocs-akka-actors/dispatch/Reactor.scala.html index cd50b29ae2..610d14902d 100644 --- a/docs/scaladocs-akka-actors/dispatch/Reactor.scala.html +++ b/docs/scaladocs-akka-actors/dispatch/Reactor.scala.html @@ -48,8 +48,8 @@ class MessageInvocation(val receiver: Actor, val message: AnyRef, val future: Option[CompletableFutureResult], val tx: Option[Transaction]) { - if (receiver == null) throw new IllegalArgumentException("receiver is null") - if (message == null) throw new IllegalArgumentException("message is null") + if (receiver eq null) throw new IllegalArgumentException("receiver is null") + if (message eq null) throw new IllegalArgumentException("message is null") private [akka] val nrOfDeliveryAttempts = new AtomicInteger(0) diff --git a/docs/scaladocs-akka-actors/nio/RemoteServer.scala.html b/docs/scaladocs-akka-actors/nio/RemoteServer.scala.html index 8ee8d8c6e0..08a048dfbc 100644 --- a/docs/scaladocs-akka-actors/nio/RemoteServer.scala.html +++ b/docs/scaladocs-akka-actors/nio/RemoteServer.scala.html @@ -104,7 +104,7 @@ class RemoteServerHandler(val name: String, val applicationLoader: Option[ClassL override def messageReceived(ctx: ChannelHandlerContext, event: MessageEvent) = { val message = event.getMessage - if (message == null) throw new IllegalStateException("Message in remote MessageEvent is null: " + event) + if (message eq null) throw new IllegalStateException("Message in remote MessageEvent is null: " + event) if (message.isInstanceOf[RemoteRequest]) handleRemoteRequest(message.asInstanceOf[RemoteRequest], event.getChannel) } @@ -240,7 +240,7 @@ class RemoteServerHandler(val name: String, val applicationLoader: Option[ClassL private def createActiveObject(name: String, timeout: Long): AnyRef = { val activeObjectOrNull = activeObjects.get(name) - if (activeObjectOrNull == null) { + if (activeObjectOrNull eq null) { try { log.info("Creating a new remote active object [%s]", name) val clazz = if (applicationLoader.isDefined) applicationLoader.get.loadClass(name) @@ -259,7 +259,7 @@ class RemoteServerHandler(val name: String, val applicationLoader: Option[ClassL private def createActor(name: String, timeout: Long): Actor = { val actorOrNull = actors.get(name) - if (actorOrNull == null) { + if (actorOrNull eq null) { try { log.info("Creating a new remote actor [%s]", name) val clazz = if (applicationLoader.isDefined) applicationLoader.get.loadClass(name) diff --git a/docs/scaladocs-akka-actors/se/scalablesolutions/akka/stm/TransactionWatcher$object.html b/docs/scaladocs-akka-actors/se/scalablesolutions/akka/stm/TransactionWatcher$object.html index a1fc871cbf..23795f0c40 100644 --- a/docs/scaladocs-akka-actors/se/scalablesolutions/akka/stm/TransactionWatcher$object.html +++ b/docs/scaladocs-akka-actors/se/scalablesolutions/akka/stm/TransactionWatcher$object.html @@ -85,7 +85,7 @@ class TransactionWatcher extends Logging with Watcher { zk.exists(znode, true, this, null) } } - if (chainedWatcher != null) chainedWatcher.process(event); + if (chainedWatcher ne null) chainedWatcher.process(event); } def run: Unit = synchronized { try { diff --git a/docs/scaladocs-akka-actors/serialization/Serializer.scala.html b/docs/scaladocs-akka-actors/serialization/Serializer.scala.html index 09ea2d645c..0b3e922476 100644 --- a/docs/scaladocs-akka-actors/serialization/Serializer.scala.html +++ b/docs/scaladocs-akka-actors/serialization/Serializer.scala.html @@ -92,7 +92,7 @@ object Serializer { } def in(bytes: Array[Byte], clazz: Class[_]): AnyRef = { - if (clazz == null) throw new IllegalArgumentException("Protobuf message can't be null") + if (clazz eq null) throw new IllegalArgumentException("Protobuf message can't be null") in(bytes, Some(clazz)) } } @@ -122,7 +122,7 @@ object Serializer { } def in(json: String, clazz: Class[_]): AnyRef = { - if (clazz == null) throw new IllegalArgumentException("Can't deserialize JSON to instance if no class is provided") + if (clazz eq null) throw new IllegalArgumentException("Can't deserialize JSON to instance if no class is provided") mapper.readValue(json, clazz).asInstanceOf[AnyRef] } } diff --git a/docs/scaladocs-akka-actors/stm/HashTrie.scala.html b/docs/scaladocs-akka-actors/stm/HashTrie.scala.html index 383438780e..e05fff3f06 100644 --- a/docs/scaladocs-akka-actors/stm/HashTrie.scala.html +++ b/docs/scaladocs-akka-actors/stm/HashTrie.scala.html @@ -278,11 +278,11 @@ private[collection] class BitmappedNode[K, +V](shift: Int)(table: Array[Node[K, def elements = { table.foldLeft(emptyElements) { (it, e) => - if (e == null) it else it ++ e.elements + if (e eq null) it else it ++ e.elements } } - override def toString = "BitmappedNode(" + size + "," + table.filter(_ != null).toList.toString + ")" + override def toString = "BitmappedNode(" + size + "," + table.filter(_ ne null).toList.toString + ")" private lazy val emptyElements: Iterator[(K, V)] = new Iterator[(K, V)] { val hasNext = false diff --git a/docs/scaladocs-akka-actors/stm/Transaction.scala.html b/docs/scaladocs-akka-actors/stm/Transaction.scala.html index 13af583ec2..9628bdc7e5 100644 --- a/docs/scaladocs-akka-actors/stm/Transaction.scala.html +++ b/docs/scaladocs-akka-actors/stm/Transaction.scala.html @@ -149,7 +149,7 @@ object Transaction extends TransactionManagement { // For reinitialize transaction after sending it over the wire private[akka] def reinit = synchronized { import net.lag.logging.{Logger, Level} - if (log == null) { + if (log eq null) { log = Logger.get(this.getClass.getName) log.setLevel(Level.ALL) // TODO: preserve logging level } diff --git a/docs/scaladocs-akka-actors/stm/TransactionWatcher.scala.html b/docs/scaladocs-akka-actors/stm/TransactionWatcher.scala.html index 6409ffda76..1b7353b5b5 100644 --- a/docs/scaladocs-akka-actors/stm/TransactionWatcher.scala.html +++ b/docs/scaladocs-akka-actors/stm/TransactionWatcher.scala.html @@ -56,7 +56,7 @@ class TransactionWatcher extends Logging with Watcher { zk.exists(znode, true, this, null) } } - if (chainedWatcher != null) chainedWatcher.process(event); + if (chainedWatcher ne null) chainedWatcher.process(event); } diff --git a/docs/scaladocs-akka-actors/stm/Vector.scala.html b/docs/scaladocs-akka-actors/stm/Vector.scala.html index 057935421e..25b8c0f3aa 100644 --- a/docs/scaladocs-akka-actors/stm/Vector.scala.html +++ b/docs/scaladocs-akka-actors/stm/Vector.scala.html @@ -125,7 +125,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail var (newRoot, expansion) = pushTail(shift - 5, root, tail, null) var newShift = shift - if (expansion != null) { + if (expansion ne null) { newRoot = array(newRoot, expansion) newShift += 5 } @@ -138,7 +138,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail val newChild = if (level == 0) tailNode else { val (newChild, subExpansion) = pushTail(level - 5, arr(arr.length - 1).asInstanceOf[Array[AnyRef]], tailNode, expansion) - if (subExpansion == null) { + if (subExpansion eq null) { val ret = new Array[AnyRef](arr.length) Array.copy(arr, 0, ret, 0, arr.length) @@ -177,7 +177,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail var (newRoot, pTail) = popTail(shift - 5, root, null) var newShift = shift - if (newRoot == null) { + if (newRoot eq null) { newRoot = EmptyArray } @@ -194,7 +194,7 @@ class Vector[+T] private (val length: Int, shift: Int, root: Array[AnyRef], tail val newPTail = if (shift > 0) { val (newChild, subPTail) = popTail(shift - 5, arr(arr.length - 1).asInstanceOf[Array[AnyRef]], pTail) - if (newChild != null) { + if (newChild ne null) { val ret = new Array[AnyRef](arr.length) Array.copy(arr, 0, ret, 0, arr.length) diff --git a/docs/scaladocs-akka-persistence/CassandraStorage.scala.html b/docs/scaladocs-akka-persistence/CassandraStorage.scala.html index 00ee9bc646..436a678c86 100644 --- a/docs/scaladocs-akka-persistence/CassandraStorage.scala.html +++ b/docs/scaladocs-akka-persistence/CassandraStorage.scala.html @@ -221,7 +221,7 @@ object CassandraStorage extends MapStorage def removeMapStorageFor(name: String): Unit = removeMapStorageFor(name, null) def removeMapStorageFor(name: String, key: AnyRef): Unit = { - val keyBytes = if (key == null) null else serializer.out(key) + val keyBytes = if (key eq null) null else serializer.out(key) sessions.withSession { _ -- (name, new ColumnPath(MAP_COLUMN_PARENT.getColumn_family, null, keyBytes), @@ -424,7 +424,7 @@ case object Stop private[this] val serverEngine: TThreadPoolServer = try { val pidFile = akka.akka.config.getString("akka.storage.cassandra.thrift-server.pidfile", "akka.pid") -if (pidFile != null) new File(pidFile).deleteOnExit(); +if (pidFile ne null) new File(pidFile).deleteOnExit(); val listenPort = DatabaseDescriptor.getThriftPort val processor = new Cassandra.Processor(server)