Author: stevel
Date: Wed May 27 11:05:48 2009
New Revision: 779109

URL: http://svn.apache.org/viewvc?rev=779109&view=rev
Log:
HADOOP-3628 some changes to utility and http classes

Modified:
    
hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/http/HttpServer.java
    
hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java

Modified: 
hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/http/HttpServer.java
URL: 
http://svn.apache.org/viewvc/hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/http/HttpServer.java?rev=779109&r1=779108&r2=779109&view=diff
==============================================================================
--- 
hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/http/HttpServer.java
 (original)
+++ 
hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/http/HttpServer.java
 Wed May 27 11:05:48 2009
@@ -22,6 +22,7 @@
 import java.net.BindException;
 import java.net.InetSocketAddress;
 import java.net.URL;
+import java.net.BindException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -468,7 +469,11 @@
           // then try the next port number.
           if (ex instanceof BindException) {
             if (!findPort) {
-              throw (BindException) ex;
+              BindException be = new BindException(
+                      "Port in use: " + listener.getHost()
+                              + ":" + listener.getPort());
+              be.initCause(ex);
+              throw be;
             }
           } else {
             LOG.info("HttpServer.start() threw a non Bind IOException"); 
@@ -500,6 +505,14 @@
   }
 
   /**
+   * Test for the availability of the web server
+   * @return true if the web server is started, false otherwise
+   */
+  public boolean isAlive() {
+    return webServer.isStarted();
+  }
+
+  /**
    * A very simple servlet to serve up a text representation of the current
    * stack traces. It both returns the stacks to the caller and logs them.
    * Currently the stack traces are done sequentially rather than exactly the

Modified: 
hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java
URL: 
http://svn.apache.org/viewvc/hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java?rev=779109&r1=779108&r2=779109&view=diff
==============================================================================
--- 
hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java
 (original)
+++ 
hadoop/core/branches/HADOOP-3628-2/src/core/org/apache/hadoop/security/authorize/ConfiguredPolicy.java
 Wed May 27 11:05:48 2009
@@ -22,6 +22,8 @@
 import java.security.Policy;
 import java.security.Principal;
 import java.security.ProtectionDomain;
+import java.security.CodeSource;
+import java.security.Permissions;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -77,7 +79,20 @@
     return super.implies(domain, permission);
   }
 
+  /**
+   * {...@inheritdoc}
+   * @return a writable permission collection
+   */
   @Override
+  public PermissionCollection getPermissions(CodeSource codesource) {
+    return new Permissions();
+  }
+
+/**
+ * {...@inheritdoc}
+ * @return a writable permission collection
+ */
+...@override
   public PermissionCollection getPermissions(ProtectionDomain domain) {
     PermissionCollection permissionCollection = super.getPermissions(domain);
     for (Principal principal : domain.getPrincipals()) {
@@ -153,4 +168,14 @@
       LOG.debug("Policy - Adding  " + permission + " to " + principal);
     }
   }
+
+  /**
+   * For debugging: identify ourselves and the policyproviders 
+   *
+   * @return a string representation of the object.
+   */
+  @Override
+  public String toString() {
+    return "Hadoop ConfiguredPolicy " + super.toString() + " Policy provider 
"+ policyProvider;
+  }
 }


Reply via email to