fixed misc FIXMEs and TODOs
This commit is contained in:
parent
be00b09f75
commit
b36bacb005
49 changed files with 95 additions and 242 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue