You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/07/21 16:28:12 UTC

svn commit: r796317 [2/3] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/core/ main/decaf/internal/io/ main/decaf/internal/util/ main/decaf/internal/util/concurrent/ main/decaf/io/ main/decaf/net/ main/decaf/util/ main/decaf/ut...

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Timer.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Timer.h?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Timer.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Timer.h Tue Jul 21 14:28:11 2009
@@ -0,0 +1,455 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _DECAF_UTIL_TIMER_H_
+#define _DECAF_UTIL_TIMER_H_
+
+#include <memory>
+
+#include <decaf/util/Config.h>
+#include <decaf/util/Date.h>
+
+#include <decaf/lang/Pointer.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/lang/exceptions/IllegalStateException.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+
+namespace decaf {
+namespace util {
+
+    class TimerTask;
+    class TimerImpl;
+
+    /**
+     * A facility for threads to schedule tasks for future execution in a background thread.
+     * Tasks may be scheduled for one-time execution, or for repeated execution at regular
+     * intervals.
+     *
+     * Corresponding to each Timer object is a single background thread that is used to execute
+     * all of the timer's tasks, sequentially. Timer tasks should complete quickly. If a timer
+     * task takes excessive time to complete, it "hogs" the timer's task execution thread. This
+     * can, in turn, delay the execution of subsequent tasks, which may "bunch up" and execute
+     * in rapid succession when (and if) the offending task finally completes.
+     *
+     * This class is thread-safe: multiple threads can share a single Timer object without the
+     * need for external synchronization.
+     *
+     * This class does not offer real-time guarantees: it schedules tasks using the wait(long)
+     * method.
+     *
+     * @since 1.0
+     */
+    class DECAF_API Timer {
+    private:
+
+        std::auto_ptr<TimerImpl> internal;
+
+    public:
+
+        Timer();
+
+        virtual ~Timer();
+
+        /**
+         * Terminates this timer, discarding any currently scheduled tasks. Does not interfere with a
+         * currently executing task (if it exists). Once a timer 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 timer task that was invoked by this
+         * timer absolutely guarantees that the ongoing task execution is the last task execution that will ever
+         * be performed by this timer.
+         *
+         * This method may be called repeatedly; the second and subsequent calls have no effect.
+         */
+        void cancel();
+
+        /**
+         * Removes all canceled tasks from this timer's task queue. Calling this method has no effect on the
+         * behavior of the timer, but eliminates the canceled tasks from the queue causing the Timer to destroy
+         * the TimerTask pointer it was originally given, the caller should ensure that they no longer have
+         * any references to TimerTasks that were previously scheduled.
+         *
+         * Most programs will have no need to call this method. It is designed for use by the rare application
+         * that cancels a large number of tasks. Calling this method trades time for space: the runtime of the
+         * method may be proportional to n + c log n, where n is the number of tasks in the queue and c is the
+         * number of canceled tasks.
+         *
+         * This method can be called on a Timer object that has no scheduled tasks without error.
+         *
+         * @returns the number of tasks removed from the queue.
+         */
+        std::size_t purge();
+
+        /**
+         * Schedules the specified task for execution after the specified delay.
+         *
+         * The TimerTask pointer is considered to be owned by the Timer class once it has been scheduled, the
+         * Timer will destroy its TimerTask's once they have been cancelled or the Timer itself is cancelled.
+         * A TimerTask is considered scheduled only when this method return without throwing an exception, until
+         * that time ownership is not considered to have been transferred to the Timer and the caller should
+         * ensure that the TimerTask gets deleted if an exception is thrown and no further attempts to schedule
+         * that TimerTask instance are planned.
+         *
+         * @param task - task to be scheduled.
+         * @param delay - delay in milliseconds before task is to be executed.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, or timer was cancelled.
+         */
+        void schedule( TimerTask* task, long long delay )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for execution after the specified delay.
+         *
+         * @param task - task to be scheduled.
+         * @param delay - delay in milliseconds before task is to be executed.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, or timer was cancelled.
+         */
+        void schedule( const decaf::lang::Pointer<TimerTask>& task, long long delay )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for execution at the specified time. If the time is in the past, the
+         * task is scheduled for immediate execution.
+         *
+         * The TimerTask pointer is considered to be owned by the Timer class once it has been scheduled, the
+         * Timer will destroy its TimerTask's once they have been cancelled or the Timer itself is cancelled.
+         * A TimerTask is considered scheduled only when this method return without throwing an exception, until
+         * that time ownership is not considered to have been transferred to the Timer and the caller should
+         * ensure that the TimerTask gets deleted if an exception is thrown and no further attempts to schedule
+         * that TimerTask instance are planned.
+         *
+         * @param task - task to be scheduled.
+         * @param time - time at which task is to be executed.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if time.getTime() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void schedule( TimerTask* task, const Date& time )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for execution at the specified time. If the time is in the past, the
+         * task is scheduled for immediate execution.
+         *
+         * @param task - task to be scheduled.
+         * @param time - time at which task is to be executed.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if time.getTime() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void schedule( const decaf::lang::Pointer<TimerTask>& task, const Date& time )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.
+         * Subsequent executions take place at approximately regular intervals separated by the specified period.
+         *
+         * The TimerTask pointer is considered to be owned by the Timer class once it has been scheduled, the
+         * Timer will destroy its TimerTask's once they have been cancelled or the Timer itself is cancelled.
+         * A TimerTask is considered scheduled only when this method return without throwing an exception, until
+         * that time ownership is not considered to have been transferred to the Timer and the caller should
+         * ensure that the TimerTask gets deleted if an exception is thrown and no further attempts to schedule
+         * that TimerTask instance are planned.
+         *
+         * In fixed-delay execution, each execution is scheduled relative to the actual execution time of the
+         * previous execution. If an execution is delayed for any reason (such as other background activity),
+         * subsequent executions will be delayed as well. In the long run, the frequency of execution will
+         * generally be slightly lower than the reciprocal of the specified period (assuming the system clock
+         * underlying Object.wait(long long) is accurate).
+         *
+         * Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other
+         * words, it is appropriate for activities where it is more important to keep the frequency accurate
+         * in the short run than in the long run. This includes most animation tasks, such as blinking a cursor
+         * at regular intervals. It also includes tasks wherein regular activity is performed in response to
+         * human input, such as automatically repeating a character as long as a key is held down.
+         *
+         * @param task - task to be scheduled.
+         * @param delay - delay in milliseconds before task is to be executed.
+         * @param period - time in milliseconds between successive task executions.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void schedule( TimerTask* task, long long delay, long long period )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.
+         * Subsequent executions take place at approximately regular intervals separated by the specified period.
+         *
+         * In fixed-delay execution, each execution is scheduled relative to the actual execution time of the
+         * previous execution. If an execution is delayed for any reason (such as other background activity),
+         * subsequent executions will be delayed as well. In the long run, the frequency of execution will
+         * generally be slightly lower than the reciprocal of the specified period (assuming the system clock
+         * underlying Object.wait(long long) is accurate).
+         *
+         * Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other
+         * words, it is appropriate for activities where it is more important to keep the frequency accurate
+         * in the short run than in the long run. This includes most animation tasks, such as blinking a cursor
+         * at regular intervals. It also includes tasks wherein regular activity is performed in response to
+         * human input, such as automatically repeating a character as long as a key is held down.
+         *
+         * @param task - task to be scheduled.
+         * @param delay - delay in milliseconds before task is to be executed.
+         * @param period - time in milliseconds between successive task executions.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void schedule( const decaf::lang::Pointer<TimerTask>& task, long long delay, long long period )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for repeated fixed-delay execution, beginning at the specified time.
+         * Subsequent executions take place at approximately regular intervals separated by the specified period.
+         *
+         * The TimerTask pointer is considered to be owned by the Timer class once it has been scheduled, the
+         * Timer will destroy its TimerTask's once they have been cancelled or the Timer itself is cancelled.
+         * A TimerTask is considered scheduled only when this method return without throwing an exception, until
+         * that time ownership is not considered to have been transferred to the Timer and the caller should
+         * ensure that the TimerTask gets deleted if an exception is thrown and no further attempts to schedule
+         * that TimerTask instance are planned.
+         *
+         * In fixed-delay execution, each execution is scheduled relative to the actual execution time of the
+         * previous execution. If an execution is delayed for any reason (such as other background activity),
+         * subsequent executions will be delayed as well. In the long run, the frequency of execution will
+         * generally be slightly lower than the reciprocal of the specified period (assuming the system clock
+         * underlying Object.wait(long long) is accurate).
+         *
+         * Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other
+         * words, it is appropriate for activities where it is more important to keep the frequency accurate
+         * in the short run than in the long run. This includes most animation tasks, such as blinking a cursor
+         * at regular intervals. It also includes tasks wherein regular activity is performed in response to
+         * human input, such as automatically repeating a character as long as a key is held down.
+         *
+         * @param task - task to be scheduled.
+         * @param firstTime - First time at which task is to be executed.
+         * @param period - time in milliseconds between successive task executions.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if time.getTime() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void schedule( TimerTask* task, const Date& firstTime, long long period )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for repeated fixed-delay execution, beginning at the specified time.
+         * Subsequent executions take place at approximately regular intervals separated by the specified period.
+         *
+         * In fixed-delay execution, each execution is scheduled relative to the actual execution time of the
+         * previous execution. If an execution is delayed for any reason (such as other background activity),
+         * subsequent executions will be delayed as well. In the long run, the frequency of execution will
+         * generally be slightly lower than the reciprocal of the specified period (assuming the system clock
+         * underlying Object.wait(long long) is accurate).
+         *
+         * Fixed-delay execution is appropriate for recurring activities that require "smoothness." In other
+         * words, it is appropriate for activities where it is more important to keep the frequency accurate
+         * in the short run than in the long run. This includes most animation tasks, such as blinking a cursor
+         * at regular intervals. It also includes tasks wherein regular activity is performed in response to
+         * human input, such as automatically repeating a character as long as a key is held down.
+         *
+         * @param task - task to be scheduled.
+         * @param firstTime - First time at which task is to be executed.
+         * @param period - time in milliseconds between successive task executions.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if time.getTime() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void schedule( const decaf::lang::Pointer<TimerTask>& task, const Date& firstTime, long long period )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
+         * Subsequent executions take place at approximately regular intervals, separated by the specified period.
+         *
+         * The TimerTask pointer is considered to be owned by the Timer class once it has been scheduled, the
+         * Timer will destroy its TimerTask's once they have been cancelled or the Timer itself is cancelled.
+         * A TimerTask is considered scheduled only when this method return without throwing an exception, until
+         * that time ownership is not considered to have been transferred to the Timer and the caller should
+         * ensure that the TimerTask gets deleted if an exception is thrown and no further attempts to schedule
+         * that TimerTask instance are planned.
+         *
+         * In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the
+         * initial execution. If an execution is delayed for any reason (such as garbage collection or other
+         * background activity), two or more executions will occur in rapid succession to "catch up." In the
+         * long run, the frequency of execution will be exactly the reciprocal of the specified period (assuming
+         * the system clock underlying Object.wait(long) is accurate).
+         *
+         * Fixed-rate execution is appropriate for recurring activities that are sensitive to absolute time, such
+         * as ringing a chime every hour on the hour, or running scheduled maintenance every day at a particular
+         * time. It is also appropriate for recurring activities where the total time to perform a fixed number
+         * of executions is important, such as a countdown timer that ticks once every second for ten seconds.
+         * Finally, fixed-rate execution is appropriate for scheduling multiple repeating timer tasks that must
+         * remain synchronized with respect to one another.
+         *
+         * @param task - task to be scheduled.
+         * @param delay - delay in milliseconds before task is to be executed.
+         * @param period - time in milliseconds between successive task executions.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void scheduleAtFixedRate( TimerTask* task, long long delay, long long period )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
+         * Subsequent executions take place at approximately regular intervals, separated by the specified period.
+         *
+         * In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the
+         * initial execution. If an execution is delayed for any reason (such as garbage collection or other
+         * background activity), two or more executions will occur in rapid succession to "catch up." In the
+         * long run, the frequency of execution will be exactly the reciprocal of the specified period (assuming
+         * the system clock underlying Object.wait(long) is accurate).
+         *
+         * Fixed-rate execution is appropriate for recurring activities that are sensitive to absolute time, such
+         * as ringing a chime every hour on the hour, or running scheduled maintenance every day at a particular
+         * time. It is also appropriate for recurring activities where the total time to perform a fixed number
+         * of executions is important, such as a countdown timer that ticks once every second for ten seconds.
+         * Finally, fixed-rate execution is appropriate for scheduling multiple repeating timer tasks that must
+         * remain synchronized with respect to one another.
+         *
+         * @param task - task to be scheduled.
+         * @param delay - delay in milliseconds before task is to be executed.
+         * @param period - time in milliseconds between successive task executions.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if delay is negative, or delay + System.currentTimeMillis() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void scheduleAtFixedRate( const decaf::lang::Pointer<TimerTask>& task, long long delay, long long period )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for repeated fixed-rate execution, beginning at the specified time.
+         * Subsequent executions take place at approximately regular intervals, separated by the specified period.
+         *
+         * The TimerTask pointer is considered to be owned by the Timer class once it has been scheduled, the
+         * Timer will destroy its TimerTask's once they have been cancelled or the Timer itself is cancelled.
+         * A TimerTask is considered scheduled only when this method return without throwing an exception, until
+         * that time ownership is not considered to have been transferred to the Timer and the caller should
+         * ensure that the TimerTask gets deleted if an exception is thrown and no further attempts to schedule
+         * that TimerTask instance are planned.
+         *
+         * In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the
+         * initial execution. If an execution is delayed for any reason (such as garbage collection or other
+         * background activity), two or more executions will occur in rapid succession to "catch up." In the
+         * long run, the frequency of execution will be exactly the reciprocal of the specified period (assuming
+         * the system clock underlying Object.wait(long) is accurate).
+         *
+         * Fixed-rate execution is appropriate for recurring activities that are sensitive to absolute time, such
+         * as ringing a chime every hour on the hour, or running scheduled maintenance every day at a particular
+         * time. It is also appropriate for recurring activities where the total time to perform a fixed number
+         * of executions is important, such as a countdown timer that ticks once every second for ten seconds.
+         * Finally, fixed-rate execution is appropriate for scheduling multiple repeating timer tasks that must
+         * remain synchronized with respect to one another.
+         *
+         * @param task - task to be scheduled.
+         * @param firstTime - First time at which task is to be executed.
+         * @param period - time in milliseconds between successive task executions.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if time.getTime() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void scheduleAtFixedRate( TimerTask* task, const Date& firstTime, long long period )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+        /**
+         * Schedules the specified task for repeated fixed-rate execution, beginning at the specified time.
+         * Subsequent executions take place at approximately regular intervals, separated by the specified period.
+         *
+         * In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the
+         * initial execution. If an execution is delayed for any reason (such as garbage collection or other
+         * background activity), two or more executions will occur in rapid succession to "catch up." In the
+         * long run, the frequency of execution will be exactly the reciprocal of the specified period (assuming
+         * the system clock underlying Object.wait(long) is accurate).
+         *
+         * Fixed-rate execution is appropriate for recurring activities that are sensitive to absolute time, such
+         * as ringing a chime every hour on the hour, or running scheduled maintenance every day at a particular
+         * time. It is also appropriate for recurring activities where the total time to perform a fixed number
+         * of executions is important, such as a countdown timer that ticks once every second for ten seconds.
+         * Finally, fixed-rate execution is appropriate for scheduling multiple repeating timer tasks that must
+         * remain synchronized with respect to one another.
+         *
+         * @param task - task to be scheduled.
+         * @param firstTime - First time at which task is to be executed.
+         * @param period - time in milliseconds between successive task executions.
+         *
+         * @throw NullPointerException - if the TimerTask value is Null.
+         * @throw IllegalArgumentException - if time.getTime() is negative.
+         * @throw IllegalStateException - if task was already scheduled or cancelled, timer was cancelled, or
+         *                                timer thread terminated.
+         */
+        void scheduleAtFixedRate( const decaf::lang::Pointer<TimerTask>& task, const Date& firstTime, long long period )
+            throw( decaf::lang::exceptions::NullPointerException,
+                   decaf::lang::exceptions::IllegalArgumentException,
+                   decaf::lang::exceptions::IllegalStateException );
+
+    private:
+
+        void scheduleTask( const decaf::lang::Pointer<TimerTask>& task, long long delay, long long period, bool fixed );
+
+    };
+
+}}
+
+#endif /* _DECAF_UTIL_TIMER_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/Timer.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.cpp?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.cpp Tue Jul 21 14:28:11 2009
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#include "TimerTask.h"
+
+#include <decaf/util/concurrent/Concurrent.h>
+
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+
+////////////////////////////////////////////////////////////////////////////////
+TimerTask::TimerTask() :
+    fixedRate( false ), cancelled( false ), scheduledTime( 0 ), when( 0 ), period( -1 ) {
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool TimerTask::cancel() {
+
+    bool result = false;
+    synchronized( &lock ) {
+        result = !cancelled && when > 0;
+        cancelled = true;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long TimerTask::scheduledExecutionTime() const {
+
+    long long result = 0;
+
+    synchronized( &lock ) {
+        result = this->scheduledTime;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool TimerTask::isScheduled() const {
+
+    bool result = false;
+
+    synchronized( &lock ) {
+        result = when > 0 || scheduledTime > 0;
+    }
+
+    return result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TimerTask::setScheduledTime( long long time ) {
+    synchronized( &lock ) {
+        this->scheduledTime = time;
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+long long TimerTask::getWhen() const {
+
+    long long result = 0;
+
+    synchronized( &lock ) {
+        result = this->when;
+    }
+
+    return result;
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.h?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.h Tue Jul 21 14:28:11 2009
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _DECAF_UTIL_TIMERTASK_H_
+#define _DECAF_UTIL_TIMERTASK_H_
+
+#include <decaf/util/Config.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/Mutex.h>
+
+namespace decaf {
+namespace internal{
+    namespace util{
+        class TimerTaskHeap;
+    }
+}
+namespace util {
+
+    class Timer;
+    class TimerImpl;
+
+    /**
+     * A Base class for a task object that can be scheduled for one-time or
+     * repeated execution by a Timer.
+     *
+     * @since 1.0
+     */
+    class DECAF_API TimerTask : public lang::Runnable {
+    private:
+
+        // Timer will use this lock to sync with mutating methods in this class.
+        mutable decaf::util::concurrent::Mutex lock;
+
+        bool fixedRate;
+        bool cancelled;
+        long long scheduledTime;
+        long long when;
+        long long period;
+
+        friend class Timer;
+        friend class TimerImpl;
+        friend class decaf::internal::util::TimerTaskHeap;
+
+    public:
+
+        TimerTask();
+        virtual ~TimerTask() {}
+
+        /**
+         * Cancels this timer task. If the task has been scheduled for one-time execution and has
+         * not yet run, or has not yet been scheduled, it will never run. If the task has been
+         * scheduled for repeated execution, it will never run again. (If the task is running when
+         * this call occurs, the task will run to completion, but will never run again.)
+         *
+         * Note that calling this method from within the run method of a repeating timer task
+         * absolutely guarantees that the timer task will not run again.
+         *
+         * This method may be called repeatedly; the second and subsequent calls have no effect.
+         *
+         * @returns true if this task is scheduled for one-time execution and has not yet run, or this
+         * task is scheduled for repeated execution. Returns false if the task was scheduled for one-time
+         * execution and has already run, or if the task was never scheduled, or if the task was already
+         * canceled. (Loosely speaking, this method returns true if it prevents one or more scheduled
+         * executions from taking place.)
+         */
+        bool cancel();
+
+        /**
+         * Returns the scheduled 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.)
+         *
+         * This method is typically invoked from within a task's run method, to determine whether the current
+         * execution of the task is sufficiently timely to warrant performing the scheduled activity:
+         *
+         *      void run() {
+         *          if( System::currentTimeMillis() - scheduledExecutionTime() >=
+         *              MAX_TARDINESS)
+         *                  return;  // Too late; skip this execution.
+         *          // Perform the task
+         *      }
+         *
+         * This method is typically not used in conjunction with fixed-delay execution repeating tasks, as
+         * their scheduled execution times are allowed to drift over time, and so are not terribly significant.
+         *
+         * @returns the time at which the most recent execution of this task was scheduled to occur, in the
+         * format returned by Date.getTime(). The return value is undefined if the task has yet to commence its
+         * first execution.
+         */
+        long long scheduledExecutionTime() const;
+
+    protected:
+
+        bool isScheduled() const;
+        void setScheduledTime( long long time );
+        long long getWhen() const;
+
+    };
+
+}}
+
+#endif /* _DECAF_UTIL_TIMERTASK_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/TimerTask.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/comparators/Less.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/comparators/Less.h?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/comparators/Less.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/comparators/Less.h Tue Jul 21 14:28:11 2009
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _DECAF_UTIL_COMPARATORS_LESS_H_
+#define _DECAF_UTIL_COMPARATORS_LESS_H_
+
+#include <decaf/util/Comparator.h>
+
+namespace decaf {
+namespace util {
+namespace comparators {
+
+    /**
+     * Simple Less Comparator that compares to elements to determine if the first is
+     * less than the second.  This can be used in Collection classes to sort elements
+     * according to their natural ordering.  By design the Comparator's compare function
+     * return more information about comparison than the STL binary function's boolean
+     * compare operator.  In this case the compare method will return
+     *
+     * @since 1.0
+     */
+    template< typename E >
+    class Less : public decaf::util::Comparator<E> {
+    public:
+
+        Less() {}
+        virtual ~Less() {}
+
+        virtual bool operator() ( const E& left, const E& right ) const {
+            return left < right;
+        }
+
+        virtual int compare( const E& o1, const E& o2 ) const {
+
+            if( o1 > o2 ) {
+                return 1;
+            } else if( o1 < o2 ) {
+                return -1;
+            }
+
+            return 0;
+        }
+
+    };
+
+}}}
+
+#endif /* _DECAF_UTIL_COMPARATORS_LESS_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/comparators/Less.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Callable.h Tue Jul 21 14:28:11 2009
@@ -25,6 +25,15 @@
 namespace util {
 namespace concurrent {
 
+    /**
+     * A task that returns a result and may throw an exception. Implementors define a single method with no
+     * arguments called call.  This interface differs from the Runnable interface in that a Callable object
+     * can return a result and is allowed to throw an exceptions from its call method.
+     *
+     * The Executors class contains utility methods to convert from other common forms to Callable classes.
+     *
+     * @since 1.0
+     */
     template<typename V>
     class DECAF_API Callable {
     public:

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Concurrent.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Concurrent.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Concurrent.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Concurrent.h Tue Jul 21 14:28:11 2009
@@ -25,9 +25,9 @@
 namespace concurrent{
 
 /**
- * The synchronized macro defines a mechanism for snycronizing
+ * The synchronized macro defines a mechanism for synchronizing
  * a section of code.  The macro must be passed an object that
- * implements the Syncronizable interface.
+ * implements the Synchronizable interface.
  *
  * The macro works by creating a for loop that will loop exactly
  * once, creating a Lock object that is scoped to the loop.  Once
@@ -39,13 +39,13 @@
  *
  * The macro would be used as follows.
  *
- * Syncronizable X;
+ * Synchronizable X;
  *
  * somefunction()
  * {
- *    syncronized(X)
+ *    synchronized(X)
  *    {
- *       // Do something that needs syncronizing.
+ *       // Do something that needs synchronizing.
  *    }
  * }
  */

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ConcurrentStlMap.h Tue Jul 21 14:28:11 2009
@@ -470,8 +470,12 @@
             mutex.wait();
         }
 
-        virtual void wait( unsigned long millisecs ) throw( lang::Exception ) {
-            mutex.wait(millisecs);
+        virtual void wait( long long millisecs ) throw( lang::Exception ) {
+            mutex.wait( millisecs );
+        }
+
+        virtual void wait( long long millisecs, int nanos ) throw( lang::Exception ) {
+            mutex.wait( millisecs, nanos );
         }
 
         virtual void notify() throw( lang::Exception ) {

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h Tue Jul 21 14:28:11 2009
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _DECAF_UTIL_CONCURRENT_EXECUTORSERVICE_H_
+#define _DECAF_UTIL_CONCURRENT_EXECUTORSERVICE_H_
+
+#include <decaf/util/Config.h>
+
+#include <decaf/util/concurrent/Executor.h>
+#include <decaf/util/concurrent/TimeUnit.h>
+#include <decaf/lang/exceptions/InterruptedException.h>
+
+namespace decaf {
+namespace util {
+namespace concurrent {
+
+    /**
+     * An Executor that provides methods to manage termination and methods that can produce a Future for
+     * tracking progress of one or more asynchronous tasks.
+     *
+     * An ExecutorService can be shut down, which will cause it to reject new tasks. Two different methods
+     * are provided for shutting down an ExecutorService. The shutdown() method will allow previously
+     * submitted tasks to execute before terminating, while the shutdownNow() method prevents waiting tasks
+     * from starting and attempts to stop currently executing tasks. Upon termination, an executor has no
+     * tasks actively executing, no tasks awaiting execution, and no new tasks can be submitted. An unused
+     * ExecutorService should be shut down to allow reclamation of its resources.
+     *
+     * Method submit extends base method Executor.execute(decaf.lang.Runnable) by creating and returning a
+     * Future that can be used to cancel execution and/or wait for completion. Methods invokeAny and invokeAll
+     * perform the most commonly useful forms of bulk execution, executing a collection of tasks and then
+     * waiting for at least one, or all, to complete. (Class ExecutorCompletionService can be used to write
+     * customized variants of these methods.)
+     *
+     * The Executors class provides factory methods for the executor services provided in this package.
+     *
+     * @since 1.0
+     */
+    class ExecutorService : public Executor {
+    public:
+
+        virtual ~ExecutorService() {}
+
+        /**
+         * Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs,
+         * or the current thread is interrupted, whichever happens first.
+         *
+         * @param timeout
+         *      The amount of time to wait before timing out the Wait operation.
+         * @param unit
+         *      The Units that comprise the timeout value.
+         *
+         * @returns true if the executer terminated before the given timeout value elapsed.
+         *
+         * @throws InterruptedException - if interrupted while waiting.
+         */
+        bool awaitTermination( long long timeout, const TimeUnit& unit )
+            throw( decaf::lang::exceptions::InterruptedException ) = 0;
+
+    };
+
+}}}
+
+#endif /* _DECAF_UTIL_CONCURRENT_EXECUTORSERVICE_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/ExecutorService.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Lock.h Tue Jul 21 14:28:11 2009
@@ -29,10 +29,10 @@
     /**
      * A wrapper class around a given synchronization mechanism that
      * provides automatic release upon destruction.
-     * @author  Nathan Mittler
+     *
+     * @since 1.0
      */
-    class Lock
-    {
+    class Lock {
     private:
 
         /**
@@ -46,6 +46,11 @@
          */
         Synchronizable* syncObject;
 
+    private:
+
+        Lock( const Lock& src );
+        Lock& operator= ( const Lock& src );
+
     public:
 
         /**
@@ -55,14 +60,13 @@
          * @param   intiallyLocked  If true, the object will automatically
          * be locked.
          */
-        Lock( Synchronizable* object, const bool intiallyLocked = true )
-        {
+        Lock( Synchronizable* object, const bool intiallyLocked = true ) {
+
             try{
                 syncObject = object;
                 locked = false;
 
-                if( intiallyLocked )
-                {
+                if( intiallyLocked ) {
                     lock();
                 }
             }
@@ -73,12 +77,11 @@
         /**
          * Destructor - Unlocks the object if it is locked.
          */
-        virtual ~Lock()
-        {
+        virtual ~Lock() {
             try{
-                if( locked )
-                {
-                  syncObject->unlock();
+
+                if( locked ) {
+                    syncObject->unlock();
                 }
             }
             DECAF_CATCH_RETHROW( lang::Exception )
@@ -88,8 +91,7 @@
         /**
          * Locks the object.
          */
-        void lock()
-        {
+        void lock() {
             try{
                 syncObject->lock();
                 locked = true;
@@ -99,13 +101,13 @@
         }
 
         /**
-         * Unlocks the object.
+         * Unlocks the object if it is already locked, otherwise a call to this method has
+         * no effect.
          */
-        void unlock()
-        {
+        void unlock() {
+
             try{
-                 if(locked)
-                 {
+                 if( locked ) {
                      syncObject->unlock();
                      locked = false;
                  }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Mutex.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Mutex.cpp?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Mutex.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Mutex.cpp Tue Jul 21 14:28:11 2009
@@ -83,8 +83,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void Mutex::wait( unsigned long millisecs )
-    throw( lang::Exception ) {
+void Mutex::wait( long long millisecs ) throw( lang::Exception ) {
 
     if( !isLockOwner() ) {
         throw lang::Exception(
@@ -132,6 +131,12 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+void Mutex::wait( long long millisecs, int nanos DECAF_UNUSED ) throw( lang::Exception ) {
+    // For now delegate to the single arg version.
+    this->wait( millisecs );
+}
+
+////////////////////////////////////////////////////////////////////////////////
 void Mutex::notify() throw( lang::Exception )
 {
     if( !isLockOwner() ) {

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Mutex.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Mutex.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Mutex.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Mutex.h Tue Jul 21 14:28:11 2009
@@ -63,58 +63,22 @@
 
     public:
 
-        /**
-         * Constructor - creates and initializes the mutex.
-         */
         Mutex();
 
-        /**
-         * Destructor - destroys the mutex object.
-         */
         virtual ~Mutex();
 
-        /**
-         * Locks the object.
-         * @throws ActiveMQException
-         */
         virtual void lock() throw( lang::Exception );
 
-        /**
-         * Unlocks the object.
-         * @throws ActiveMQException
-         */
         virtual void unlock() throw( lang::Exception );
 
-        /**
-         * Waits on a signal from this object, which is generated
-         * by a call to Notify.
-         * @throws ActiveMQException
-         */
         virtual void wait() throw( lang::Exception );
 
-        /**
-         * Waits on a signal from this object, which is generated
-         * by a call to Notify.  Must have this object locked before
-         * calling.  This wait will timeout after the specified time
-         * interval.
-         * @param millisecs the time in milliseconds to wait.
-         * @throws ActiveMQException
-         */
-        virtual void wait( unsigned long millisecs )
-            throw( lang::Exception );
+        virtual void wait( long long millisecs ) throw( lang::Exception );
+
+        virtual void wait( long long millisecs, int nanos ) throw( lang::Exception );
 
-        /**
-         * Signals a waiter on this object that it can now wake
-         * up and continue.
-         * @throws ActiveMQException
-         */
         virtual void notify() throw( lang::Exception );
 
-        /**
-         * Signals the waiters on this object that it can now wake
-         * up and continue.
-         * @throws ActiveMQException
-         */
         virtual void notifyAll() throw( lang::Exception );
 
     private:

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/RejectedExecutionException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/RejectedExecutionException.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/RejectedExecutionException.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/RejectedExecutionException.h Tue Jul 21 14:28:11 2009
@@ -25,6 +25,8 @@
 
     /*
      * Exception thrown by an Executor when a task cannot be accepted for execution.
+     *
+     * @since 1.0
      */
     class DECAF_API RejectedExecutionException : public decaf::lang::Exception {
     public:

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Synchronizable.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Synchronizable.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Synchronizable.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/decaf/util/concurrent/Synchronizable.h Tue Jul 21 14:28:11 2009
@@ -28,12 +28,13 @@
     /**
      * The interface for all synchronizable objects (that is, objects
      * that can be locked and unlocked).
+     *
+     * @since 1.0
      */
-    class DECAF_API Synchronizable
-    {
+    class DECAF_API Synchronizable {
     public:
 
-        virtual ~Synchronizable(){}
+        virtual ~Synchronizable() {}
 
         /**
          * Locks the object.
@@ -51,6 +52,7 @@
          * Waits on a signal from this object, which is generated
          * by a call to Notify.  Must have this object locked before
          * calling.
+         *
          * @throws Exception
          */
         virtual void wait() throw( lang::Exception ) = 0;
@@ -60,17 +62,40 @@
          * by a call to Notify.  Must have this object locked before
          * calling.  This wait will timeout after the specified time
          * interval.
-         * @param millisecs the time in millisecsonds to wait, or
-         * WAIT_INIFINITE
-         * @throws Exception
+         *
+         * @param millisecs
+         *      the time in milliseconds to wait, or WAIT_INIFINITE
+         *
+         * @throws Exception
+         */
+        virtual void wait( long long millisecs ) throw( lang::Exception ) = 0;
+
+        /**
+         * Waits on a signal from this object, which is generated by a call to Notify.
+         * Must have this object locked before calling.  This wait will timeout after the
+         * specified time interval.  This method is similar to the one argument wait function
+         * except that it add a finer grained control over the amount of time that it waits
+         * by adding in the additional nanosecond argument.
+         *
+         * NOTE: The ability to wait accurately at a nanosecond scale depends on the platform
+         * and OS that the Decaf API is running on, some systems do not provide an accurate
+         * enough clock to provide this level of granularity.
+         *
+         * @param millisecs
+         *      the time in milliseconds to wait, or WAIT_INIFINITE
+         * @param nanos
+         *      additional time in nanoseconds with a range of 0-999999
+         *
+         * @throws Exception if an error occurs or the nanos argument is not in the range of
+         *         0-999999
          */
-        virtual void wait(unsigned long millisecs)
-            throw( lang::Exception ) = 0;
+        virtual void wait( long long millisecs, int nanos ) throw( lang::Exception ) = 0;
 
         /**
          * Signals a waiter on this object that it can now wake
          * up and continue.  Must have this object locked before
          * calling.
+         *
          * @throws Exception
          */
         virtual void notify() throw( lang::Exception ) = 0;
@@ -79,6 +104,7 @@
          * Signals the waiters on this object that it can now wake
          * up and continue.  Must have this object locked before
          * calling.
+         *
          * @throws Exception
          */
         virtual void notifyAll() throw( lang::Exception ) = 0;

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am Tue Jul 21 14:28:11 2009
@@ -78,6 +78,7 @@
     decaf/internal/nio/LongArrayBufferTest.cpp \
     decaf/internal/nio/ShortArrayBufferTest.cpp \
     decaf/internal/util/ByteArrayAdapterTest.cpp \
+    decaf/internal/util/TimerTaskHeapTest.cpp \
     decaf/io/BufferedInputStreamTest.cpp \
     decaf/io/BufferedOutputStreamTest.cpp \
     decaf/io/ByteArrayInputStreamTest.cpp \
@@ -109,12 +110,14 @@
     decaf/util/DateTest.cpp \
     decaf/util/Endian.cpp \
     decaf/util/ListTest.cpp \
+    decaf/util/PriorityQueueTest.cpp \
     decaf/util/PropertiesTest.cpp \
     decaf/util/QueueTest.cpp \
     decaf/util/RandomTest.cpp \
     decaf/util/SetTest.cpp \
     decaf/util/StlMapTest.cpp \
     decaf/util/StringTokenizerTest.cpp \
+    decaf/util/TimerTest.cpp \
     decaf/util/UUIDTest.cpp \
     decaf/util/concurrent/ConcurrentStlMapTest.cpp \
     decaf/util/concurrent/CountDownLatchTest.cpp \
@@ -200,6 +203,7 @@
     decaf/internal/nio/LongArrayBufferTest.h \
     decaf/internal/nio/ShortArrayBufferTest.h \
     decaf/internal/util/ByteArrayAdapterTest.h \
+    decaf/internal/util/TimerTaskHeapTest.h \
     decaf/io/BufferedInputStreamTest.h \
     decaf/io/BufferedOutputStreamTest.h \
     decaf/io/ByteArrayInputStreamTest.h \
@@ -231,12 +235,14 @@
     decaf/util/DateTest.h \
     decaf/util/Endian.h \
     decaf/util/ListTest.h \
+    decaf/util/PriorityQueueTest.h \
     decaf/util/PropertiesTest.h \
     decaf/util/QueueTest.h \
     decaf/util/RandomTest.h \
     decaf/util/SetTest.h \
     decaf/util/StlMapTest.h \
     decaf/util/StringTokenizerTest.h \
+    decaf/util/TimerTest.h \
     decaf/util/UUIDTest.h \
     decaf/util/concurrent/ConcurrentStlMapTest.h \
     decaf/util/concurrent/CountDownLatchTest.h \
@@ -254,10 +260,10 @@
 ## include activemq/wireformat/openwire/marshal/v3/srcmakefile.mk
 
 ## Compile this as part of make check
-## check_PROGRAMS = activemq-test
+check_PROGRAMS = activemq-test
 
 ## Also run the tests as part of make check
-TESTS = $(check_PROGRAMS)
+## TESTS = $(check_PROGRAMS)
 
 ## 
 ## Compiler/Linker Options

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.cpp?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.cpp Tue Jul 21 14:28:11 2009
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#include "TimerTaskHeapTest.h"
+
+#include <decaf/internal/util/TimerTaskHeap.h>
+#include <decaf/util/TimerTask.h>
+#include <decaf/lang/Pointer.h>
+
+using namespace decaf;
+using namespace decaf::internal;
+using namespace decaf::internal::util;
+using namespace decaf::util;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+class TestTimerTask : public TimerTask {
+public:
+
+    virtual void run() {}
+};
+
+////////////////////////////////////////////////////////////////////////////////
+void TimerTaskHeapTest::testCreate() {
+
+    TimerTaskHeap heap;
+
+    CPPUNIT_ASSERT( heap.isEmpty() == true );
+    CPPUNIT_ASSERT( heap.peek() == NULL );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TimerTaskHeapTest::testInsert() {
+
+    TimerTaskHeap heap;
+
+    Pointer<TestTimerTask> task1( new TestTimerTask() );
+    Pointer<TestTimerTask> task2( new TestTimerTask() );
+    Pointer<TestTimerTask> task3( new TestTimerTask() );
+
+    CPPUNIT_ASSERT( heap.isEmpty() == true );
+
+    heap.insert( task1 );
+    heap.insert( task2 );
+    heap.insert( task3 );
+
+    CPPUNIT_ASSERT( heap.isEmpty() == false );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TimerTaskHeapTest::testRemove() {
+
+    TimerTaskHeap heap;
+
+    Pointer<TestTimerTask> task1( new TestTimerTask() );
+    Pointer<TestTimerTask> task2( new TestTimerTask() );
+    Pointer<TestTimerTask> task3( new TestTimerTask() );
+
+    CPPUNIT_ASSERT( heap.isEmpty() == true );
+
+    heap.insert( task1 );
+    heap.insert( task2 );
+    heap.insert( task3 );
+
+    CPPUNIT_ASSERT( heap.isEmpty() == false );
+
+    std::size_t pos;
+
+    pos = heap.find( task1 );
+    CPPUNIT_ASSERT( pos != (std::size_t)-1 );
+    heap.remove( pos );
+    CPPUNIT_ASSERT( heap.isEmpty() == false );
+
+    pos = heap.find( task2 );
+    CPPUNIT_ASSERT( pos != (std::size_t)-1 );
+    heap.remove( pos );
+    CPPUNIT_ASSERT( heap.isEmpty() == false );
+
+    pos = heap.find( task3 );
+    CPPUNIT_ASSERT( pos != (std::size_t)-1 );
+    heap.remove( pos );
+    CPPUNIT_ASSERT( heap.isEmpty() == true );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void TimerTaskHeapTest::testFind() {
+
+    TimerTaskHeap heap;
+
+    Pointer<TestTimerTask> task1( new TestTimerTask() );
+
+    CPPUNIT_ASSERT( heap.isEmpty() == true );
+
+    heap.insert( task1 );
+
+    CPPUNIT_ASSERT( heap.isEmpty() == false );
+
+    std::size_t pos;
+
+    pos = heap.find( task1 );
+    CPPUNIT_ASSERT( pos != (std::size_t)-1 );
+    heap.remove( pos );
+    CPPUNIT_ASSERT( heap.isEmpty() == true );
+    pos = heap.find( task1 );
+    CPPUNIT_ASSERT( pos == (std::size_t)-1 );
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.h?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.h Tue Jul 21 14:28:11 2009
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _DECAF_INTERNAL_UTIL_TIMERTASKHEAPTEST_H_
+#define _DECAF_INTERNAL_UTIL_TIMERTASKHEAPTEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace internal {
+namespace util {
+
+    class TimerTaskHeapTest : public CppUnit::TestFixture {
+
+        CPPUNIT_TEST_SUITE( TimerTaskHeapTest );
+        CPPUNIT_TEST( testCreate );
+        CPPUNIT_TEST( testInsert );
+        CPPUNIT_TEST( testRemove );
+        CPPUNIT_TEST( testFind );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        TimerTaskHeapTest() {}
+        virtual ~TimerTaskHeapTest() {}
+
+        void testCreate();
+        void testInsert();
+        void testRemove();
+        void testFind();
+
+    };
+
+}}}
+
+#endif /* _DECAF_INTERNAL_UTIL_TIMERTASKHEAPTEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/internal/util/TimerTaskHeapTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedInputStreamTest.h Tue Jul 21 14:28:11 2009
@@ -157,18 +157,21 @@
 
             virtual bool markSupported() const{ return false; }
 
-            virtual void lock() throw(lang::Exception){
+            virtual void lock() throw( lang::Exception ) {
             }
-            virtual void unlock() throw(lang::Exception){
+            virtual void unlock() throw( lang::Exception ) {
             }
-            virtual void wait() throw(lang::Exception){
+            virtual void wait() throw( lang::Exception ) {
             }
-            virtual void wait(unsigned long millisecs DECAF_UNUSED) throw(lang::Exception){
+            virtual void wait( long long millisecs DECAF_UNUSED ) throw( lang::Exception ) {
             }
-            virtual void notify() throw(lang::Exception){
+            virtual void wait( long long millisecs DECAF_UNUSED, int nanos DECAF_UNUSED ) throw( lang::Exception ) {
             }
-            virtual void notifyAll() throw(lang::Exception){
+            virtual void notify() throw( lang::Exception ) {
             }
+            virtual void notifyAll() throw( lang::Exception ) {
+            }
+
         };
 
     };

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/BufferedOutputStreamTest.h Tue Jul 21 14:28:11 2009
@@ -122,17 +122,19 @@
                 // do nothing.
             }
 
-            virtual void lock() throw(lang::Exception){
+            virtual void lock() throw( lang::Exception ) {
             }
-            virtual void unlock() throw(lang::Exception){
+            virtual void unlock() throw( lang::Exception ) {
             }
-            virtual void wait() throw(lang::Exception){
+            virtual void wait() throw( lang::Exception ) {
             }
-            virtual void wait(unsigned long millisecs DECAF_UNUSED) throw(lang::Exception){
+            virtual void wait( long long millisecs DECAF_UNUSED ) throw( lang::Exception ) {
             }
-            virtual void notify() throw(lang::Exception){
+            virtual void wait( long long millisecs DECAF_UNUSED, int nanos DECAF_UNUSED ) throw( lang::Exception ) {
             }
-            virtual void notifyAll() throw(lang::Exception){
+            virtual void notify() throw( lang::Exception ) {
+            }
+            virtual void notifyAll() throw( lang::Exception ) {
             }
         };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/FilterInputStreamTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/FilterInputStreamTest.h?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/FilterInputStreamTest.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/io/FilterInputStreamTest.h Tue Jul 21 14:28:11 2009
@@ -152,17 +152,19 @@
 
             virtual bool markSupported() const{ return false; }
 
-            virtual void lock() throw(lang::Exception){
+            virtual void lock() throw( lang::Exception ) {
             }
-            virtual void unlock() throw(lang::Exception){
+            virtual void unlock() throw( lang::Exception ) {
             }
-            virtual void wait() throw(lang::Exception){
+            virtual void wait() throw( lang::Exception ) {
             }
-            virtual void wait(unsigned long millisecs DECAF_UNUSED) throw(lang::Exception){
+            virtual void wait( long long millisecs DECAF_UNUSED ) throw( lang::Exception ) {
             }
-            virtual void notify() throw(lang::Exception){
+            virtual void wait( long long millisecs DECAF_UNUSED, int nanos DECAF_UNUSED ) throw( lang::Exception ) {
             }
-            virtual void notifyAll() throw(lang::Exception){
+            virtual void notify() throw( lang::Exception ) {
+            }
+            virtual void notifyAll() throw( lang::Exception ) {
             }
         };
 

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.cpp?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.cpp (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.cpp Tue Jul 21 14:28:11 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#include "PriorityQueueTest.h"
+
+#include <decaf/util/PriorityQueue.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+
+////////////////////////////////////////////////////////////////////////////////
+void PriorityQueueTest::testConstructor_1() {
+
+    //PriorityQueue<int> pqueue;
+
+}

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.h?rev=796317&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.h (added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.h Tue Jul 21 14:28:11 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+#ifndef _DECAF_UTIL_PRIORITYQUEUETEST_H_
+#define _DECAF_UTIL_PRIORITYQUEUETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace decaf {
+namespace util {
+
+    class PriorityQueueTest : public CppUnit::TestFixture {
+
+        CPPUNIT_TEST_SUITE( PriorityQueueTest );
+        CPPUNIT_TEST( testConstructor_1 );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        PriorityQueueTest();
+        virtual ~PriorityQueueTest();
+
+        void testConstructor_1();
+
+    };
+
+}}
+
+#endif /* _DECAF_UTIL_PRIORITYQUEUETEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/PriorityQueueTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/StlMapTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/StlMapTest.cpp?rev=796317&r1=796316&r2=796317&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/StlMapTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/decaf/util/StlMapTest.cpp Tue Jul 21 14:28:11 2009
@@ -263,8 +263,12 @@
         mutex.wait();
     }
 
-    virtual void wait( unsigned long millisecs ) throw( lang::Exception ) {
-        mutex.wait(millisecs);
+    virtual void wait( long long millisecs ) throw( lang::Exception ) {
+        mutex.wait( millisecs );
+    }
+
+    virtual void wait( long long millisecs, int nanos ) throw( lang::Exception ) {
+        mutex.wait( millisecs, nanos );
     }
 
     virtual void notify() throw( lang::Exception ) {