Author: jbellis
Date: Fri Dec 11 17:08:48 2009
New Revision: 889703

URL: http://svn.apache.org/viewvc?rev=889703&view=rev
Log:
move log4j initialization into Daemon and do it earlier.  patch by jbellis

Modified:
    
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java
    
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java

Modified: 
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java
URL: 
http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java?rev=889703&r1=889702&r2=889703&view=diff
==============================================================================
--- 
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java
 (original)
+++ 
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java
 Fri Dec 11 17:08:48 2009
@@ -24,6 +24,7 @@
 import java.net.InetAddress;
 
 import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
 
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocolFactory;
@@ -54,6 +55,10 @@
 
     private void setup() throws IOException, TTransportException
     {
+        // log4j
+        String file = System.getProperty("storage-config") + File.separator + 
"log4j.properties";
+        PropertyConfigurator.configure(file);
+
         int listenPort = DatabaseDescriptor.getThriftPort();
         InetAddress listenAddr = DatabaseDescriptor.getThriftAddress();
         
@@ -87,12 +92,12 @@
 
         // replay the log if necessary
         RecoveryManager recoveryMgr = RecoveryManager.instance();
-        recoveryMgr.doRecovery();
+        RecoveryManager.doRecovery();
 
         // now we start listening for clients
-        CassandraServer peerStorageServer = new CassandraServer();
-        peerStorageServer.start();
-        Cassandra.Processor processor = new 
Cassandra.Processor(peerStorageServer);
+        CassandraServer cassandraServer = new CassandraServer();
+        StorageService.instance().initServer();
+        Cassandra.Processor processor = new 
Cassandra.Processor(cassandraServer);
 
         // Transport
         TServerSocket tServerSocket = new TServerSocket(new 
InetSocketAddress(listenAddr, listenPort));

Modified: 
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
URL: 
http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java?rev=889703&r1=889702&r2=889703&view=diff
==============================================================================
--- 
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
 (original)
+++ 
incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
 Fri Dec 11 17:08:48 2009
@@ -52,33 +52,17 @@
       * Handle to the storage service to interact with the other machines in 
the
       * cluster.
       */
-       protected StorageService storageService;
+       private final StorageService storageService;
 
     public CassandraServer()
        {
                storageService = StorageService.instance();
        }
 
-       /*
-        * The start function initializes the server and start's listening on 
the
-        * specified port.
-        */
-       public void start() throws IOException
-    {
-        // log4j
-        String file = System.getProperty("storage-config") + File.separator + 
"log4j.properties";
-        PropertyConfigurator.configure(file);
-
-        // Start the storage service
-               storageService.initServer();
-       }
-
     protected Map<String, ColumnFamily> readColumnFamily(List<ReadCommand> 
commands, int consistency_level)
     throws InvalidRequestException, UnavailableException, TimedOutException
     {
         // TODO - Support multiple column families per row, right now row only 
contains 1 column family
-        String cfName = commands.get(0).getColumnFamilyName();
-
         Map<String, ColumnFamily> columnFamilyKeyMap = new 
HashMap<String,ColumnFamily>();
 
         if (consistency_level == ConsistencyLevel.ZERO)


Reply via email to