[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs] contrib/varia/src/main/org/jboss/varia/scheduler   ...
From:       Dimitris Andreadis <dimitris.andreadis () jboss ! com>
Date:       2006-02-28 21:31:21
Message-ID: E1FECRF-0001jz-HB () committer01 ! frg ! pub ! inap ! atl ! jboss ! com
[Download RAW message or body]

  User: dimitris
  Date: 06/02/28 16:31:21

  Modified:    varia/src/main/org/jboss/varia/scheduler   Tag: Branch_4_0
                        SingleScheduleProviderMBean.java
                        SingleScheduleProvider.java
  Log:
  JBAS-2615, make the ScheduleProviders non-clusterred by default and add a comment \
to show how to enable this, tidy up.  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.4   +104 -68   \
contrib/varia/src/main/org/jboss/varia/scheduler/SingleScheduleProviderMBean.java  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SingleScheduleProviderMBean.java
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/varia/src/main/org/jboss/varia/scheduler/SingleScheduleProviderMBean.java,v
  retrieving revision 1.1.4.3
  retrieving revision 1.1.4.4
  diff -u -b -r1.1.4.3 -r1.1.4.4
  --- SingleScheduleProviderMBean.java	29 Oct 2005 05:06:46 -0000	1.1.4.3
  +++ SingleScheduleProviderMBean.java	28 Feb 2006 21:31:21 -0000	1.1.4.4
  @@ -1,84 +1,120 @@
   /*
  -* JBoss, Home of Professional Open Source
  -* Copyright 2005, JBoss Inc., and individual contributors as indicated
  -* by the @authors tag. See the copyright.txt in the distribution for a
  -* full listing of individual contributors.
  -*
  -* This is free software; you can redistribute it and/or modify it
  -* under the terms of the GNU Lesser General Public License as
  -* published by the Free Software Foundation; either version 2.1 of
  -* the License, or (at your option) any later version.
  -*
  -* This software is distributed in the hope that it will be useful,
  -* but WITHOUT ANY WARRANTY; without even the implied warranty of
  -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  -* Lesser General Public License for more details.
  -*
  -* You should have received a copy of the GNU Lesser General Public
  -* License along with this software; if not, write to the Free
  -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  -* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -*/
  + * JBoss, Home of Professional Open Source
  + * Copyright 2005, JBoss Inc., and individual contributors as indicated
  + * by the @authors tag. See the copyright.txt in the distribution for a
  + * full listing of individual contributors.
  + *
  + * This is free software; you can redistribute it and/or modify it
  + * under the terms of the GNU Lesser General Public License as
  + * published by the Free Software Foundation; either version 2.1 of
  + * the License, or (at your option) any later version.
  + *
  + * This software is distributed in the hope that it will be useful,
  + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  + * Lesser General Public License for more details.
  + *
  + * You should have received a copy of the GNU Lesser General Public
  + * License along with this software; if not, write to the Free
  + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  + */
   package org.jboss.varia.scheduler;
   
  +import javax.management.ObjectName;
  +
  +import org.jboss.mx.util.ObjectNameFactory;
  +
   /**
  - * MBean interface.
  + * SingleScheduleProvider MBean interface.
  + * 
  + * @author <a href="mailto:andreas@jboss.org">Andreas Schaefer</a>
  + * @author <a href="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
  + * @version $Revision: 1.1.4.4 $ 
    */
  -public interface SingleScheduleProviderMBean extends \
org.jboss.varia.scheduler.AbstractScheduleProviderMBean  +public interface \
SingleScheduleProviderMBean extends AbstractScheduleProviderMBean  {
  +   /** The default ObjectName */
  +   ObjectName OBJECT_NAME = \
ObjectNameFactory.create("jboss:service=SingleScheduleProvider");  
  -   //default object name
  -   public static final javax.management.ObjectName OBJECT_NAME = \
                org.jboss.mx.util.ObjectNameFactory
  -         .create("jboss:service=SingleScheduleProvider");
  -
  -   void startProviding() throws javax.management.JMException;
  -
  -   void stopProviding();
  -
  -   java.lang.String getTargetName();
  +   // Attributes ----------------------------------------------------
   
      /**
  -    * Sets the fully qualified JMX MBean Object Name of the Schedulable MBean to \
                be called.
  -    * @param pTargetObjectName JMX MBean Object Name which should be called.
  -    * @throws InvalidParameterException If the given value is an valid Object \
                Name.    */
  -   void setTargetName(java.lang.String pTargetObjectName) throws \
                java.security.InvalidParameterException;
  -
  -   java.lang.String getTargetMethod();
  +    * The string-fied ObjectName of the Schedulable MBean to call
  +    */
  +   void setTargetName(String objectName) throws IllegalArgumentException;   
  +   String getTargetName();
   
      /**
  -    * Sets the method name to be called on the Schedulable MBean. It can \
optionally be followed by an opening bracket, list of attributes (see below) and a \
closing bracket. The list of attributes can contain: <ul> <li>NOTIFICATION which will \
be replaced by the timers notification instance (javax.management.Notification)</li> \
<li>DATE which will be replaced by the date of the notification call \
(java.util.Date)</li> <li>REPETITIONS which will be replaced by the number of \
remaining repetitions (long)</li> <li>SCHEDULER_NAME which will be replaced by the \
Object Name of the Scheduler (javax.management.ObjectName)</li> <li>any full \
qualified Class name which the Scheduler will be set a "null" value for it</li> </ul> \
<br> An example could be: "doSomething( NOTIFICATION, REPETITIONS, java.lang.String \
)" where the Scheduler will pass the timer's notification instance, the remaining \
repetitions as int and a null to the MBean's doSomething() method which must have the \
following sign!  ature: doSomething( javax.management.Notification, long, \
                java.lang.String ).
  -    * @param pTargetMethod Name of the method to be called optional followed by \
                method arguments (see above).
  -    * @throws InvalidParameterException If the given value is not of the right \
                format    */
  -   void setTargetMethod(java.lang.String pTargetMethod) throws \
                java.security.InvalidParameterException;
  -
  -   long getPeriod();
  +    * The method name to call on the Schedulable MBean. It can optionally
  +    * be followed by an opening bracket, list of attributes (see below) and a \
closing bracket.  +    * 
  +    * The list of attributes can contain:
  +    * <ul>
  +    *   <li>NOTIFICATION which will be replaced by the timers notification \
instance (javax.management.Notification)</li>  +    *   <li>DATE which will be \
replaced by the date of the notification call (java.util.Date)</li>  +    *   \
<li>REPETITIONS which will be replaced by the number of remaining repetitions \
(long)</li>  +    *   <li>SCHEDULER_NAME which will be replaced by the Object Name of \
the Scheduler (javax.management.ObjectName)</li>  +    *   <li>any full qualified \
Class name which the Scheduler will be set a "null" value for it</li>  +    * </ul
  +    *  <br>
  +    * An example could be: "doSomething( NOTIFICATION, REPETITIONS, \
java.lang.String )"  +    * where the Scheduler will pass the timer's notification \
instance, the remaining  +    * repetitions as int and a null to the MBean's \
doSomething() method which must  +    * have the following signature: \
doSomething(javax.management.Notification, long, java.lang.String).  +    * 
  +    * @param method Name of the method to be called optional followed by method \
arguments (see above).  +    * @throws IllegalArgumentException If the given value is \
not of the right format  +    */
  +   void setTargetMethod(String method) throws IllegalArgumentException;
  +   String getTargetMethod();
   
      /**
  -    * Sets the Schedule Period between two scheduled call.
  -    * @param pPeriod Time between to scheduled calls (after the initial call) in \
                Milliseconds. This value must be bigger than 0.
  -    * @throws InvalidParameterException If the given value is less or equal than 0 \
                */
  -   void setPeriod(long pPeriod);
  -
  -   java.lang.String getDateFormat();
  +    * The Schedule Period between two scheduled call.
  +    * 
  +    * @param period Time between to scheduled calls (after the initial call)
  +    *               in Milliseconds. This value must be bigger than 0.
  +    * @throws IllegalArgumentException If the given value is less or equal than 0
  +    */
  +   void setPeriod(long period);
  +   long getPeriod();
   
      /**
  -    * Sets the date format used to parse date/times
  -    * @param dateFormat The date format when empty or null the locale is used to \
                parse dates    */
  -   void setDateFormat(java.lang.String dateFormat);
  -
  -   java.lang.String getStartDate();
  +    * The date format used to parse date/times
  +    * @param dateFormat The date format when empty or null the locale is used to \
parse dates  +    */
  +   void setDateFormat(String dateFormat);
  +   String getDateFormat();
   
      /**
  -    * Sets the first scheduled call. If the date is in the past the scheduler \
                tries to find the next available start date.
  -    * @param pStartDate Date when the initial call is scheduled. It can be either: \
<ul> <li> NOW: date will be the current date (new Date()) plus 1 seconds </li><li> \
Date as String able to be parsed by SimpleDateFormat with default format </li><li> \
Date as String parsed using the date format attribute </li><li> Milliseconds since \
1/1/1970 </li> </ul> If the date is in the past the Scheduler will search a start \
date in the future with respect to the initial repe- titions and the period between \
calls. This means that when you restart the MBean (restarting JBoss etc.) it will \
start at the next scheduled time. When no start date is available in the future the \
Scheduler will not start.<br> Example: if you start your Schedulable everyday at Noon \
and you restart your JBoss server then it will start at the next Noon (the same if \
                started before Noon or the next day if start after Noon).    */
  -   void setStartDate(java.lang.String pStartDate);
  -
  -   long getRepetitions();
  +    * The date/time of the first scheduled call. If the date is in the past
  +    * the scheduler tries to find the next available start date.
  +    * @param startDate Date when the initial call is scheduled. It can be either:
  +    * <ul>
  +    *   <li> NOW: date will be the current date (new Date()) plus 1 seconds </li>
  +    *   <li> Date as String able to be parsed by SimpleDateFormat with default \
format </li>  +    *   <li> Date as String parsed using the date format attribute \
</li>  +    *   <li> Milliseconds since 1/1/1970 </li>
  +    * </ul>
  +    * If the date is in the past the Scheduler will search a start date in the \
future  +    * with respect to the initial repe- titions and the period between \
calls. This means  +    * that when you restart the MBean (restarting JBoss etc.) it \
will start at the next  +    * scheduled time. When no start date is available in the \
future the Scheduler will not start.  +    * <br>
  +    * Example: if you start your Schedulable everyday at Noon and you restart your \
JBoss server  +    * then it will start at the next Noon (the same if started before \
Noon or the next day if  +    * start after Noon).
  +    */
  +   void setStartDate(String startDate);
  +   String getStartDate();
   
      /**
       * Sets the initial number of scheduled calls.
  -    * @param pNumberOfCalls Initial Number of scheduled calls. If -1 then the \
                number is unlimted.
  -    * @throws InvalidParameterException If the given value is less or equal than 0 \
                */
  -   void setRepetitions(long pNumberOfCalls);
  +    * 
  +    * @param numberOfCalls Initial Number of scheduled calls. If -1 then the \
number is unlimited.  +    * @throws IllegalArgumentException If the given value is \
less or equal than 0  +    */
  +   void setRepetitions(long numberOfCalls);
  +   long getRepetitions();
   
   }
  
  
  
  1.4.6.2   +135 -108  \
contrib/varia/src/main/org/jboss/varia/scheduler/SingleScheduleProvider.java  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SingleScheduleProvider.java
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/varia/src/main/org/jboss/varia/scheduler/SingleScheduleProvider.java,v
  retrieving revision 1.4.6.1
  retrieving revision 1.4.6.2
  diff -u -b -r1.4.6.1 -r1.4.6.2
  --- SingleScheduleProvider.java	29 Oct 2005 05:06:46 -0000	1.4.6.1
  +++ SingleScheduleProvider.java	28 Feb 2006 21:31:21 -0000	1.4.6.2
  @@ -1,34 +1,33 @@
   /*
  -* JBoss, Home of Professional Open Source
  -* Copyright 2005, JBoss Inc., and individual contributors as indicated
  -* by the @authors tag. See the copyright.txt in the distribution for a
  -* full listing of individual contributors.
  -*
  -* This is free software; you can redistribute it and/or modify it
  -* under the terms of the GNU Lesser General Public License as
  -* published by the Free Software Foundation; either version 2.1 of
  -* the License, or (at your option) any later version.
  -*
  -* This software is distributed in the hope that it will be useful,
  -* but WITHOUT ANY WARRANTY; without even the implied warranty of
  -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  -* Lesser General Public License for more details.
  -*
  -* You should have received a copy of the GNU Lesser General Public
  -* License along with this software; if not, write to the Free
  -* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  -* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -*/
  + * JBoss, Home of Professional Open Source
  + * Copyright 2005, JBoss Inc., and individual contributors as indicated
  + * by the @authors tag. See the copyright.txt in the distribution for a
  + * full listing of individual contributors.
  + *
  + * This is free software; you can redistribute it and/or modify it
  + * under the terms of the GNU Lesser General Public License as
  + * published by the Free Software Foundation; either version 2.1 of
  + * the License, or (at your option) any later version.
  + *
  + * This software is distributed in the hope that it will be useful,
  + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  + * Lesser General Public License for more details.
  + *
  + * You should have received a copy of the GNU Lesser General Public
  + * License along with this software; if not, write to the Free
  + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  + */
   package org.jboss.varia.scheduler;
   
   import java.text.SimpleDateFormat;
  -import java.security.InvalidParameterException;
   import java.util.Date;
   import java.util.StringTokenizer;
   
   import javax.management.JMException;
  -import javax.management.MalformedObjectNameException;
   import javax.management.MBeanServer;
  +import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
   /**
  @@ -38,14 +37,11 @@
    * ATTENTION: This is the provider you used in the older Scheduler
    * when you used a MBean as target.
    *
  - * @jmx:mbean name="jboss:service=SingleScheduleProvider"
  - *            extends="org.jboss.varia.scheduler.AbstractScheduleProviderMBean"
  - *
    * @author <a href="mailto:andreas@jboss.org">Andreas Schaefer</a>
  - * @version $Revision: 1.4.6.1 $
  + * @author <a href="mailto:dimitris@jboss.org">Dimitris Andreadis</a>
  + * @version $Revision: 1.4.6.2 $
    */
  -public class SingleScheduleProvider
  -   extends AbstractScheduleProvider
  +public class SingleScheduleProvider extends AbstractScheduleProvider
      implements SingleScheduleProviderMBean
   {
   
  @@ -68,7 +64,7 @@
      private long mSchedulePeriod;
      private long mInitialRepetitions;
      
  -   /** The ID of the Schedule used later to remove it later **/
  +   /** The ID of the Schedule used later to remove it later */
      private int mScheduleID;
      
      // -------------------------------------------------------------------------
  @@ -77,7 +73,7 @@
      
      /**
       * Default (no-args) Constructor
  -    **/
  +    */
      public SingleScheduleProvider()
      {
      }
  @@ -86,8 +82,7 @@
      // SchedulerMBean Methods
      // -------------------------------------------------------------------------
      
  -   public void startProviding()
  -      throws JMException
  +   public void startProviding() throws JMException
      {
         mScheduleID = addSchedule(
            mSchedulableMBean,
  @@ -99,11 +94,14 @@
         );
      }
      
  -   public void stopProviding() {
  -      try {
  +   public void stopProviding()
  +   {
  +      try
  +      {
            removeSchedule( mScheduleID );
         }
  -      catch( JMException jme ) {
  +      catch (JMException jme)
  +      {
            log.error( "Could not remove Schedule in stop providing", jme );
         }
      }
  @@ -113,10 +111,9 @@
       *
       * @return Object Name of the Target MBean for the timer notifications
       */
  -   public String getTargetName() {
  -      return mSchedulableMBean == null ?
  -         null :
  -         mSchedulableMBean.toString();
  +   public String getTargetName()
  +   {
  +      return mSchedulableMBean == null ? null : mSchedulableMBean.toString();
      }
      
      /**
  @@ -126,20 +123,22 @@
       *
       * @param pTargetObjectName JMX MBean Object Name which should be called.
       *
  -    * @throws InvalidParameterException If the given value is an valid Object \
Name.  +    * @throws IllegalArgumentException If the given value is an valid Object \
                Name.
       */
  -   public void setTargetName( String pTargetObjectName )
  -      throws InvalidParameterException
  +   public void setTargetName(String pTargetObjectName) throws \
IllegalArgumentException  {
  -      if( pTargetObjectName == null ) {
  -         throw new InvalidParameterException( "Schedulable MBean must be \
specified" );  +      if (pTargetObjectName == null)
  +      {
  +         throw new IllegalArgumentException("Schedulable MBean must be \
specified");  }
  -      try {
  +      try
  +      {
            mSchedulableMBean = new ObjectName( pTargetObjectName );
         }
  -      catch( MalformedObjectNameException mone ) {
  -         log.error( "Schedulable MBean Object Name is malformed", mone );
  -         throw new InvalidParameterException( "Schedulable MBean is not correctly \
formatted" );  +      catch(MalformedObjectNameException mone)
  +      {
  +         log.error("Schedulable MBean Object Name is malformed", mone);
  +         throw new IllegalArgumentException("Schedulable MBean is not correctly \
formatted");  }
      }
      
  @@ -147,8 +146,9 @@
       * @return Method description of the target MBean to be called
       *
       * @jmx:managed-attribute
  -    **/
  -   public String getTargetMethod() {
  +    */
  +   public String getTargetMethod()
  +   {
         return mSchedulableMBeanMethod;
      }
      
  @@ -180,47 +180,59 @@
       * @param pTargetMethod Name of the method to be called optional followed
       *                                by method arguments (see above).
       *
  -    * @throws InvalidParameterException If the given value is not of the right
  +    * @throws IllegalArgumentException If the given value is not of the right
       *                                   format
       */
  -   public void setTargetMethod( String pTargetMethod  )
  -      throws InvalidParameterException
  +   public void setTargetMethod(String pTargetMethod) throws \
IllegalArgumentException  +   {
  +      if (pTargetMethod == null)
      {
  -      if( pTargetMethod == null ) {
            mSchedulableMBeanMethod = null;
            return;
         }
  -      int lIndex = pTargetMethod.indexOf( '(' );
  +      int lIndex = pTargetMethod.indexOf('(');
         String lMethodName = "";
  -      if( lIndex < 0 ) {
  +      if( lIndex < 0 )
  +      {
            lMethodName = pTargetMethod.trim();
            mMethodSignature = new String[ 0 ];
  -      } else
  -      if( lIndex > 0 ) {
  -         lMethodName = pTargetMethod.substring( 0, lIndex ).trim();
         }
  -      if( lMethodName.equals( "" ) ) {
  +      else
  +      if( lIndex > 0 )
  +      {
  +         lMethodName = pTargetMethod.substring(0, lIndex).trim();
  +      }
  +      if (lMethodName.equals(""))
  +      {
            lMethodName = "perform";
         }
  -      if( lIndex >= 0 ) {
  -         int lIndex2 = pTargetMethod.indexOf( ')' );
  -         if( lIndex2 < lIndex ) {
  -            throw new InvalidParameterException( "Schedulable MBean Method: \
                closing bracket must be after opening bracket" );
  -         }
  -         if( lIndex2 < pTargetMethod.length() - 1 ) {
  -            String lRest = pTargetMethod.substring( lIndex2 + 1 ).trim();
  -            if( lRest.length() > 0 ) {
  -               throw new InvalidParameterException( "Schedulable MBean Method: \
nothing should be after closing bracket" );  +      if (lIndex >= 0)
  +      {
  +         int lIndex2 = pTargetMethod.indexOf(')');
  +         if (lIndex2 < lIndex)
  +         {
  +            throw new IllegalArgumentException("Schedulable MBean Method: closing \
bracket must be after opening bracket");  }
  +         if (lIndex2 < pTargetMethod.length() - 1)
  +         {
  +            String lRest = pTargetMethod.substring(lIndex2 + 1).trim();
  +            if (lRest.length() > 0)
  +            {
  +               throw new IllegalArgumentException("Schedulable MBean Method: \
nothing should be after closing bracket");  }
  -         String lArguments = pTargetMethod.substring( lIndex + 1, lIndex2 \
                ).trim();
  -         if( lArguments.equals( "" ) ) {
  -            mMethodSignature = new String[ 0 ];
  -         } else {
  -            StringTokenizer lTokenizer = new StringTokenizer( lArguments, "," );
  -            mMethodSignature = new String[ lTokenizer.countTokens() ];
  -            for( int i = 0; lTokenizer.hasMoreTokens(); i++ ) {
  -               mMethodSignature[ i ] = lTokenizer.nextToken().trim();
  +         }
  +         String lArguments = pTargetMethod.substring(lIndex + 1, lIndex2).trim();
  +         if (lArguments.equals(""))
  +         {
  +            mMethodSignature = new String[0];
  +         }
  +         else
  +         {
  +            StringTokenizer lTokenizer = new StringTokenizer(lArguments, ",");
  +            mMethodSignature = new String[lTokenizer.countTokens()];
  +            for (int i = 0; lTokenizer.hasMoreTokens(); i++)
  +            {
  +               mMethodSignature[i] = lTokenizer.nextToken().trim();
               }
            }
         }
  @@ -234,7 +246,8 @@
       * @return Schedule Period between two scheduled calls in Milliseconds. It will \
                always
       *         be bigger than 0 except it returns -1 then the schedule is stopped.
       */
  -   public long getPeriod() {
  +   public long getPeriod()
  +   {
         return mSchedulePeriod;
      }
   
  @@ -246,11 +259,13 @@
       * @param pPeriod Time between to scheduled calls (after the initial call) in \
                Milliseconds.
       *                This value must be bigger than 0.
       *
  -    * @throws InvalidParameterException If the given value is less or equal than 0
  +    * @throws IllegalArgumentException If the given value is less or equal than 0
       */
  -   public void setPeriod( long pPeriod ) {
  -      if( pPeriod <= 0 ) {
  -         throw new InvalidParameterException( "Schedulable Period may be not less \
or equals than 0" );  +   public void setPeriod(long pPeriod)
  +   {
  +      if (pPeriod <= 0)
  +      {
  +         throw new IllegalArgumentException("Schedulable Period may be not less or \
equals than 0");  }
         mSchedulePeriod = pPeriod;
      }
  @@ -264,6 +279,7 @@
      {
         if (mDateFormatter == null)
            mDateFormatter = new SimpleDateFormat();
  +      
         return mDateFormatter.toPattern();
      }
      
  @@ -288,7 +304,8 @@
       * @return Date (and time) of the first scheduled. For value see {@link \
                #setInitialStartDate} 
       *         method.
       */
  -   public String getStartDate() {
  +   public String getStartDate()
  +   {
         return mStartDateString;
      }
      
  @@ -320,32 +337,42 @@
       *                   your JBoss server then it will start at the next Noon (the \
                same if started
       *                   before Noon or the next day if start after Noon).
       */
  -   public void setStartDate( String pStartDate ) {
  +   public void setStartDate(String pStartDate)
  +   {
         mStartDateString = pStartDate == null ? "" : pStartDate.trim();
  -      if( mStartDateString.equals( "" ) ) {
  -         mStartDate = new Date( 0 );
  -      } else
  -      if( mStartDateString.equals( "NOW" ) ) {
  -         mStartDate = new Date( new Date().getTime() + 1000 );
  -      } else {
  -         try {
  -            long lDate = new Long( pStartDate ).longValue();
  -            mStartDate = new Date( lDate );
  -         }
  -         catch( Exception e ) {
  -            try {
  -               if( mDateFormatter == null ) {
  +      if (mStartDateString.equals(""))
  +      {
  +         mStartDate = new Date(0);
  +      }
  +      else if (mStartDateString.equals("NOW"))
  +      {
  +         mStartDate = new Date(new Date().getTime() + 1000);
  +      }
  +      else
  +      {
  +         try
  +         {
  +            long lDate = new Long(pStartDate).longValue();
  +            mStartDate = new Date(lDate);
  +         }
  +         catch (Exception e)
  +         {
  +            try
  +            {
  +               if (mDateFormatter == null)
  +               {
                     mDateFormatter = new SimpleDateFormat();
                  }
  -               mStartDate = mDateFormatter.parse( mStartDateString );
  +               mStartDate = mDateFormatter.parse(mStartDateString);
               }
  -            catch( Exception e2 ) {
  -               log.error( "Could not parse given date string: " + \
                mStartDateString, e2 );
  -               throw new InvalidParameterException( "Schedulable Date is not of \
correct format" );  +            catch (Exception e2)
  +            {
  +               log.error ("Could not parse given date string: " + \
mStartDateString, e2);  +               throw new \
IllegalArgumentException("Schedulable Date is not of correct format");  }
            }
         }
  -      log.debug( "Initial Start Date is set to: " + mStartDate );
  +      log.debug("Initial Start Date is set to: " + mStartDate);
      }
   
      /**
  @@ -353,7 +380,8 @@
       *
       * @return Number of scheduled calls initially. If -1 then there is not limit.
       */
  -   public long getRepetitions() {
  +   public long getRepetitions()
  +   {
         return mInitialRepetitions;
      }
   
  @@ -365,10 +393,12 @@
       * @param pNumberOfCalls Initial Number of scheduled calls. If -1 then the \
                number
       *                       is unlimted.
       *
  -    * @throws InvalidParameterException If the given value is less or equal than 0
  +    * @throws IllegalArgumentException If the given value is less or equal than 0
       */
  -   public void setRepetitions( long pNumberOfCalls ) {
  -      if( pNumberOfCalls <= 0 ) {
  +   public void setRepetitions(long pNumberOfCalls)
  +   {
  +      if (pNumberOfCalls <= 0)
  +      {
            pNumberOfCalls = -1;
         }
         mInitialRepetitions = pNumberOfCalls;
  @@ -378,10 +408,7 @@
      // Methods
      // -------------------------------------------------------------------------
      
  -   public ObjectName getObjectName(
  -      MBeanServer pServer,
  -      ObjectName pName
  -   )
  +   public ObjectName getObjectName(MBeanServer pServer, ObjectName pName)
         throws MalformedObjectNameException
      {
         return pName == null ? SingleScheduleProviderMBean.OBJECT_NAME : pName;
  
  
  


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic