You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ab...@apache.org on 2006/03/07 21:56:43 UTC

svn commit: r384008 - /lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java

Author: ab
Date: Tue Mar  7 12:56:41 2006
New Revision: 384008

URL: http://svn.apache.org/viewcvs?rev=384008&view=rev
Log:
Apply local Configuration to parameters received via RPC if they
implement Configurable. Fix by Marko Bauhardt.

Note: in the future there may be protocols that assume
different local and remote Configuration. However, with the
current RPC implementation we don't support it anyway, and for
now it seems better that parameters implementing Configurable
should be provided with non-null Configuration.

Modified:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java
URL: http://svn.apache.org/viewcvs/lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java?rev=384008&r1=384007&r2=384008&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java Tue Mar  7 12:56:41 2006
@@ -33,6 +33,7 @@
 import java.util.logging.Level;
 
 import org.apache.hadoop.util.LogFormatter;
+import org.apache.hadoop.conf.Configurable;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.UTF8;
@@ -52,6 +53,7 @@
   private int handlerCount;                       // number of handler threads
   private int maxQueuedCalls;                     // max number of queued calls
   private Class paramClass;                       // class of call parameters
+  private Configuration conf;
 
   private int timeout;
 
@@ -229,6 +231,7 @@
    * the number of handler threads that will be used to process calls.
    */
   protected Server(int port, Class paramClass, int handlerCount, Configuration conf) {
+    this.conf = conf;
     this.port = port;
     this.paramClass = paramClass;
     this.handlerCount = handlerCount;
@@ -280,6 +283,9 @@
     Writable param;                               // construct param
     try {
       param = (Writable)paramClass.newInstance();
+      if (param instanceof Configurable) {
+        ((Configurable)param).setConf(conf);
+      }
     } catch (InstantiationException e) {
       throw new RuntimeException(e.toString());
     } catch (IllegalAccessException e) {