activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r712348 - in /activemq/activemq-cpp/trunk/src/main: ./ decaf/util/concurrent/
Date Sat, 08 Nov 2008 03:25:04 GMT
Author: tabish
Date: Fri Nov  7 19:25:03 2008
New Revision: 712348

URL: http://svn.apache.org/viewvc?rev=712348&view=rev
Log:
Add some additional interfaces to Decaf

Added:
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/BrokenBarrierException.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/CancellationException.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ExecutionException.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Executor.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/RejectedExecutionException.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadFactory.h
    activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TimeoutException.h
Modified:
    activemq/activemq-cpp/trunk/src/main/Makefile.am

Modified: activemq/activemq-cpp/trunk/src/main/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/Makefile.am?rev=712348&r1=712347&r2=712348&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/src/main/Makefile.am Fri Nov  7 19:25:03 2008
@@ -382,18 +382,25 @@
     decaf/io/InputStream.h \
     decaf/io/IOException.h \
     decaf/io/InterruptedIOException.h \
-    decaf/util/concurrent/Lock.h \
+    decaf/util/concurrent/BrokenBarrierException.h \
     decaf/util/concurrent/Delayed.h \
     decaf/util/concurrent/Callable.h \
+    decaf/util/concurrent/CancelationException.h \
     decaf/util/concurrent/Concurrent.h \
     decaf/util/concurrent/CountDownLatch.h \
-    decaf/util/concurrent/Synchronizable.h \
+    decaf/util/concurrent/Executor.h \
+    decaf/util/concurrent/ExecutionException.h \
+    decaf/util/concurrent/Lock.h \
     decaf/util/concurrent/Mutex.h \
     decaf/util/concurrent/PooledThread.h \
     decaf/util/concurrent/PooledThreadListener.h \
+    decaf/util/concurrent/RejectedExecutionException.h \
+    decaf/util/concurrent/Synchronizable.h \
     decaf/util/concurrent/TaskListener.h \
     decaf/util/concurrent/TimeUnit.h \
     decaf/util/concurrent/ThreadPool.h \
+    decaf/util/concurrent/ThreadFactory.h \
+    decaf/util/concurrent/TimeoutException.h \
     decaf/util/concurrent/atomic/AtomicBoolean.h \
     decaf/util/concurrent/atomic/AtomicInteger.h \
     decaf/util/concurrent/locks/Lock.h \

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/BrokenBarrierException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/BrokenBarrierException.h?rev=712348&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/BrokenBarrierException.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/BrokenBarrierException.h Fri
Nov  7 19:25:03 2008
@@ -0,0 +1,129 @@
+/*
+ * 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_BROKENBARRIEREXCEPTION_H_
+#define _DECAF_UTIL_CONCURRENT_BROKENBARRIEREXCEPTION_H_
+
+#include <decaf/lang/Exception.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    /*
+     * Exception thrown when a thread tries to wait upon a barrier that is in a broken
+     * state, or which enters the broken state while the thread is waiting.
+     */
+    class DECAF_API BrokenBarrierException : public decaf::lang::Exception
+    {
+    public:
+
+        /**
+         * Default Constructor
+         */
+        BrokenBarrierException() throw() : decaf::lang::Exception() {}
+
+        /**
+         * Conversion Constructor from some other Exception
+         * @param An exception that should become this type of Exception
+         */
+        BrokenBarrierException( const decaf::lang::Exception& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Copy Constructor
+         */
+        BrokenBarrierException( const BrokenBarrierException& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Constructor
+         * @param cause Pointer to the exception that caused this one to
+         * be thrown, the object is cloned caller retains ownership.
+         */
+        BrokenBarrierException( const std::exception* cause )
+            throw() : decaf::lang::Exception( cause ) {}
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        BrokenBarrierException( const char* file, const int lineNumber,
+                                const char* msg, ... ) throw()
+            : decaf::lang::Exception()
+        {
+
+            va_list vargs;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param cause The exception that was the cause for this one to be thrown.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        BrokenBarrierException( const char* file, const int lineNumber,
+                                const std::exception* cause,
+                                const char* msg, ... ) throw()
+            : decaf::lang::Exception( cause )
+        {
+            va_list vargs ;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual BrokenBarrierException* clone() const{
+            return new BrokenBarrierException( *this );
+        }
+
+        /**
+         * Destructor
+         */
+        virtual ~BrokenBarrierException() throw() {}
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_BROKENBARRIEREXCEPTION_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/CancellationException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/CancellationException.h?rev=712348&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/CancellationException.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/CancellationException.h Fri
Nov  7 19:25:03 2008
@@ -0,0 +1,129 @@
+/*
+ * 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_CANCELLATIONEXCEPTION_H_
+#define _DECAF_UTIL_CONCURRENT_CANCELLATIONEXCEPTION_H_
+
+#include <decaf/lang/Exception.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    /*
+     * Exception indicating that the result of a value-producing task, such as a
+     * FutureTask, cannot be retrieved because the task was canceled.
+     */
+    class DECAF_API CancellationException : public decaf::lang::Exception
+    {
+    public:
+
+        /**
+         * Default Constructor
+         */
+        CancellationException() throw() : decaf::lang::Exception() {}
+
+        /**
+         * Conversion Constructor from some other Exception
+         * @param An exception that should become this type of Exception
+         */
+        CancellationException( const decaf::lang::Exception& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Copy Constructor
+         */
+        CancellationException( const CancellationException& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Constructor
+         * @param cause Pointer to the exception that caused this one to
+         * be thrown, the object is cloned caller retains ownership.
+         */
+        CancellationException( const std::exception* cause )
+            throw() : decaf::lang::Exception( cause ) {}
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        CancellationException( const char* file, const int lineNumber,
+                               const char* msg, ... ) throw()
+            : decaf::lang::Exception()
+        {
+
+            va_list vargs;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param cause The exception that was the cause for this one to be thrown.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        CancellationException( const char* file, const int lineNumber,
+                                const std::exception* cause,
+                                const char* msg, ... ) throw()
+            : decaf::lang::Exception( cause )
+        {
+            va_list vargs ;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual CancellationException* clone() const{
+            return new CancellationException( *this );
+        }
+
+        /**
+         * Destructor
+         */
+        virtual ~CancellationException() throw() {}
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_CANCELLATIONEXCEPTION_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ExecutionException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ExecutionException.h?rev=712348&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ExecutionException.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ExecutionException.h Fri Nov
 7 19:25:03 2008
@@ -0,0 +1,130 @@
+/*
+ * 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_EXECUTIONEXCEPTION_H_
+#define _DECAF_UTIL_CONCURRENT_EXECUTIONEXCEPTION_H_
+
+#include <decaf/lang/Exception.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    /*
+     * Exception thrown when attempting to retrieve the result of a task that aborted by
+     * throwing an exception. This exception can be inspected using the Throwable.getCause()
+     * method.
+     */
+    class DECAF_API ExecutionException : public decaf::lang::Exception
+    {
+    public:
+
+        /**
+         * Default Constructor
+         */
+        ExecutionException() throw() : decaf::lang::Exception() {}
+
+        /**
+         * Conversion Constructor from some other Exception
+         * @param An exception that should become this type of Exception
+         */
+        ExecutionException( const decaf::lang::Exception& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Copy Constructor
+         */
+        ExecutionException( const ExecutionException& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Constructor
+         * @param cause Pointer to the exception that caused this one to
+         * be thrown, the object is cloned caller retains ownership.
+         */
+        ExecutionException( const std::exception* cause )
+            throw() : decaf::lang::Exception( cause ) {}
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        ExecutionException( const char* file, const int lineNumber,
+                            const char* msg, ... ) throw()
+            : decaf::lang::Exception()
+        {
+
+            va_list vargs;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param cause The exception that was the cause for this one to be thrown.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        ExecutionException( const char* file, const int lineNumber,
+                            const std::exception* cause,
+                            const char* msg, ... ) throw()
+            : decaf::lang::Exception( cause )
+        {
+            va_list vargs ;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual ExecutionException* clone() const{
+            return new ExecutionException( *this );
+        }
+
+        /**
+         * Destructor
+         */
+        virtual ~ExecutionException() throw() {}
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_EXECUTIONEXCEPTION_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Executor.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Executor.h?rev=712348&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Executor.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Executor.h Fri Nov  7 19:25:03
2008
@@ -0,0 +1,111 @@
+/*
+ * 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_EXECUTOR_H_
+#define _DECAF_UTIL_CONCURRENT_EXECUTOR_H_
+
+#include <decaf/util/Config.h>
+
+#include <decaf/lang/Runnable.h>
+#include <decaf/lang/exceptions/NullPointerException.h>
+#include <decaf/util/concurrent/RejectedExecutionException.h>
+
+namespace decaf {
+namespace util {
+namespace concurrent {
+
+    /**
+     * An object that executes submitted {@link Runnable} tasks. This
+     * interface provides a way of decoupling task submission from the
+     * mechanics of how each task will be run, including details of thread
+     * use, scheduling, etc.  An <tt>Executor</tt> is normally used
+     * instead of explicitly creating threads. For example, rather than
+     * invoking <tt>new Thread(new(RunnableTask())).start()</tt> for each
+     * of a set of tasks, you might use:
+     *
+     * <pre>
+     * Executor executor = <em>anExecutor</em>;
+     * executor->execute( new RunnableTask1() );
+     * executor->execute( new RunnableTask2() );
+     * ...
+     * </pre>
+     *
+     * However, the <tt>Executor</tt> interface does not strictly
+     * require that execution be asynchronous. In the simplest case, an
+     * executor can run the submitted task immediately in the caller's
+     * thread:
+     *
+     * <pre>
+     * class DirectExecutor : public Executor {
+     * public:
+     *
+     *     void execute( Runnable* r ) {
+     *         r->run();
+     *     }
+     *
+     * }</pre>
+     *
+     * More typically, tasks are executed in some thread other
+     * than the caller's thread.  The executor below spawns a new thread
+     * for each task.
+     *
+     * <pre>
+     * class ThreadPerTaskExecutor : public Executor {
+     * public:
+     *     std::vector&lt;Thread*gt; threads;
+     *
+     *     void execute( Runnable* r ) {
+     *         threads.push_back( new Thread( r ) );
+     *         threads.rbegin()->start();
+     *     }
+     *
+     * }</pre>
+     *
+     * The <tt>Executor</tt> implementations provided in this package
+     * implement {@link ExecutorService}, which is a more extensive
+     * interface.  The {@link ThreadPoolExecutor} class provides an
+     * extensible thread pool implementation. The {@link Executors} class
+     * provides convenient factory methods for these Executors.
+     *
+     * @since 1.0
+     */
+    class Executor {
+    public:
+
+        virtual ~Executor() {}
+
+        /**
+         * Executes the given command at some time in the future.  The command
+         * may execute in a new thread, in a pooled thread, or in the calling
+         * thread, at the discretion of the <tt>Executor</tt> implementation.
+         *
+         * @param command the runnable task
+         *
+         * @throws RejectedExecutionException if this task cannot be
+         *         accepted for execution.
+         *
+         * @throws NullPointerException if command is null
+         */
+        virtual void execute( Runnable* command )
+            throw ( decaf::util::concurrent::RejectedExecutionException,
+                    decaf::lang::exceptions::NullPointerException ) = 0;
+
+    };
+
+}}}
+
+#endif /* _DECAF_UTIL_CONCURRENT_EXECUTOR_H_ */

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/RejectedExecutionException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/RejectedExecutionException.h?rev=712348&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/RejectedExecutionException.h
(added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/RejectedExecutionException.h
Fri Nov  7 19:25:03 2008
@@ -0,0 +1,128 @@
+/*
+ * 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_REJECTEDEXECUTIONEXCEPTION_H_
+#define _DECAF_UTIL_CONCURRENT_REJECTEDEXECUTIONEXCEPTION_H_
+
+#include <decaf/lang/Exception.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    /*
+     * Exception thrown by an Executor when a task cannot be accepted for execution.
+     */
+    class DECAF_API RejectedExecutionException : public decaf::lang::Exception
+    {
+    public:
+
+        /**
+         * Default Constructor
+         */
+        RejectedExecutionException() throw() : decaf::lang::Exception() {}
+
+        /**
+         * Conversion Constructor from some other Exception
+         * @param An exception that should become this type of Exception
+         */
+        RejectedExecutionException( const Exception& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Copy Constructor
+         */
+        RejectedExecutionException( const RejectedExecutionException& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Constructor
+         * @param cause Pointer to the exception that caused this one to
+         * be thrown, the object is cloned caller retains ownership.
+         */
+        RejectedExecutionException( const std::exception* cause )
+            throw() : decaf::lang::Exception( cause ) {}
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        RejectedExecutionException( const char* file, const int lineNumber,
+                                    const char* msg, ... ) throw()
+            : decaf::lang::Exception()
+        {
+
+            va_list vargs;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param cause The exception that was the cause for this one to be thrown.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        RejectedExecutionException( const char* file, const int lineNumber,
+                                    const std::exception* cause,
+                                    const char* msg, ... ) throw()
+            : decaf::lang::Exception( cause )
+        {
+            va_list vargs ;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual RejectedExecutionException* clone() const{
+            return new RejectedExecutionException( *this );
+        }
+
+        /**
+         * Destructor
+         */
+        virtual ~RejectedExecutionException() throw() {}
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_REJECTEDEXECUTIONEXCEPTION_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadFactory.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadFactory.h?rev=712348&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadFactory.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadFactory.h Fri Nov  7
19:25:03 2008
@@ -0,0 +1,66 @@
+/*
+ * 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_THREADFACTORY_H_
+#define _DECAF_UTIL_CONCURRENT_THREADFACTORY_H_
+
+namespace decaf {
+namespace util {
+namespace concurrent {
+
+    /**
+     * public interface ThreadFactory
+     *
+     * An object that creates new threads on demand. Using thread factories removes
+     * hardwiring of calls to new Thread, enabling applications to use special thread
+     * subclasses, priorities, etc.
+     *
+     * The simplest implementation of this interface is just:
+     *
+     *    class SimpleThreadFactory : public ThreadFactory {
+     *    public:
+     *       Thread* newThread( Runnable* r ) {
+     *          return new Thread(r);
+     *       }
+     *    }
+     *
+     * The Executors.defaultThreadFactory() method provides a more useful simple
+     * implementation, that sets the created thread context to known values before
+     * returning it.
+     *
+     * @since 1.0
+     */
+    class ThreadFactory {
+    public:
+
+        virtual ~ThreadFactory() {}
+
+        /**
+         * Constructs a new Thread. Implementations may also initialize priority, name,
+         * daemon status, ThreadGroup, etc.
+         *
+         * @param r - a runnable to be executed by new thread instance
+         *
+         * @returns constructed thread, or null if the request to create a thread is rejected
+         */
+        virtual Thread* newThread( Runnable* r ) = 0;
+
+    };
+
+}}}
+
+#endif /* _DECAF_UTIL_CONCURRENT_THREADFACTORY_H_ */

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TimeoutException.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TimeoutException.h?rev=712348&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TimeoutException.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TimeoutException.h Fri Nov
 7 19:25:03 2008
@@ -0,0 +1,131 @@
+/*
+ * 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_TIMEOUTEXCEPTION_H_
+#define _DECAF_UTIL_CONCURRENT_TIMEOUTEXCEPTION_H_
+
+#include <decaf/lang/Exception.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    /*
+     * Exception thrown when a blocking operation times out. Blocking operations for which
+     * a timeout is specified need a means to indicate that the timeout has occurred. For
+     * many such operations it is possible to return a value that indicates timeout; when
+     * that is not possible or desirable then TimeoutException should be declared and thrown.
+     */
+    class DECAF_API TimeoutException : public decaf::lang::Exception
+    {
+    public:
+
+        /**
+         * Default Constructor
+         */
+        TimeoutException() throw() : decaf::lang::Exception() {}
+
+        /**
+         * Conversion Constructor from some other Exception
+         * @param An exception that should become this type of Exception
+         */
+        TimeoutException( const decaf::lang::Exception& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Copy Constructor
+         */
+        TimeoutException( const TimeoutException& ex ) throw()
+        : decaf::lang::Exception()
+        {
+            *(Exception*)this = ex;
+        }
+
+        /**
+         * Constructor
+         * @param cause Pointer to the exception that caused this one to
+         * be thrown, the object is cloned caller retains ownership.
+         */
+        TimeoutException( const std::exception* cause )
+            throw() : decaf::lang::Exception( cause ) {}
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        TimeoutException( const char* file, const int lineNumber,
+                          const char* msg, ... ) throw()
+            : decaf::lang::Exception()
+        {
+
+            va_list vargs;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Constructor - Initializes the file name and line number where
+         * this message occurred.  Sets the message to report, using an
+         * optional list of arguments to parse into the message
+         * @param file name where exception occurs
+         * @param line number where the exception occurred.
+         * @param cause The exception that was the cause for this one to be thrown.
+         * @param message to report
+         * @param list of primitives that are formatted into the message
+         */
+        TimeoutException( const char* file, const int lineNumber,
+                          const std::exception* cause,
+                          const char* msg, ... ) throw()
+            : decaf::lang::Exception( cause )
+        {
+            va_list vargs ;
+            va_start( vargs, msg );
+            buildMessage( msg, vargs );
+
+            // Set the first mark for this exception.
+            setMark( file, lineNumber );
+        }
+
+        /**
+         * Clones this exception.  This is useful for cases where you need
+         * to preserve the type of the original exception as well as the message.
+         * All subclasses should override.
+         */
+        virtual TimeoutException* clone() const{
+            return new TimeoutException( *this );
+        }
+
+        /**
+         * Destructor
+         */
+        virtual ~TimeoutException() throw() {}
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_TIMEOUTEXCEPTION_H_*/



Mime
View raw message