You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2005/03/23 07:39:11 UTC

svn commit: r158739 - in webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler: DeploymentIterator.java ScheduleIterator.java Scheduler.java SchedulerTask.java

Author: deepal
Date: Tue Mar 22 22:39:10 2005
New Revision: 158739

URL: http://svn.apache.org/viewcvs?view=rev&rev=158739
Log:
removed unnessary comments and unnessary codes

Removed:
    webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/ScheduleIterator.java
Modified:
    webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/DeploymentIterator.java
    webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/Scheduler.java
    webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/SchedulerTask.java

Modified: webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/DeploymentIterator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/DeploymentIterator.java?view=diff&r1=158738&r2=158739
==============================================================================
--- webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/DeploymentIterator.java (original)
+++ webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/DeploymentIterator.java Tue Mar 22 22:39:10 2005
@@ -19,15 +19,11 @@
 import java.util.Calendar;
 import java.util.Date;
 
-public class DeploymentIterator implements ScheduleIterator {
-    private Calendar calendar = Calendar.getInstance();
-
-    public DeploymentIterator() {
+public class DeploymentIterator{
 
-    }
+    private Calendar calendar = Calendar.getInstance();
 
     public Date next() {
-        // calendar.add(Calendar.MINUTE, 1);
         calendar.add(Calendar.SECOND, 10);
         return calendar.getTime();
     }

Modified: webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/Scheduler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/Scheduler.java?view=diff&r1=158738&r2=158739
==============================================================================
--- webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/Scheduler.java (original)
+++ webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/Scheduler.java Tue Mar 22 22:39:10 2005
@@ -1,18 +1,18 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 
 package org.apache.axis.deployment.scheduler;
 
@@ -22,12 +22,15 @@
 
 public class Scheduler {
 
+    private final Timer timer = new Timer();
+
     public class SchedulerTimerTask extends TimerTask {
+
         private SchedulerTask schedulerTask;
-        private ScheduleIterator iterator;
+        private DeploymentIterator iterator;
 
-        public SchedulerTimerTask(SchedulerTask schedulerTask,
-                                  ScheduleIterator iterator) {
+
+        public SchedulerTimerTask(SchedulerTask schedulerTask, DeploymentIterator iterator) {
             this.schedulerTask = schedulerTask;
             this.iterator = iterator;
         }
@@ -38,27 +41,6 @@
         }
     }
 
-
-    private final Timer timer = new Timer();
-
-    public Scheduler() {
-    }
-
-    /**
-     * Terminates this <code>scheduler</code>, discarding any currently scheduled tasks.
-     * Does not interfere with a currently executing task (if it exists).
-     * Once a scheduler has been terminated, its execution thread terminates gracefully,
-     * and no more tasks may be scheduled on it.
-     * Note that calling this method from within the run method of a scheduler task that
-     * was invoked by this scheduler absolutely guarantees that the ongoing task execution is the last
-     * task execution that will ever be performed by this scheduler.
-     * This method may be called repeatedly; the second and subsequent calls have no effect.
-     */
-
-    public void cancel() {
-        timer.cancel();
-    }
-
     /**
      * Schedules the specified task for execution according to the specified schedule.
      * If times specified by the <code>ScheduleIterator</code> are in the past they are
@@ -70,18 +52,13 @@
      *                               scheduler was cancelled, or scheduler thread terminated.
      */
 
-    public void schedule(SchedulerTask schedulerTask,
-                         ScheduleIterator iterator) {
+    public void schedule(SchedulerTask schedulerTask, DeploymentIterator  iterator) {
 
         Date time = iterator.next();
         if (time == null) {
             schedulerTask.cancel();
         } else {
             synchronized (schedulerTask.lock) {
-                if (schedulerTask.state != SchedulerTask.VIRGIN) {
-                    throw new IllegalStateException("Task already scheduled " +
-                            "or cancelled");
-                }
                 schedulerTask.state = SchedulerTask.SCHEDULED;
                 schedulerTask.timerTask =
                         new SchedulerTimerTask(schedulerTask, iterator);
@@ -90,9 +67,7 @@
         }
     }
 
-    private void reschedule(SchedulerTask schedulerTask,
-                            ScheduleIterator iterator) {
-
+    private void reschedule(SchedulerTask schedulerTask,DeploymentIterator iterator) {
         Date time = iterator.next();
         if (time == null) {
             schedulerTask.cancel();
@@ -106,4 +81,5 @@
             }
         }
     }
+
 }

Modified: webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/SchedulerTask.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/SchedulerTask.java?view=diff&r1=158738&r2=158739
==============================================================================
--- webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/SchedulerTask.java (original)
+++ webservices/axis/trunk/java/modules/deployment/src/java/org/apache/axis/deployment/scheduler/SchedulerTask.java Tue Mar 22 22:39:10 2005
@@ -16,20 +16,19 @@
 
 package org.apache.axis.deployment.scheduler;
 
-import org.apache.axis.deployment.DeploymentConstants;
 import org.apache.axis.deployment.DeploymentEngine;
 import org.apache.axis.deployment.listener.RepositoryListener;
 import org.apache.axis.deployment.listener.RepositoryListenerImpl;
 
 import java.util.TimerTask;
 
-public class SchedulerTask implements Runnable, DeploymentConstants {
+public class SchedulerTask implements Runnable {
+
     final Object lock = new Object();
 
     private RepositoryListener wsListener;
 
-    int state = VIRGIN;
-    static final int VIRGIN = 0;
+    int state = 0;
     static final int SCHEDULED = 1;
     static final int CANCELLED = 2;
 
@@ -40,8 +39,6 @@
      */
 
     public SchedulerTask(DeploymentEngine deploy_engine, String folderName) {
-        //     String filename = FOLDE_NAME; //"D:/Axis 2.0/projects/Deployement/test-data" ;
-        //  private  FilesLoader filesLoader = new FilesLoader(filename);
         wsListener = new RepositoryListenerImpl(folderName, deploy_engine);
     }
 
@@ -50,12 +47,11 @@
      */
 
     public void run() {
-        soundAlarm();
+        checkRepositary();
     }
 
-    private void soundAlarm() {
+    private void checkRepositary() {
         ((RepositoryListenerImpl) wsListener).startListent();
-        //filesLoader.searchFolder();
     }
 
     /**
@@ -74,22 +70,6 @@
             boolean result = (state == SCHEDULED);
             state = CANCELLED;
             return result;
-        }
-    }
-
-    /**
-     * Returns the <i>scheduled</i> execution time of the most recent actual execution of this task.
-     * (If this method is invoked while task execution is in progress, the return value is the
-     * scheduled execution time of the ongoing task execution.)
-     *
-     * @return the time at which the most recent execution of this task was scheduled to occur,
-     *         in the format returned by <code>Date.getTime()</code>. The return value is
-     *         undefined if the task has yet to commence its first execution.
-     */
-
-    public long scheduledExecutionTime() {
-        synchronized (lock) {
-            return timerTask == null ? 0 : timerTask.scheduledExecutionTime();
         }
     }