commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r923108 - in /commons/proper/daemon/trunk/src/java/org/apache/commons/daemon: Daemon.java DaemonContext.java DaemonController.java DaemonListener.java DaemonPermission.java support/DaemonLoader.java
Date Mon, 15 Mar 2010 08:09:26 GMT
Author: mturk
Date: Mon Mar 15 08:09:26 2010
New Revision: 923108

URL: http://svn.apache.org/viewvc?rev=923108&view=rev
Log:
Run the code trough indent. No functional change

Modified:
    commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/Daemon.java
    commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonContext.java
    commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonController.java
    commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonListener.java
    commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonPermission.java
    commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/support/DaemonLoader.java

Modified: commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/Daemon.java
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/Daemon.java?rev=923108&r1=923107&r2=923108&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/Daemon.java (original)
+++ commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/Daemon.java Mon Mar 15
08:09:26 2010
@@ -31,7 +31,8 @@ package org.apache.commons.daemon;
  * @author Pier Fumagalli
  * @version 1.0 <i>(CVS $Revision$)</i>
  */
-public interface Daemon {
+public interface Daemon
+{
 
     /**
      * Initialize this <code>Daemon</code> instance.
@@ -62,12 +63,12 @@ public interface Daemon {
      *
      * @param context A <code>DaemonContext</code> object used to
      * communicate with the container.
-     * 
+     *
      * @exception Exception Any exception preventing a successful
      *                      initialization.
      */
     public void init(DaemonContext context)
-    throws Exception;
+        throws Exception;
 
     /**
      * Start the operation of this <code>Daemon</code> instance. This
@@ -79,7 +80,7 @@ public interface Daemon {
      * the stop()-method.
      */
     public void start()
-    throws Exception;
+        throws Exception;
 
     /**
      * Stop the operation of this <code>Daemon</code> instance. Note
@@ -89,7 +90,7 @@ public interface Daemon {
      * stop().
      */
     public void stop()
-    throws Exception;
+        throws Exception;
 
     /**
      * Free any resources allocated by this daemon such as file
@@ -100,3 +101,4 @@ public interface Daemon {
      */
     public void destroy();
 }
+

Modified: commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonContext.java
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonContext.java?rev=923108&r1=923107&r2=923108&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonContext.java (original)
+++ commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonContext.java Mon
Mar 15 08:09:26 2010
@@ -25,7 +25,8 @@ package org.apache.commons.daemon;
  * @author Pier Fumagalli
  * @version 1.0 <i>(CVS $Revision$)</i>
  */
-public interface DaemonContext {
+public interface DaemonContext
+{
 
     /**
      * Returns  <code>DaemonController</code> object that can be used
@@ -43,3 +44,4 @@ public interface DaemonContext {
     public String[] getArguments();
 
 }
+

Modified: commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonController.java
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonController.java?rev=923108&r1=923107&r2=923108&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonController.java (original)
+++ commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonController.java Mon
Mar 15 08:09:26 2010
@@ -23,42 +23,43 @@ package org.apache.commons.daemon;
  * @author Pier Fumagalli
  * @version 1.0 <i>(CVS $Revision$)</i>
  */
-public interface DaemonController {
+public interface DaemonController
+{
 
     /**
      *
      */
     public void shutdown()
-    throws IllegalStateException;
+        throws IllegalStateException;
 
     /**
      *
      */
     public void reload()
-    throws IllegalStateException;
+        throws IllegalStateException;
 
     /**
      *
      */
     public void fail()
-    throws IllegalStateException;
+        throws IllegalStateException;
 
     /**
      *
      */
     public void fail(String message)
-    throws IllegalStateException;
+        throws IllegalStateException;
 
     /**
      *
      */
     public void fail(Exception exception)
-    throws IllegalStateException;
+        throws IllegalStateException;
 
     /**
      *
      */
     public void fail(String message, Exception exception)
-    throws IllegalStateException;
+        throws IllegalStateException;
+
 
-}

Modified: commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonListener.java
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonListener.java?rev=923108&r1=923107&r2=923108&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonListener.java (original)
+++ commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonListener.java Mon
Mar 15 08:09:26 2010
@@ -19,7 +19,8 @@ package org.apache.commons.daemon;
 
 import java.util.EventListener;
 
-public interface DaemonListener extends EventListener {
+public interface DaemonListener extends EventListener
+{
 
 }
 

Modified: commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonPermission.java
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonPermission.java?rev=923108&r1=923107&r2=923108&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonPermission.java (original)
+++ commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/DaemonPermission.java Mon
Mar 15 08:09:26 2010
@@ -85,10 +85,12 @@ import java.util.StringTokenizer;
  * @author Pier Fumagalli
  * @version 1.0 <i>(CVS $Revision$)</i>
  */
-public final class DaemonPermission extends Permission {
+public final class DaemonPermission extends Permission
+{
 
-    /* ==================================================================== */
-    /* Constants. */
+    /* ====================================================================
+     * Constants.
+     */
 
     /**
      * The target name when associated with control actions
@@ -155,8 +157,9 @@ public final class DaemonPermission exte
      */
     protected static final String WILDCARD = "*";
 
-    /* ==================================================================== */
-    /* Instance variables */
+    /* ====================================================================
+     * Instance variables
+     */
 
     /** The type of this permission object. */
     private transient int type = 0;
@@ -165,8 +168,9 @@ public final class DaemonPermission exte
     /** The String representation of this permission object. */
     private transient String desc = null;
 
-    /* ==================================================================== */
-    /* Constructors */
+    /* ====================================================================
+     * Constructors
+     */
 
     /**
      * Create a new <code>DaemonPermission</code> instance with a specified
@@ -179,24 +183,25 @@ public final class DaemonPermission exte
      * @exception IllegalArgumentException If the specified target name is not
      *                supported.
      */
-    public DaemonPermission (String target)
-    throws IllegalArgumentException {
+    public DaemonPermission(String target)
+        throws IllegalArgumentException
+    {
         // Setup the target name of this permission object.
         super(target);
 
         // Check if the permission target name was specified
-        if (target==null)
+        if (target == null)
             throw new IllegalArgumentException("Null permission name");
 
         // Check if this is a "control" permission and set up accordingly.
         if (CONTROL.equalsIgnoreCase(target)) {
-            type=TYPE_CONTROL;
+            type = TYPE_CONTROL;
             return;
         }
 
         // If we got here, we have an invalid permission name.
-        throw new IllegalArgumentException("Invalid permission name \""+
-                                           target+"\" specified");
+        throw new IllegalArgumentException("Invalid permission name \"" +
+                                           target + "\" specified");
     }
 
     /**
@@ -212,19 +217,21 @@ public final class DaemonPermission exte
      *                invalid value.
      */
     public DaemonPermission(String target, String actions)
-    throws IllegalArgumentException {
+        throws IllegalArgumentException
+    {
         // Setup this instance's target name.
         this(target);
 
         // Create the appropriate mask if this is a control permission.
-        if (this.type==TYPE_CONTROL) {
-            this.mask=this.createControlMask(actions);
+        if (this.type == TYPE_CONTROL) {
+            this.mask = this.createControlMask(actions);
             return;
         }
     }
 
-    /* ==================================================================== */
-    /* Public methods */
+    /* ====================================================================
+     * Public methods
+     */
 
     /**
      * Return the list of actions permitted by this instance of
@@ -232,11 +239,12 @@ public final class DaemonPermission exte
      *
      * @return The canonicalized list of actions.
      */
-    public String getActions() {
-        if (this.type==TYPE_CONTROL) {
-            return(this.createControlActions(this.mask));
+    public String getActions()
+    {
+        if (this.type == TYPE_CONTROL) {
+            return this.createControlActions(this.mask);
         }
-        return("");
+        return "";
     }
 
     /**
@@ -244,9 +252,10 @@ public final class DaemonPermission exte
      *
      * @return An hash code value.
      */
-    public int hashCode() {
+    public int hashCode()
+    {
         this.setupDescription();
-        return(this.desc.hashCode());
+        return this.desc.hashCode();
     }
 
     /**
@@ -255,15 +264,19 @@ public final class DaemonPermission exte
      * @return <b>true</b> or <b>false</b> wether the specified object
equals
      *         this <code>DaemonPermission</code> instance or not.
      */
-    public boolean equals(Object object) {
-        if (object == this) return(true);
-
-        if (!(object instanceof DaemonPermission)) return false;
-
-        DaemonPermission that = (DaemonPermission)object;
-
-        if (this.type!=that.type) return(false);
-        return(this.mask==that.mask);
+    public boolean equals(Object object)
+    {
+        if (object == this)
+            return true;
+
+        if (!(object instanceof DaemonPermission))
+            return false;
+
+        DaemonPermission that = (DaemonPermission) object;
+
+        if (this.type != that.type)
+            return false;
+        return this.mask == that.mask;
     }
 
     /**
@@ -274,15 +287,19 @@ public final class DaemonPermission exte
      *         is implied by this <code>DaemonPermission</code> instance or
      *         not.
      */
-    public boolean implies(Permission permission) {
-        if (permission == this) return(true);
-
-        if (!(permission instanceof DaemonPermission)) return false;
-
-        DaemonPermission that = (DaemonPermission)permission;
-
-        if (this.type!=that.type) return(false);
-        return((this.mask&that.mask)==that.mask);
+    public boolean implies(Permission permission)
+    {
+        if (permission == this)
+            return true;
+
+        if (!(permission instanceof DaemonPermission))
+            return false;
+
+        DaemonPermission that = (DaemonPermission) permission;
+
+        if (this.type != that.type)
+            return false;
+        return (this.mask & that.mask) == that.mask;
     }
 
     /**
@@ -291,95 +308,115 @@ public final class DaemonPermission exte
      * @return A <code>String</code> representing this
      *         <code>DaemonPermission</code> instance.
      */
-    public String toString() {
+    public String toString()
+    {
         this.setupDescription();
-        return(new String(this.desc));
+        return new String(this.desc);
     }
 
-    /* ==================================================================== */
-    /* Private methods */
+    /* ====================================================================
+     * Private methods
+     */
 
-    /** Create a String description for this permission instance. */
-    private void setupDescription() {
-        if (this.desc!=null) return;
+    /** Create a String description for this permission instance.
+     */
+    private void setupDescription()
+    {
+        if (this.desc != null)
+            return;
 
-        StringBuffer buf=new StringBuffer();
+        StringBuffer buf = new StringBuffer();
         buf.append(this.getClass().getName());
         buf.append('[');
         switch (this.type) {
-            case (TYPE_CONTROL): {
+            case TYPE_CONTROL:
                 buf.append(CONTROL);
-                break;
-            }
-            default: {
+            break;
+            default:
                 buf.append("UNKNOWN");
-                break;
-            }
+            break;
         }
         buf.append(':');
         buf.append(this.getActions());
         buf.append(']');
 
-        this.desc=buf.toString();
+        this.desc = buf.toString();
     }
 
-    /** Create a permission mask for a given control actions string. */
+    /** Create a permission mask for a given control actions string.
+     */
     private int createControlMask(String actions)
-    throws IllegalArgumentException {
-        if (actions==null) return(0);
+        throws IllegalArgumentException
+    {
+        if (actions == null)
+            return 0;
+
+        int mask = 0;
+        StringTokenizer tok = new StringTokenizer(actions, ",", false);
 
-        int mask=0;
-        StringTokenizer tok=new StringTokenizer(actions,",",false);
         while (tok.hasMoreTokens()) {
-            String val=tok.nextToken().trim();
+            String val = tok.nextToken().trim();
 
             if (WILDCARD.equals(val)) {
-                return(MASK_CONTROL_START|MASK_CONTROL_STOP|
-                       MASK_CONTROL_SHUTDOWN|MASK_CONTROL_RELOAD);
-            } else if (CONTROL_START.equalsIgnoreCase(val)) {
-                mask=mask|MASK_CONTROL_START;
-            } else if (CONTROL_STOP.equalsIgnoreCase(val)) {
-                mask=mask|MASK_CONTROL_STOP;
-            } else if (CONTROL_SHUTDOWN.equalsIgnoreCase(val)) {
-                mask=mask|MASK_CONTROL_SHUTDOWN;
-            } else if (CONTROL_RELOAD.equalsIgnoreCase(val)) {
-                mask=mask|MASK_CONTROL_RELOAD;
-            } else {
-                throw new IllegalArgumentException("Invalid action name \""+
-                                                   val+"\" specified");
+                return MASK_CONTROL_START | MASK_CONTROL_STOP |
+                       MASK_CONTROL_SHUTDOWN | MASK_CONTROL_RELOAD;
+            }
+            else if (CONTROL_START.equalsIgnoreCase(val)) {
+                mask = mask | MASK_CONTROL_START;
+            }
+            else if (CONTROL_STOP.equalsIgnoreCase(val)) {
+                mask = mask | MASK_CONTROL_STOP;
+            }
+            else if (CONTROL_SHUTDOWN.equalsIgnoreCase(val)) {
+                mask = mask | MASK_CONTROL_SHUTDOWN;
+            }
+            else if (CONTROL_RELOAD.equalsIgnoreCase(val)) {
+                mask = mask | MASK_CONTROL_RELOAD;
+            }
+            else {
+                throw new IllegalArgumentException("Invalid action name \"" +
+                                                   val + "\" specified");
             }
         }
-        return(mask);
+        return mask;
     }
 
     /** Create a actions list for a given control permission mask. */
-    private String createControlActions(int mask) {
-        StringBuffer buf=new StringBuffer();
-        boolean sep=false;
+    private String createControlActions(int mask)
+    {
+        StringBuffer buf = new StringBuffer();
+        boolean sep = false;
 
-        if ((mask&MASK_CONTROL_START)==MASK_CONTROL_START) {
-            sep=true;
+        if ((mask & MASK_CONTROL_START) == MASK_CONTROL_START) {
+            sep = true;
             buf.append(CONTROL_START);
         }
 
-        if ((mask&MASK_CONTROL_STOP)==MASK_CONTROL_STOP) {
-            if (sep) buf.append(",");
-            else sep=true;
+        if ((mask & MASK_CONTROL_STOP) == MASK_CONTROL_STOP) {
+            if (sep)
+                buf.append(",");
+            else
+                sep = true;
             buf.append(CONTROL_STOP);
         }
 
-        if ((mask&MASK_CONTROL_SHUTDOWN)==MASK_CONTROL_SHUTDOWN) {
-            if (sep) buf.append(",");
-            else sep=true;
+        if ((mask & MASK_CONTROL_SHUTDOWN) == MASK_CONTROL_SHUTDOWN) {
+            if (sep)
+                buf.append(",");
+            else
+                sep = true;
             buf.append(CONTROL_SHUTDOWN);
         }
 
-        if ((mask&MASK_CONTROL_RELOAD)==MASK_CONTROL_RELOAD) {
-            if (sep) buf.append(",");
-            else sep=true;
+        if ((mask & MASK_CONTROL_RELOAD) == MASK_CONTROL_RELOAD) {
+            if (sep)
+                buf.append(",");
+            else
+                sep = true;
             buf.append(CONTROL_RELOAD);
         }
 
         return buf.toString();
     }
 }
+

Modified: commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/support/DaemonLoader.java
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/support/DaemonLoader.java?rev=923108&r1=923107&r2=923108&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/support/DaemonLoader.java
(original)
+++ commons/proper/daemon/trunk/src/java/org/apache/commons/daemon/support/DaemonLoader.java
Mon Mar 15 08:09:26 2010
@@ -24,252 +24,277 @@ import org.apache.commons.daemon.DaemonC
 
 import java.lang.reflect.Method;
 
-public final class DaemonLoader {
+public final class DaemonLoader
+{
 
     private static Controller controller = null;
-    private static Context context = null;
-    private static Object daemon = null;
+    private static Context context  = null;
+    private static Object daemon    = null;
     /* Methods to call */
-    private static Method init = null;
-    private static Method start = null;
-    private static Method stop = null;
-    private static Method destroy = null;
-
-    public static void version() {
-        System.err.println("java version \""+
-                           System.getProperty("java.version")+
-                           "\"");
-        System.err.println(System.getProperty("java.runtime.name")+
-                           " (build "+
-                           System.getProperty("java.runtime.version")+
-                           ")");
-        System.err.println(System.getProperty("java.vm.name")+
-                           " (build "+
-                           System.getProperty("java.vm.version")+
-                           ", "+
-                           System.getProperty("java.vm.info")+
-                           ")");
+    private static Method init      = null;
+    private static Method start     = null;
+    private static Method stop      = null;
+    private static Method destroy   = null;
+
+    public static void version()
+    {
+        System.err.println("java version \"" +
+                           System.getProperty("java.version") + "\"");
+        System.err.println(System.getProperty("java.runtime.name") +
+                           " (build " +
+                           System.getProperty("java.runtime.version") + ")");
+        System.err.println(System.getProperty("java.vm.name") +
+                           " (build " +
+                           System.getProperty("java.vm.version") +
+                           ", " + System.getProperty("java.vm.info") + ")");
     }
 
-    public static boolean check(String cn) {
+    public static boolean check(String cn)
+    {
         try {
             /* Check the class name */
-            if (cn==null)
+            if (cn == null)
                 throw new NullPointerException("Null class name specified");
 
             /* Get the ClassLoader loading this class */
-            ClassLoader cl=DaemonLoader.class.getClassLoader();
-            if (cl==null) {
+            ClassLoader cl = DaemonLoader.class.getClassLoader();
+            if (cl == null) {
                 System.err.println("Cannot retrieve ClassLoader instance");
-                return(false);
+                return false;
             }
 
             /* Find the required class */
-            Class c=cl.loadClass(cn);
+            Class c = cl.loadClass(cn);
 
             /* This should _never_ happen, but doublechecking doesn't harm */
-            if (c==null) throw new ClassNotFoundException(cn);
+            if (c == null)
+                throw new ClassNotFoundException(cn);
 
             /* Create a new instance of the daemon */
-            Object s=c.newInstance();
+            Object s = c.newInstance();
 
         } catch (Throwable t) {
             /* In case we encounter ANY error, we dump the stack trace and
-               return false (load, start and stop won't be called). */
+             * return false (load, start and stop won't be called).
+             */
             t.printStackTrace(System.err);
-            return(false);
+            return false;
         }
-        /* The class was loaded and instantiated correctly, we can return */
-        return(true);
+        /* The class was loaded and instantiated correctly, we can return
+         */
+        return true;
     }
 
-    public static boolean load(String cn, String ar[]) {
+    public static boolean load(String cn, String ar[])
+    {
         try {
             /* Make sure any previous instance is garbage collected */
             System.gc();
 
             /* Check if the underlying libray supplied a valid list of
                arguments */
-            if (ar==null) ar=new String[0];
+            if (ar == null)
+                ar = new String[0];
 
             /* Check the class name */
-            if (cn==null)
+            if (cn == null)
                 throw new NullPointerException("Null class name specified");
 
             /* Get the ClassLoader loading this class */
-            ClassLoader cl=DaemonLoader.class.getClassLoader();
-            if (cl==null) {
+            ClassLoader cl = DaemonLoader.class.getClassLoader();
+            if (cl == null) {
                 System.err.println("Cannot retrieve ClassLoader instance");
-                return(false);
+                return false;
             }
 
             /* Find the required class */
-            Class c=cl.loadClass(cn);
+            Class c = cl.loadClass(cn);
 
             /* This should _never_ happen, but doublechecking doesn't harm */
-            if (c==null) throw new ClassNotFoundException(cn);
+            if (c == null)
+                throw new ClassNotFoundException(cn);
 
             /* Check interface */
             boolean isdaemon = false;
             try {
-              Class dclass = cl.loadClass("org.apache.commons.daemon.Daemon");
-              isdaemon = dclass.isAssignableFrom(c);
-            } catch(Exception cnfex) {
-              // Swallow if Daemon not found.
+                Class dclass =
+                    cl.loadClass("org.apache.commons.daemon.Daemon");
+                isdaemon = dclass.isAssignableFrom(c);
+            } catch (Exception cnfex) {
+                // Swallow if Daemon not found.
             }
 
             /* Check methods */
-            Class[] myclass = new Class[1];
+            Class[]myclass = new Class[1];
             if (isdaemon) {
-              myclass[0] = DaemonContext.class;
-            } else {
-              myclass[0] = ar.getClass();
+                myclass[0] = DaemonContext.class;
+            }
+            else {
+                myclass[0] = ar.getClass();
             }
 
-            init = c.getMethod("init",myclass);
+            init    = c.getMethod("init", myclass);
 
             myclass = null;
-            start = c.getMethod("start",myclass);
-
-            stop = c.getMethod("stop",myclass);
-
-            destroy = c.getMethod("destroy",myclass);
+            start   = c.getMethod("start", myclass);
+            stop    = c.getMethod("stop", myclass);
+            destroy = c.getMethod("destroy", myclass);
 
             /* Create a new instance of the daemon */
-            daemon=c.newInstance();
+            daemon = c.newInstance();
 
             if (isdaemon) {
-              /* Create a new controller instance */
-              controller=new Controller();
+                /* Create a new controller instance */
+                controller = new Controller();
 
-              /* Set the availability flag in the controller */
-              controller.setAvailable(false);
+                /* Set the availability flag in the controller */
+                controller.setAvailable(false);
 
-              /* Create context */
-              context = new Context();
-              context.setArguments(ar);
-              context.setController(controller);
-
-              /* Now we want to call the init method in the class */
-              Object arg[] = new Object[1];
-              arg[0] = context;
-              init.invoke(daemon,arg);
-            } else {
-              Object arg[] = new Object[1];
-              arg[0] = ar;
-              init.invoke(daemon,arg);
+                /* Create context */
+                context = new Context();
+                context.setArguments(ar);
+                context.setController(controller);
+
+                /* Now we want to call the init method in the class */
+                Object arg[] = new Object[1];
+                arg[0] = context;
+                init.invoke(daemon, arg);
+            }
+            else {
+                Object arg[] = new Object[1];
+                arg[0] = ar;
+                init.invoke(daemon, arg);
             }
 
         } catch (Throwable t) {
             /* In case we encounter ANY error, we dump the stack trace and
-               return false (load, start and stop won't be called). */
+             * return false (load, start and stop won't be called).
+             */
             t.printStackTrace(System.err);
-            return(false);
+            return false;
         }
         /* The class was loaded and instantiated correctly, we can return */
-        return(true);
+        return true;
     }
 
-    public static boolean start() {
+    public static boolean start()
+    {
         try {
             /* Attempt to start the daemon */
             Object arg[] = null;
-            start.invoke(daemon,arg);
+            start.invoke(daemon, arg);
 
             /* Set the availability flag in the controller */
             if (controller != null)
-              controller.setAvailable(true);
+                controller.setAvailable(true);
 
         } catch (Throwable t) {
             /* In case we encounter ANY error, we dump the stack trace and
-               return false (load, start and stop won't be called). */
+             * return false (load, start and stop won't be called).
+             */
             t.printStackTrace(System.err);
-            return(false);
+            return false;
         }
-        return(true);
+        return true;
     }
 
-    public static boolean stop() {
+    public static boolean stop()
+    {
         try {
             /* Set the availability flag in the controller */
             if (controller != null)
-              controller.setAvailable(false);
+                controller.setAvailable(false);
 
             /* Attempt to stop the daemon */
             Object arg[] = null;
-            stop.invoke(daemon,arg);
+            stop.invoke(daemon, arg);
 
             /* Run garbage collector */
             System.gc();
 
-        } catch (Throwable t) {
+        }
+        catch (Throwable t) {
             /* In case we encounter ANY error, we dump the stack trace and
-               return false (load, start and stop won't be called). */
+             * return false (load, start and stop won't be called).
+             */
             t.printStackTrace(System.err);
-            return(false);
+            return false;
         }
-        return(true);
+        return true;
     }
 
-    public static boolean destroy() {
+    public static boolean destroy()
+    {
         try {
             /* Attempt to stop the daemon */
             Object arg[] = null;
-            destroy.invoke(daemon,arg);
+            destroy.invoke(daemon, arg);
 
             /* Run garbage collector */
-            daemon=null;
-            controller=null;
+            daemon = null;
+            controller = null;
             System.gc();
 
         } catch (Throwable t) {
             /* In case we encounter ANY error, we dump the stack trace and
-               return false (load, start and stop won't be called). */
+             * return false (load, start and stop won't be called).
+             */
             t.printStackTrace(System.err);
-            return(false);
+            return false;
         }
-        return(true);
+        return true;
     }
 
     private static native void shutdown(boolean reload);
 
-    public static class Controller implements DaemonController {
+    public static class Controller
+        implements DaemonController
+    {
 
-        boolean available=false;
+        boolean available = false;
 
-        private Controller() {
+        private Controller()
+        {
             super();
             this.setAvailable(false);
         }
 
-        private boolean isAvailable() {
+        private boolean isAvailable()
+        {
             synchronized (this) {
-                return(this.available);
+                return this.available;
             }
         }
 
-        private void setAvailable(boolean available) {
+        private void setAvailable(boolean available)
+        {
             synchronized (this) {
-                this.available=available;
+                this.available = available;
             }
         }
 
-        public void shutdown() throws IllegalStateException {
+        public void shutdown()
+            throws IllegalStateException
+        {
             synchronized (this) {
                 if (!this.isAvailable()) {
                     throw new IllegalStateException();
-                } else {
+                }
+                else {
                     this.setAvailable(false);
                     DaemonLoader.shutdown(false);
                 }
             }
         }
 
-        public void reload() throws IllegalStateException {
+        public void reload()
+            throws IllegalStateException
+        {
             synchronized (this) {
                 if (!this.isAvailable()) {
                     throw new IllegalStateException();
-                } else {
+                }
+                else {
                     this.setAvailable(false);
                     DaemonLoader.shutdown(true);
                 }
@@ -277,45 +302,54 @@ public final class DaemonLoader {
         }
 
         public void fail()
-            throws IllegalStateException {
+            throws IllegalStateException
+        {
         }
 
         public void fail(String message)
-            throws IllegalStateException {
+            throws IllegalStateException
+        {
         }
 
         public void fail(Exception exception)
-            throws IllegalStateException {
+            throws IllegalStateException
+        {
         }
 
         public void fail(String message, Exception exception)
-            throws IllegalStateException {
+            throws IllegalStateException
+        {
         }
 
     }
 
-    public static class Context implements DaemonContext {
+    public static class Context
+        implements DaemonContext
+    {
 
         DaemonController controller = null;
-
         String[] args = null;
 
-        public DaemonController getController() {
+        public DaemonController getController()
+        {
             return controller;
         }
 
-        public void setController(DaemonController controller) {
+        public void setController(DaemonController controller)
+        {
             this.controller = controller;
         }
 
-        public String[] getArguments() {
+        public String[] getArguments()
+        {
             return args;
         }
 
-        public void setArguments(String[] args) {
+        public void setArguments(String[]args)
+        {
             this.args = args;
         }
 
     }
-
 }
+



Mime
View raw message