fixed misc FIXMEs and TODOs

This commit is contained in:
Jonas Bonér 2009-12-27 08:24:11 +01:00
parent be00b09f75
commit b36bacb005
49 changed files with 95 additions and 242 deletions

View file

@ -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

View file

@ -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) {

View file

@ -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))

View file

@ -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")

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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 {

View file

@ -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
}
}

View file

@ -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() {

View file

@ -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

View file

@ -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 <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
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)
}
}
}

View file

@ -23,6 +23,15 @@ 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 <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
@ -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)

View file

@ -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)

View file

@ -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
}
}
*/

View file

@ -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

View file

@ -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]
}
}

View file

@ -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

View file

@ -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
}

View file

@ -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);
}

View file

@ -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)

View file

@ -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)
}
}

View file

@ -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)

View file

@ -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)

View file

@ -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) {}
}
}
*/

View file

@ -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) {}
}
}

View file

@ -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)

View file

@ -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 .
*/

View file

@ -21,7 +21,6 @@ object Main {
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
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 = {

View file

@ -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),

View file

@ -42,7 +42,6 @@ class NoTransactionInScopeException extends RuntimeException
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
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 <i>tail</i> 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) = {

View file

@ -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 {

View file

@ -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());
}

View file

@ -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")

View file

@ -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

View file

@ -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 '...';

View file

@ -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

View file

@ -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)

View file

@ -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
}
}

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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 {

View file

@ -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]
}
}

View file

@ -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

View file

@ -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
}

View file

@ -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);
}

View file

@ -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)

View file

@ -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)