activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r652104 [20/29] - in /activemq/activemq-cpp/trunk: ./ m4/ src/examples/ src/examples/consumers/ src/main/ src/main/decaf/ src/main/decaf/internal/ src/main/decaf/internal/net/ src/main/decaf/internal/nio/ src/main/decaf/internal/util/ src/m...
Date Tue, 29 Apr 2008 20:52:37 GMT
Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/PooledThread.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/PooledThread.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/PooledThread.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/PooledThread.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,107 @@
+/*
+ * 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_POOLEDTHREAD_H_
+#define _DECAF_UTIL_CONCURRENT_POOLEDTHREAD_H_
+
+#include <decaf/lang/Thread.h>
+#include <decaf/util/concurrent/PooledThreadListener.h>
+#include <decaf/util/logging/LoggerDefines.h>
+#include <decaf/util/Config.h>
+
+#include <decaf/lang/Exception.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    class ThreadPool;
+
+    class DECAF_API PooledThread : public lang::Thread
+    {
+    private:
+
+        // Is this thread currently processing something
+        bool busy;
+
+        // Boolean flag indicating thread should stop
+        bool done;
+
+        // Listener for Task related events
+        PooledThreadListener* listener;
+
+        // The thread pool this Pooled Thread is Servicing
+        ThreadPool* pool;
+
+        // Logger Init
+        LOGDECAF_DECLARE(logger)
+
+     public:
+
+        /**
+         * Constructor
+         * @param pool the parant ThreadPool object
+         */
+        PooledThread( ThreadPool* pool );
+
+        virtual ~PooledThread();
+
+        /**
+         * Run Method for this object waits for something to be
+         * enqueued on the ThreadPool and then grabs it and calls
+         * its run method.
+         */
+        virtual void run();
+
+        /**
+         * Stops the Thread, thread will complete its task if currently
+         * running one, and then die.  Does not block.
+         * @throws Exception
+         */
+        virtual void stop() throw ( lang::Exception );
+
+        /**
+         * Checks to see if the thread is busy, if busy it means
+         * that this thread has taken a task from the ThreadPool's
+         * queue and is processing it.
+         * @returns true if the Thread is busy
+         */
+        virtual bool isBusy() { return busy; }
+
+        /**
+         * Adds a listener to this <code>PooledThread</code> to be
+         * notified when this thread starts and completes a task.
+         * @param listener the listener to send notifications to.
+         */
+        virtual void setPooledThreadListener( PooledThreadListener* listener )
+        {
+            this->listener = listener;
+        }
+
+        /**
+         * Removes a listener for this <code>PooledThread</code> to be
+         * notified when this thread starts and completes a task.
+         * @return a pointer to this thread's listener or NULL
+         */
+        virtual PooledThreadListener* getPooledThreadListener()
+        {
+            return this->listener;
+        }
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_POOLEDTHREAD_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/PooledThreadListener.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/PooledThreadListener.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/PooledThreadListener.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/PooledThreadListener.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,67 @@
+/*
+ * 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_POOLEDTHREADLISTENER_H_
+#define _DECAF_UTIL_CONCURRENT_POOLEDTHREADLISTENER_H_
+
+#include <decaf/lang/Exception.h>
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    class PooledThread;
+
+    class DECAF_API PooledThreadListener
+    {
+    public:
+
+        /**
+         * Destructor
+         */
+        virtual ~PooledThreadListener() {}
+
+        /**
+         * Called by a pooled thread when it is about to begin
+         * executing a new task.
+         * @param Pointer to the Pooled Thread that is making this call
+         */
+        virtual void onTaskStarted( PooledThread* thread ) = 0;
+
+        /**
+         * Called by a pooled thread when it has completed a task
+         * and is going back to waiting for another task to run
+         * @param Pointer the the Pooled Thread that is making this call.
+         */
+        virtual void onTaskCompleted( PooledThread* thread ) = 0;
+
+        /**
+         * Called by a pooled thread when it has encountered an exception
+         * while running a user task, after receiving this notification
+         * the callee should assume that the PooledThread is now no longer
+         * running.
+         * @param Pointer to the Pooled Thread that is making this call
+         * @param The Exception that occured.
+         */
+        virtual void onTaskException( PooledThread* thread,
+                                      lang::Exception& ex) = 0;
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_POOLEDTHREADLISTENER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Synchronizable.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Synchronizable.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Synchronizable.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/Synchronizable.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,90 @@
+/*
+ * 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_SYNCHRONIZABLE_H_
+#define _DECAF_UTIL_CONCURRENT_SYNCHRONIZABLE_H_
+
+#include <decaf/lang/Exception.h>
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    /**
+     * The interface for all synchronizable objects (that is, objects
+     * that can be locked and unlocked).
+     */
+    class DECAF_API Synchronizable
+    {
+    public:
+
+        virtual ~Synchronizable(){}
+
+        /**
+         * Locks the object.
+         * @throws Exception
+         */
+        virtual void lock() throw( lang::Exception ) = 0;
+
+        /**
+         * Unlocks the object.
+         * @throws Exception
+         */
+        virtual void unlock() 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.
+         * @throws Exception
+         */
+        virtual void wait() 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.
+         * @param millisecs the time in millisecsonds to wait, or
+         * WAIT_INIFINITE
+         * @throws Exception
+         */
+        virtual void wait(unsigned long millisecs)
+            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;
+
+        /**
+         * 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;
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_SYNCHRONIZABLE_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TaskListener.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TaskListener.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TaskListener.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/TaskListener.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,55 @@
+/*
+ * 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_TASKLISTENER_H_
+#define _DECAF_UTIL_CONCURRENT_TASKLISTENER_H_
+
+#include <decaf/lang/Runnable.h>
+#include <decaf/lang/Exception.h>
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    class DECAF_API TaskListener
+    {
+    public:
+
+        virtual ~TaskListener() {}
+
+        /**
+         * Called when a queued task has completed, the task that
+         * finished is passed along for user consumption
+         * @param task Runnable Pointer to the task that finished
+         */
+        virtual void onTaskComplete( lang::Runnable* task ) = 0;
+
+        /**
+         * Called when a queued task has thrown an exception while
+         * being run.  The Callee should assume that this was an
+         * unrecoverable exeption and that this task is now defunct.
+         * @param task Runnable Pointer to the task
+         * @param ex The ActiveMQException that was thrown.
+         */
+        virtual void onTaskException( lang::Runnable* task,
+                                      lang::Exception& ex ) = 0;
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_TASKLISTENER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,333 @@
+/*
+ * 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 <decaf/util/concurrent/ThreadPool.h>
+#include <decaf/util/concurrent/Concurrent.h>
+#include <decaf/lang/exceptions/IllegalArgumentException.h>
+#include <decaf/util/Config.h>
+
+#ifdef min
+#undef min
+#endif
+
+#include <algorithm>
+#include <iostream>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+
+////////////////////////////////////////////////////////////////////////////////
+LOGDECAF_INITIALIZE(logger, ThreadPool, "com.activemq.concurrent.ThreadPool")
+LOGDECAF_INITIALIZE(marker, ThreadPool, "com.activemq.concurrent.ThreadPool.Marker")
+
+////////////////////////////////////////////////////////////////////////////////
+ThreadPool ThreadPool::instance;
+
+////////////////////////////////////////////////////////////////////////////////
+ThreadPool::ThreadPool()
+{
+    maxThreads  = DEFAULT_MAX_POOL_SIZE;
+    blockSize   = DEFAULT_MAX_BLOCK_SIZE;
+    freeThreads = 0;
+
+    shutdown = false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ThreadPool::~ThreadPool() {
+
+    try{
+
+        std::vector<PooledThread*>::iterator itr = pool.begin();
+
+        // Stop all the threads
+        for( ; itr != pool.end(); ++itr ) {
+            (*itr)->stop();
+        }
+
+        // Set the shutdown flag so that the DeQueue methods all quit
+        // when we interrupt them.
+        shutdown = true;
+
+        synchronized( &queue ) {
+            // Signal the Queue so that all waiters are notified
+            queue.notifyAll();
+        }
+
+        // Wait for everyone to die
+        for( itr = pool.begin(); itr != pool.end(); ++itr ) {
+            (*itr)->join();
+
+            // Destroy the threads
+            delete *itr;
+        }
+
+        pool.clear();
+    }
+    DECAF_CATCH_NOTHROW( lang::Exception )
+    DECAF_CATCHALL_NOTHROW()
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPool::queueTask( ThreadPool::Task task )
+   throw ( lang::Exception ) {
+
+    try{
+        
+        if( !task.first || !task.second ) {
+            throw exceptions::IllegalArgumentException( 
+                __FILE__, __LINE__,
+                "ThreadPool::QueueTask - Invalid args for Task");
+        }
+
+        //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - syncing on queue");
+
+        synchronized( &queue ) {
+            //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - sync'd, synching pool");
+
+            // If there's nobody open to do work, then create some more
+            // threads to handle the work.
+            if( freeThreads == 0 ) {
+                AllocateThreads(blockSize);
+            }
+
+            //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - pushing task");
+
+            // queue the new work.
+            queue.push(task);
+
+            //LOGCMS_DEBUG(logger, "ThreadPool::QueueTask - calling notify");
+
+            // Inform waiters that we put some work on the queue.
+            queue.notify();
+        }
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ThreadPool::Task ThreadPool::deQueueTask()
+    throw ( lang::Exception ) {
+    
+    try{
+        //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - syncing on queue");
+
+        synchronized( &queue ) {
+
+           /*LOGCMS_DEBUG(logger,
+               "ThreadPool::DeQueueTask - sync'd checking queue empty");*/
+
+            // Wait for work, wait in a while loop since another thread could
+            // be waiting for a lock and get the work before we get woken up
+            // from our wait.
+            while( queue.empty() && !shutdown ) {
+               //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - Q empty, waiting");
+
+               queue.wait();
+
+               //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - done waiting");
+            }
+
+            // Don't give more work if we are closing down
+            if( shutdown ) {
+               return Task();
+            }
+
+            // check size again.
+            if( queue.empty() ) {
+               throw lang::Exception( 
+                   __FILE__, __LINE__,
+                   "ThreadPool::DeQueueUserWorkItem - Empty Taskn, not in shutdown.");
+            }
+
+            //LOGCMS_DEBUG(logger, "ThreadPool::DeQueueTask - popping task");
+
+            // not empty so get the new work to do
+            return queue.pop();
+        }
+
+        return Task();
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPool::reserve( std::size_t size ) {
+    
+    try {
+        
+        synchronized( &poolLock ) {
+            
+            if( size < pool.size() || pool.size() == maxThreads ) {
+                return;
+            }
+
+            // How many do we reserve
+            std::size_t allocCount = size - pool.size();
+
+            // Allocate the new Threads
+            AllocateThreads(allocCount);
+        }
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPool::setMaxThreads( std::size_t maxThreads ) {
+
+    try{
+        
+        synchronized( &poolLock ) {
+            
+            if( maxThreads == 0 ) {
+                // Caller tried to do something stupid, ignore them.
+                return;
+            }
+
+            this->maxThreads = maxThreads;
+        }
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPool::setBlockSize( std::size_t blockSize ) {
+    
+    try{
+        if( blockSize <= 0 ) {
+            // User tried something dumb, protect them from themselves
+            return;
+        }
+
+        synchronized( &poolLock ) {
+            this->blockSize = blockSize;
+        }
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPool::AllocateThreads( std::size_t count ) {
+
+    try{
+
+        if( pool.size() >= maxThreads ) {
+            return;
+        }
+
+        synchronized( &poolLock ) {
+            // Take the min of alloc size of maxThreads since we don't
+            // want anybody sneaking eaxtra threads in, greedy bastards.
+            count = std::min(count, maxThreads - pool.size());
+
+            // Each time we create a thread we increment the free Threads
+            // counter, but before we call start so that the Thread doesn't
+            // get ahead of us.
+            for( std::size_t i = 0; i < count; ++i ) {
+                pool.push_back(new PooledThread(this));
+                pool.back()->setPooledThreadListener(this);
+                freeThreads++;
+                pool.back()->start();
+            }
+        }
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPool::onTaskStarted( PooledThread* thread DECAF_UNUSED ) {
+    
+    try{
+        
+        synchronized( &poolLock ) {
+
+            freeThreads--;
+
+            // Now that this callback has decremented the free threads coutner
+            // let check if there is any outstanding work to be done and no
+            // threads to handle it.  This could happen if the QueueTask
+            // method was called successively without any of the PooledThreads
+            // having a chance to wake up and service the queue.  This would
+            // cause the number of Task to exceed the number of free threads
+            // once the Threads got a chance to wake up and service the queue
+            if( freeThreads == 0 && !queue.empty() ) {
+                // Allocate a new block of threads
+                AllocateThreads( blockSize );
+            }
+        }
+
+        //LOGCMS_DEBUG(logger, "ThreadPool::onTaskStarted:");
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPool::onTaskCompleted( PooledThread* thread DECAF_UNUSED) {
+
+    try {
+        synchronized( &poolLock ) {
+            freeThreads++;
+        }
+
+        //LOGCMS_DEBUG(logger, "ThreadPool::onTaskCompleted: ");
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ThreadPool::onTaskException(
+   PooledThread* thread,
+   lang::Exception& ex DECAF_UNUSED ) {
+    
+    //LOGCMS_DEBUG(logger, "ThreadPool::onTaskException: ");
+
+    try{
+        
+        synchronized( &poolLock ) {
+            
+            // Delete the thread that had the exception and start a new
+            // one to take its place.
+            freeThreads--;
+
+            std::vector<PooledThread*>::iterator itr =
+                std::find(pool.begin(), pool.end(), thread);
+
+            if( itr != pool.end() ) {
+                pool.erase(itr);
+            }
+
+            // Bye-Bye Thread Object
+            delete thread;
+
+            // Now allocate a replacement
+            AllocateThreads(1);
+        }
+    }
+    DECAF_CATCH_RETHROW( lang::Exception )
+    DECAF_CATCHALL_THROW( lang::Exception )
+}

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/concurrent/ThreadPool.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,239 @@
+/*
+ * 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_THREADPOOL_H_
+#define _DECAF_UTIL_CONCURRENT_THREADPOOL_H_
+
+#include <decaf/lang/Runnable.h>
+#include <decaf/util/concurrent/PooledThread.h>
+#include <decaf/util/concurrent/PooledThreadListener.h>
+#include <decaf/util/concurrent/TaskListener.h>
+#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Queue.h>
+#include <decaf/util/logging/LoggerDefines.h>
+#include <decaf/util/Config.h>
+
+#include <vector>
+
+namespace decaf{
+namespace util{
+namespace concurrent{
+
+    /**
+     * Defines a Thread Pool object that implements the functionality
+     * of pooling threads to perform user tasks.  The Thread Poll has
+     * max size that it will grow to.  The thread pool allocates threads
+     * in blocks.  When there are no waiting worker threads and a task
+     * is queued then a new batch is allocated.  The user can specify
+     * the size of the blocks, otherwise a default value is used.
+     * <P>
+     * When the user queues a task they must also queue a listner to
+     * be notified when the task has completed, this provides the user
+     * with a mechanism to know when a task object can be freed.
+     * <P>
+     * To have the Thread Pool perform a task, the user enqueue's an
+     * object that implements the <code>Runnable</code> insterface and
+     * one of the worker threads will executing it in its thread context.
+     */
+    class DECAF_API ThreadPool : public PooledThreadListener
+    {
+    public:
+
+        // Constants
+        static const size_t DEFAULT_MAX_POOL_SIZE  = 10;
+        static const size_t DEFAULT_MAX_BLOCK_SIZE = 3;
+
+        // Types
+        typedef std::pair<lang::Runnable*, TaskListener*> Task;
+
+    private:
+
+        // Vector of threads that this object has created for its pool.
+        std::vector< PooledThread* > pool;
+
+        // Queue of Task that are in need of completion
+        util::Queue<Task> queue;
+
+        // Max number of Threads this Pool can contian
+        std::size_t maxThreads;
+
+        // Max number of tasks that can be allocated at a time
+        std::size_t blockSize;
+
+        // boolean flag use to indocate that this object is shutting down.
+        bool shutdown;
+
+        // Count of threads that are currently free to perfom some work.
+        std::size_t freeThreads;
+
+        // Mutex for locking operations that affect the pool.
+        Mutex poolLock;
+
+        // Logger Init
+        LOGDECAF_DECLARE(logger)
+        LOGDECAF_DECLARE(marker)
+
+    private:   // Statics
+
+        // The singleton instance of this class
+        static ThreadPool instance;
+
+    public:
+
+        ThreadPool();
+        virtual ~ThreadPool();
+
+        /**
+         * Queue a task to be completed by one of the Pooled Threads.
+         * tasks are serviced as soon as a <code>PooledThread</code>
+         * is available to run it.
+         * @param task object that derives from Runnable
+         * @throws ActiveMQException
+         */
+        virtual void queueTask( Task task )
+            throw ( lang::Exception );
+
+        /**
+         * DeQueue a task to be completed by one of the Pooled Threads.
+         * A caller of this method will block until there is something
+         * in the tasks queue, therefore care must be taken when calling
+         * this function.  Normally clients of ThreadPool don't use
+         * this, only the <code>PooledThread</code> objects owned by
+         * this ThreadPool.
+         * @return object that derives from Runnable
+         * @throws ActiveMQException
+         */
+        virtual Task deQueueTask()
+            throw ( lang::Exception );
+
+        /**
+         * Returns the current number of Threads in the Pool, this is
+         * how many there are now, not how many are active or the max
+         * number that might exist.
+         * @return integer number of threads in existance.
+         */
+        virtual std::size_t getPoolSize() const { return pool.size(); }
+
+        /**
+         * Returns the current backlog of items in the tasks queue, this
+         * is how much work is still waiting to get done.
+         * @return number of outstanding tasks.
+         */
+        virtual std::size_t getBacklog() const { return queue.size(); }
+
+        /**
+         * Ensures that there is at least the specified number of Threads
+         * allocated to the pool.  If the size is greater than the MAX
+         * number of threads in the pool, then only MAX threads are
+         * reservved.  If the size is smaller than the number of threads
+         * currently in the pool, than nothing is done.
+         * @param size the number of threads to reserve.
+         */
+        virtual void reserve( std::size_t size );
+
+        /**
+         * Get the Max Number of Threads this Pool can contain
+         * @return max size
+         */
+        virtual std::size_t getMaxThreads() const { return maxThreads; }
+
+        /**
+         * Sets the Max number of threads this pool can contian.
+         * if this value is smaller than the current size of the
+         * pool nothing is done.
+         * @param maxThreads total number of threads that can be pooled
+         */
+        virtual void setMaxThreads( std::size_t maxThreads );
+
+        /**
+         * Gets the Max number of threads that can be allocated at a time
+         * when new threads are needed.
+         * @return max Thread Block Size
+         */
+        virtual std::size_t getBlockSize() const { return blockSize; }
+
+        /**
+         * Sets the Max number of Threads that can be allocated at a time
+         * when the Thread Pool determines that more Threads are needed.
+         * @param blockSize Max Thread Block Size
+         */
+        virtual void setBlockSize( std::size_t blockSize );
+
+        /**
+         * Returns the current number of available threads in the pool, threads
+         * that are performing a user task are considered unavailable.  This value
+         * could change immeadiately after calling as Threads could finish right
+         * after and be available again.  This is informational only.
+         * @return totoal free threads
+         */
+        virtual std::size_t getFreeThreadCount() const {
+            return freeThreads;
+        }
+
+    public: // PooledThreadListener Callbacks
+
+        /**
+         * Called by a pooled thread when it is about to begin
+         * executing a new task.  This will decrement the available
+         * threads counter so that this object knows when there are
+         * no more free threads and must create new ones.
+         * @param thread Pointer to the Pooled Thread that is making this call
+         */
+        virtual void onTaskStarted( PooledThread* thread );
+
+        /**
+         * Called by a pooled thread when it has completed a task
+         * and is going back to waiting for another task to run,
+         * this will increment the free threads counter.
+         * @param thread Pointer the the Pooled Thread that is making this call.
+         */
+        virtual void onTaskCompleted( PooledThread* thread );
+
+        /**
+         * Called by a pooled thread when it has encountered an exception
+         * while running a user task, after receiving this notification
+         * the callee should assume that the PooledThread is now no longer
+         * running.
+         * @param thread Pointer to the Pooled Thread that is making this call
+         * @param ex The Exception that occured.
+         */
+        virtual void onTaskException( PooledThread* thread,
+                                      lang::Exception& ex );
+
+    public:   // Statics
+
+        /**
+         * Return the one and only Thread Pool instance.
+         * @return The Thread Pool Pointer
+         */
+        static ThreadPool* getInstance() {
+            return &instance;
+        }
+
+    private:
+
+        /**
+         * Allocates the requested ammount of Threads, won't exceed
+         * <code>maxThreads</code>.
+         * @param count the number of threads to create
+         */
+        void AllocateThreads( std::size_t count );
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_CONCURRENT_THREADPOOL_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/ConsoleHandler.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/ConsoleHandler.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/ConsoleHandler.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/ConsoleHandler.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,80 @@
+/*
+ * 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_LOGGING_CONSOLEHANDLER_H_
+#define _DECAF_UTIL_LOGGING_CONSOLEHANDLER_H_
+
+#include <decaf/util/logging/StreamHandler.h>
+#include <decaf/io/StandardErrorOutputStream.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    /**
+     * This Handler publishes log records to System.err. By default the
+     * SimpleFormatter is used to generate brief summaries.
+     *
+     * Configuration: By default each ConsoleHandler is initialized using
+     * the following LogManager configuration properties. If properties are
+     * not defined (or have invalid values) then the specified default
+     * values are used.
+     *
+     * ConsoleHandler.level specifies the default level for the Handler
+     *  (defaults to Level.INFO).
+     * ConsoleHandler.filter specifies the name of a Filter class to use
+     *  (defaults to no Filter).
+     * ConsoleHandler.formatter specifies the name of a Formatter class to
+     *  use (defaults to SimpleFormatter).
+     */
+    class DECAF_API ConsoleHandler : public StreamHandler {
+    private:
+
+        // The Standard Error Stream to log to
+        io::StandardErrorOutputStream stream;
+
+        // The default Simple Formatter
+        SimpleFormatter formatter;
+
+    public:
+
+        ConsoleHandler() : StreamHandler( &stream, &formatter ) {
+
+            // Defaults level to Info
+            setLevel( Level.INFO );
+        }
+
+        virtual ~ConsoleHandler() {}
+
+        /**
+         * Close the current output stream.
+         * <p>
+         * Override the StreamHandler close to flush the Std Err stream
+         * but doesn't close.
+         * @throw CMSException
+         */
+        virtual void close() throw ( cms::CMSException )
+        {
+            if( getOutputStream() ) {
+                getOutputStream->flush();
+            }
+        }
+
+    };
+
+}})
+
+#endif /*_DECAF_UTIL_LOGGING_CONSOLEHANDLER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Filter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Filter.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Filter.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Filter.h Tue Apr 29 13:52:30 2008
@@ -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_UTIL_LOGGING_FILTER_H_
+#define _DECAF_UTIL_LOGGING_FILTER_H_
+
+#include <decaf/util/logging/LogRecord.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    /**
+     * A Filter can be used to provide fine grain control over what is
+     * logged, beyond the control provided by log levels.
+     *
+     * Each Logger and each Handler can have a filter associated with it.
+     * The Logger or Handler will call the isLoggable method to check if a
+     * given LogRecord should be published. If isLoggable returns false,
+     * the LogRecord will be discarded.
+     */
+    class DECAF_API Filter {
+    public:
+
+        virtual ~Filter() {}
+
+        /**
+         * Check if a given log record should be published.
+         * @param record the <code>LogRecord</code> to check.
+         * @returns true if the record is loggable.
+         */
+        virtual bool isLoggable( const LogRecord& record ) const = 0;
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_FILTER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Formatter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Formatter.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Formatter.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Formatter.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,73 @@
+/*
+ * 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_LOGGING_FORMATTER_H_
+#define _DECAF_UTIL_LOGGING_FORMATTER_H_
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    /**
+     * A Formatter provides support for formatting LogRecords.
+     *
+     * Typically each logging Handler will have a Formatter associated with
+     * it. The Formatter takes a LogRecord and converts it to a string.
+     *
+     * Some formatters (such as the XMLFormatter) need to wrap head and
+     * tail strings around a set of formatted records. The getHeader and
+     * getTail methods can be used to obtain these strings.
+     */
+    class DECAF_API Formatter {
+    public:
+
+        virtual ~Formatter() {}
+
+        /**
+         * Format the given log record and return the formatted string.
+         * @param record The Log Record to Format
+         * @returns the formatted record.
+         */
+        virtual std::string format( const LogRecord& record ) const = 0;
+
+        /**
+         * Format the message string from a log record.
+         * @param record The Log Record to Format
+         * @returns the formatted message
+         */
+        virtual std::string formatMessage( const LogRecord& record ) const = 0;
+
+        /**
+         * Return the header string for a set of formatted records.  In the
+         * default implementation this method should return empty string
+         * @param handler the target handler, can be null
+         * @return the head string
+         */
+        virtual std::string getHead( const Handler* handler ) = 0;
+
+        /**
+         * Return the tail string for a set of formatted records.  In the
+         * default implementation this method should return empty string
+         * @param handler the target handler, can be null
+         * @return the tail string
+         */
+        virtual std::string getTail( const Handler* handler ) = 0;
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_FORMATTER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Handler.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Handler.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Handler.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Handler.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,122 @@
+/*
+ * 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_LOGGING_HANDLER_H_
+#define _DECAF_UTIL_LOGGING_HANDLER_H_
+
+#include <decaf/io/Closeable.h>
+#include <decaf/util/logging/LogRecord.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    class Filter;
+    class Formatter;
+
+    /**
+     * A Handler object takes log messages from a Logger and exports them.
+     * It might for example, write them to a console or write them to a file,
+     * or send them to a network logging service, or forward them to an OS
+     * log, or whatever.
+     *
+     * A Handler can be disabled by doing a setLevel(Level.OFF) and can be
+     * re-enabled by doing a setLevel with an appropriate level.
+     *
+     * Handler classes typically use LogManager properties to set default
+     * values for the Handler's Filter, Formatter, and Level. See the
+     * specific documentation for each concrete Handler class.
+     */
+    class DECAF_API Handler : public io::Closeable {
+    public:
+
+        virtual ~Handler() {}
+
+        /**
+         * Flush the Handler's output, clears any buffers.
+         */
+        virtual void flush() = 0;
+
+        /**
+         * Publish the Log Record to this Handler
+         * @param record The Log Record to Publish
+         */
+        virtual void publish( const LogRecord& record ) = 0;
+
+        /**
+         * Check if this Handler would actually log a given LogRecord.
+         * <p>
+         * This method checks if the LogRecord has an appropriate Level and
+         * whether it satisfies any Filter. It also may make other Handler
+         * specific checks that might prevent a handler from logging the
+         * LogRecord.
+         * @param record <code>LogRecord</code> to check
+         */
+        virtual void isLoggable( const LogRecord& record ) = 0;
+
+        /**
+         * Sets the Filter that this Handler uses to filter Log Records
+         * <p>
+         * For each call of publish the Handler will call this Filter (if it
+         * is non-null) to check if the LogRecord should be published or
+         * discarded.
+         * @param filter <code>Filter</code> derived instance
+         */
+        virtual void setFilter( const Filter* filter ) = 0;
+
+        /**
+         * Gets the Filter that this Handler uses to filter Log Records
+         * @returns <code>Filter</code> derived instance
+         */
+        virtual const Filter* getFilter() = 0;
+
+        /**
+         * Set the log level specifying which message levels will be logged
+         * by this Handler.
+         * <p>
+         * The intention is to allow developers to turn on voluminous logging,
+         * but to limit the messages that are sent to certain Handlers.
+         * @param value Level enumeration value
+         */
+        virtual void setLevel( Level value ) = 0;
+
+        /**
+         * Get the log level specifying which message levels will be logged
+         * by this Handler.
+         * @returns Level enumeration value
+         */
+        virtual Level getLevel() = 0;
+
+        /**
+         * Sets the <code>Formatter</code> used by this Handler
+         * <p>
+         * Some Handlers may not use Formatters, in which case the
+         * Formatter will be remembered, but not used.
+         * @param formatter <code>Filter</code> derived instance
+         */
+        virtual void setFormatter( const Formatter* formatter ) = 0;
+
+        /**
+         * Gets the <code>Formatter</code> used by this Handler
+         * @returns <code>Filter</code> derived instance
+         */
+        virtual const Formatter* getFormatter() = 0;
+
+   };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_HANDLER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogManager.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogManager.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogManager.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogManager.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,121 @@
+/*
+* 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 "LogManager.h"
+
+#include <decaf/util/logging/PropertiesChangeListener.h>
+#include <decaf/util/concurrent/Concurrent.h>
+#include <decaf/util/Config.h>
+
+#include <algorithm>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::util;
+using namespace decaf::util::logging;
+
+////////////////////////////////////////////////////////////////////////////////
+concurrent::Mutex LogManager::mutex;
+LogManager* LogManager::instance = NULL;
+unsigned int LogManager::refCount = 0;
+
+////////////////////////////////////////////////////////////////////////////////
+LogManager::~LogManager()
+{
+    // TODO - Delete all the loggers.
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LogManager::setProperties( const Properties* properties )
+{
+    // Copy the properties
+    this->properties.copy(properties);
+
+    // Update the configuration of the loggers.
+    // TODO
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LogManager::addPropertyChangeListener(
+    PropertyChangeListener* listener )
+{
+    if( find(listeners.begin(), listeners.end(), listener) == listeners.end() ) {
+        listeners.push_back( listener );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LogManager::removePropertyChangeListener(
+    PropertyChangeListener* listener )
+{
+    listeners.remove( listener );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Logger* LogManager::getLogger( const std::string& name DECAF_UNUSED ) {
+    return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int LogManager::getLoggerNames( const std::vector<std::string>& names  DECAF_UNUSED ) {
+    return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+LogManager* LogManager::getInstance() {
+
+    synchronized( &mutex ) {
+        if( instance == NULL ) {
+            instance = new LogManager();
+        }
+
+        refCount++;
+
+        return instance;
+    }
+
+    return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LogManager::returnInstance() {
+
+    synchronized( &mutex ) {
+        if( refCount == 0 ) {
+            return ;
+        }
+
+        refCount--;
+
+        if( refCount == 0 ) {
+            delete instance;
+            instance = NULL;
+        }
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LogManager::destroy()
+{
+    if( instance != NULL ) {
+
+        synchronized( &mutex ) {
+            delete instance;
+            instance = NULL;
+            refCount = 0;
+        }
+    }
+}

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogManager.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogManager.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogManager.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogManager.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,252 @@
+/*
+* 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_LOGGING_LOGMANAGER_H_
+#define _DECAF_UTIL_LOGGING_LOGMANAGER_H_
+
+#include <map>
+#include <list>
+#include <string>
+#include <vector>
+
+#include <decaf/util/Properties.h>
+#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Config.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    class Logger;
+    class PropertyChangeListener;
+
+    /**
+     * There is a single global LogManager object that is used to maintain
+     * a set of shared state about Loggers and log services.
+     *
+     * This LogManager object:
+     *
+     *   * Manages a hierarchical namespace of Logger objects. All named
+     *     Loggers are stored in this namespace.
+     *   * Manages a set of logging control properties. These are simple
+     *     key-value pairs that can be used by Handlers and other logging
+     *     objects to configure themselves.
+     *
+     * The global LogManager object can be retrieved using
+     * LogManager.getLogManager(). The LogManager object is created during
+     * class initialization and cannot subsequently be changed.
+     *
+     * ***TODO****
+     * By default, the LogManager reads its initial configuration from a
+     * properties file "lib/logging.properties" in the JRE directory. If
+     * you edit that property file you can change the default logging
+     * configuration for all uses of that JRE.
+     *
+     * In addition, the LogManager uses two optional system properties that
+     * allow more control over reading the initial configuration:
+     *
+     *    * "decaf.logger.config.class"
+     *    * "decaf.logger.config.file"
+     *
+     * These two properties may be set via the Preferences API, or as
+     * command line property definitions to the "java" command, or as
+     * system property definitions passed to JNI_CreateJavaVM.
+     *
+     * If the "java.util.logging.config.class" property is set, then the
+     * property value is treated as a class name. The given class will be
+     * loaded, an object will be instantiated, and that object's constructor
+     * is responsible for reading in the initial configuration. (That object
+     * may use other system properties to control its configuration.) The
+     * alternate configuration class can use readConfiguration(InputStream)
+     * to define properties in the LogManager.
+     *
+     * If "java.util.logging.config.class" property is not set, then the
+     * "java.util.logging.config.file" system property can be used to specify
+     * a properties file (in java.util.Properties format). The initial
+     * logging configuration will be read from this file.
+     *
+     * If neither of these properties is defined then, as described above,
+     * the LogManager will read its initial configuration from a properties
+     * file "lib/logging.properties" in the JRE directory.
+     *
+     * The properties for loggers and Handlers will have names starting with
+     * the dot-separated name for the handler or logger.
+     * ***TODO****
+     *
+     * The global logging properties may include:
+     *
+     *    * A property "handlers". This defines a whitespace separated
+     *      list of class names for handler classes to load and register as
+     *      handlers on the root Logger (the Logger named ""). Each class
+     *      name must be for a Handler class which has a default constructor.
+     *      Note that these Handlers may be created lazily, when they are
+     *      first used.
+     *    * A property "<logger>.handlers". This defines a whitespace or
+     *      comma separated list of class names for handlers classes to load
+     *      and register as handlers to the specified logger. Each class name
+     *      must be for a Handler class which has a default constructor. Note
+     *      that these Handlers may be created lazily, when they are first
+     *      used.
+     *    * A property "<logger>.useParentHandlers". This defines a boolean
+     *      value. By default every logger calls its parent in addition to
+     *      handling the logging message itself, this often result in
+     *      messages being handled by the root logger as well. When setting
+     *      this property to false a Handler needs to be configured for this
+     *      logger otherwise no logging messages are delivered.
+     *    * A property "config". This property is intended to allow arbitrary
+     *      configuration code to be run. The property defines a whitespace
+     *      separated list of class names. A new instance will be created for
+     *      each named class. The default constructor of each class may
+     *      execute arbitrary code to update the logging configuration, such
+     *      as setting logger levels, adding handlers, adding filters, etc.
+     *
+     * Loggers are organized into a naming hierarchy based on their dot
+     * separated names. Thus "a.b.c" is a child of "a.b", but "a.b1" and
+     * a.b2" are peers.
+     *
+     * All properties whose names end with ".level" are assumed to define
+     * log levels for Loggers. Thus "foo.level" defines a log level for
+     * the logger called "foo" and (recursively) for any of its children
+     * in the naming hierarchy. Log Levels are applied in the order they
+     * are defined in the properties file. Thus level settings for child
+     * nodes in the tree should come after settings for their parents. The
+     * property name ".level" can be used to set the level for the root of
+     * the tree.
+     *
+     * All methods on the LogManager object are multi-thread safe.
+     */
+    class DECAF_API LogManager {
+    private:
+
+        // Change listener on this class's Properties
+        std::list<PropertyChangeListener*> listeners;
+
+        // Properties of the Log Manager
+        util::Properties properties;
+
+    public:
+
+        virtual ~LogManager();
+
+        /**
+         * Sets the Properties this LogManager should use to configure
+         * its loggers.  Once set a properties change event is fired.
+         * @param properties Pointer to read the configuration from
+         */
+        virtual void setProperties( const util::Properties* properties );
+
+        /**
+         * Gets a reference to the Logging Properties used by this
+         * logger.
+         * @returns The Logger Properties Pointer
+         */
+        virtual const util::Properties& getProperties() const {
+            return properties;
+        }
+
+        /**
+         * Gets the value of a named property of this LogManager
+         * @param name of the Property to retrieve
+         * @return the value of the property
+         */
+        virtual std::string getProperty( const std::string& name ) {
+            return properties.getProperty( name );
+        }
+
+        /**
+         * Adds a change listener for LogManager Properties, adding the same
+         * instance of a change event listener does nothing.
+         * @param listener a PropertyChangeListener
+         */
+        virtual void addPropertyChangeListener(
+            PropertyChangeListener* listener );
+
+        /**
+         * Removes a properties change listener from the LogManager.
+         * @param listener a PropertyChangeListener
+         */
+        virtual void removePropertyChangeListener(
+            PropertyChangeListener* listener );
+
+        /**
+         * Retrieves or creates a new Logger using the name specified
+         * a new logger inherits the configuration of the logger's
+         * parent if there is no configuration data for the logger.
+         * @param name The name of the Logger.
+         */
+        virtual Logger* getLogger( const std::string& name );
+
+        /**
+         * Gets a list of known Logger Names from this Manager
+         * @param names STL Vector to hold string logger names
+         * @return names count of how many loggers were inserted
+         */
+        virtual int getLoggerNames( const std::vector<std::string>& names );
+
+    public:     // Static Singleton Methods.
+
+        /**
+         * Get the singleton instance
+         * @return Pointer to an instance of the Log Manager
+         */
+        static LogManager* getInstance();
+
+        /**
+         * Returns a Checked out instance of this Manager
+         */
+        static void returnInstance();
+
+        /**
+         * Forcefully Delete the Instance of this LogManager
+         * even if there are outstanding references.
+         */
+        static void destroy();
+
+    protected:
+
+        /**
+         * Constructor, hidden to protect against direct instantiation
+         */
+        LogManager() {}
+
+        /**
+         * Copy Constructo
+         * @param manager the Manager to copy
+         */
+        LogManager( const LogManager& manager );
+
+        /**
+         * Assignment operator
+         * @param manager the manager to assign from
+         */
+        void operator=( const LogManager& manager );
+
+    private:
+
+        // Static mutex to protect the singleton methods
+        static concurrent::Mutex mutex;
+
+        // Static pointer to the one and only instance.
+        static LogManager* instance;
+
+        // Static counter for number of outstanding references
+        static unsigned int refCount;
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_LOGMANAGER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogRecord.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogRecord.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogRecord.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogRecord.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,191 @@
+/*
+ * 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_LOGGING_LOGRECORD_H_
+#define _DECAF_UTIL_LOGGING_LOGRECORD_H_
+
+#include <decaf/util/logging/LoggerCommon.h>
+#include <decaf/util/Config.h>
+
+#include <string>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    class DECAF_API LogRecord
+    {
+    private:
+
+        // Level of this Record
+        Level level;
+
+        // Name of the source Logger
+        std::string loggerName;
+
+        // Name of the File that originated the Log
+        std::string sourceFile;
+
+        // Line in the source file where log occured
+        unsigned long sourceLine;
+
+        // The message to Log.
+        std::string message;
+
+        // The function Name where the log occured
+        std::string functionName;
+
+        // Time in Mills since UTC that this Record was logged
+        unsigned long timeStamp;
+
+        // Thread Id of the Thread that logged this Record
+        unsigned long threadId;
+
+    public:
+
+        LogRecord() {}
+        virtual ~LogRecord() {}
+
+        /**
+         * Get Level of this log record
+         * @return Level enumeration value.
+         */
+        Level getLevel() const {
+            return level;
+        };
+
+        /**
+         * Set the Level of this Log Record
+         * @param value Level Enumeration Value
+         */
+        void setLevel( Level value ) {
+            level = value;
+        };
+
+        /**
+         * Gets the Source Logger's Name
+         * @return the source loggers name
+         */
+        const std::string& getLoggerName() const {
+            return loggerName;
+        };
+
+        /**
+         * Sets the Source Logger's Name
+         * @param loggerName the source loggers name
+         */
+        void setLoggerName( const std::string& loggerName ) {
+            this->loggerName = loggerName;
+        };
+
+        /**
+         * Gets the Source Log File name
+         * @return the source loggers name
+         */
+        const std::string& getSourceFile() const {
+            return sourceFile;
+        };
+
+        /**
+         * Sets the Source Log File Name
+         * @param loggerName the source loggers name
+         */
+        void setSourceFile( const std::string& sourceFile ) {
+            this->sourceFile = sourceFile;
+        };
+
+        /**
+         * Gets the Source Log line number
+         * @return the source loggers line number
+         */
+        unsigned long getSourceLine() const {
+            return sourceLine;
+        };
+
+        /**
+         * Sets the Source Log line number
+         * @param sourceLine the source logger's line number
+         */
+        void setSourceLine( long sourceLine ) {
+            this->sourceLine = sourceLine;
+        };
+
+        /**
+         * Gets the Message to be Logged
+         * @return the source logger's message
+         */
+        const std::string& getMessage() const {
+            return message;
+        };
+
+        /**
+         * Sets the Message to be Logged
+         * @param message the source loggers message
+         */
+        void setMessage( const std::string& message ) {
+            this->message = message;
+        };
+
+        /**
+         * Gets the name of the function where this log was logged
+         * @return the source logger's message
+         */
+        const std::string& getSourceFunction() const {
+            return functionName;
+         };
+
+        /**
+         * Sets the name of the function where this log was logged
+         * @param functionName the source of the log
+         */
+        void setSourceFunction( const std::string& functionName ) {
+            this->functionName = functionName;
+        };
+
+        /**
+         * Gets the time in mills that this message was logged.
+         * @return UTC time in milliseconds
+         */
+        unsigned long getTimestamp() const { return timeStamp; };
+
+        /**
+         * Sets the time in mills that this message was logged.
+         * @param timeStamp UTC Time in Milliseconds.
+         */
+        void setTimestamp( long timeStamp ) {
+            this->timeStamp = timeStamp;
+        };
+
+        /**
+         * Gets the Thread Id where this Log was created
+         * @return the source loggers line number
+         */
+        unsigned long getTreadId() const {
+            return threadId;
+        };
+
+        /**
+         * Sets the Thread Id where this Log was created
+         * @param threadId the source logger's line number
+         */
+        void setTreadId( long threadId ) {
+            this->threadId = threadId;
+        };
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_LOGRECORD_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogWriter.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogWriter.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogWriter.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogWriter.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,73 @@
+/*
+ * 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 "LogWriter.h"
+
+#include <iostream>
+#include <decaf/lang/Thread.h>
+#include <decaf/util/concurrent/Concurrent.h>
+#include <decaf/util/concurrent/Mutex.h>
+#include <decaf/util/Config.h>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::util;
+using namespace decaf::util::concurrent;
+using namespace decaf::util::logging;
+
+////////////////////////////////////////////////////////////////////////////////
+LogWriter::LogWriter() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+LogWriter::~LogWriter() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LogWriter::log( const std::string& file DECAF_UNUSED,
+                     const int line DECAF_UNUSED,
+                     const std::string& prefix,
+                     const std::string& message) {
+
+   synchronized( &getMutex() ) {
+      cout << prefix  << " "
+           << message << " - tid: " << Thread::getId() << endl;
+   }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void LogWriter::log(const std::string& message ) {
+
+    synchronized(&getMutex()) {
+      cout << message << " - tid: " << Thread::getId() << endl;
+   }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+LogWriter& LogWriter::getInstance() {
+
+    // This one instance
+    static LogWriter instance;
+
+    return instance;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Mutex& LogWriter::getMutex() {
+    static concurrent::Mutex mutex;
+    return mutex;
+}

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogWriter.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogWriter.h?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogWriter.h (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/LogWriter.h Tue Apr 29 13:52:30 2008
@@ -0,0 +1,79 @@
+/*
+ * 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_LOGGING_LOGWRITER_H_
+#define _DECAF_UTIL_LOGGING_LOGWRITER_H_
+
+#include <decaf/util/concurrent/Mutex.h>
+
+namespace decaf{
+namespace util{
+namespace logging{
+
+    class DECAF_API LogWriter {
+    public:
+
+        LogWriter(void);
+        virtual ~LogWriter(void);
+
+        /**
+         * Writes a message to the output destination
+         * @param file
+         * @param line
+         * @param prefix
+         * @param message
+         */
+        virtual void log( const std::string& file,
+                          const int          line,
+                          const std::string& prefix,
+                          const std::string& message );
+
+        /**
+         * Writes a message to the output destination
+         * @param message
+         */
+        virtual void log(const std::string& message);
+
+    public:    // Static methods
+
+        /**
+         * Get the singleton instance
+         */
+        static LogWriter& getInstance();
+
+        /**
+         * Returns a Checked out instance of this Writer
+         */
+        static void returnInstance();
+
+        /**
+         * Forcefully Delete the Instance of this LogWriter
+         * even if there are outstanding references.
+         */
+        static void destroy();
+
+    private:
+
+        /**
+         * Gets the one and only mutex for this instance.
+         */
+        concurrent::Mutex& getMutex();
+
+    };
+
+}}}
+
+#endif /*_DECAF_UTIL_LOGGING_LOGWRITER_H_*/

Added: activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Logger.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Logger.cpp?rev=652104&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Logger.cpp (added)
+++ activemq/activemq-cpp/trunk/src/main/decaf/util/logging/Logger.cpp Tue Apr 29 13:52:30 2008
@@ -0,0 +1,155 @@
+/*
+ * 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 "Logger.h"
+
+#include <decaf/util/logging/Handler.h>
+#include <decaf/util/Config.h>
+#include <algorithm>
+
+using namespace std;
+using namespace decaf;
+using namespace decaf::lang;
+using namespace decaf::lang::exceptions;
+using namespace decaf::util::logging;
+
+////////////////////////////////////////////////////////////////////////////////
+Logger::Logger( const std::string& name DECAF_UNUSED,
+                Logger* parent DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Logger::~Logger() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::addHandler( Handler* handler ) throw ( IllegalArgumentException ) {
+
+    if( handler == NULL )
+    {
+        IllegalArgumentException(
+            __FILE__, __LINE__,
+            "Logger::addHandler - HAndler cannot be null");
+    }
+
+    if( find( handlers.begin(), handlers.end(), handler) != handlers.end() )
+    {
+        handlers.push_back( handler );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::removeHandler( Handler* handler ) {
+
+    list<Handler*>::iterator itr =
+        find( handlers.begin(), handlers.end(), handler );
+
+    if( itr != handlers.end() ) {
+
+        delete *itr;
+        handlers.erase(itr);
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::setFilter( Filter* filter DECAF_UNUSED ){
+}
+
+////////////////////////////////////////////////////////////////////////////////
+bool Logger::isLoggable( Level level DECAF_UNUSED ) const{
+    return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::entry( const std::string& blockName DECAF_UNUSED,
+                    const std::string& file DECAF_UNUSED,
+                    const int line DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::exit(const std::string& blockName DECAF_UNUSED,
+                  const std::string& file DECAF_UNUSED,
+                  const int line DECAF_UNUSED) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::debug( const std::string& file DECAF_UNUSED,
+                    const int line DECAF_UNUSED,
+                    const std::string fnctionName DECAF_UNUSED,
+                    const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::info( const std::string& file DECAF_UNUSED,
+                   const int line DECAF_UNUSED,
+                   const std::string fnctionName DECAF_UNUSED,
+                   const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::error( const std::string& file DECAF_UNUSED,
+                    const int line DECAF_UNUSED,
+                    const std::string fnctionName DECAF_UNUSED,
+                    const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::warn( const std::string& file DECAF_UNUSED,
+                   const int line DECAF_UNUSED,
+                   const std::string fnctionName DECAF_UNUSED,
+                   const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::fatal( const std::string& file DECAF_UNUSED,
+                    const int line DECAF_UNUSED,
+                    const std::string fnctionName DECAF_UNUSED,
+                    const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::log( Level level DECAF_UNUSED,
+                  const std::string& message DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::log( Level level DECAF_UNUSED,
+                  const std::string& file DECAF_UNUSED,
+                  const int line DECAF_UNUSED,
+                  const std::string& message DECAF_UNUSED,
+                  lang::Exception& ex DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::log( Level level DECAF_UNUSED,
+                  const std::string& file DECAF_UNUSED,
+                  const int line DECAF_UNUSED,
+                  const std::string& message DECAF_UNUSED, ... ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void Logger::log( LogRecord& record DECAF_UNUSED ) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Logger* Logger::getLogger( const std::string& name DECAF_UNUSED ) {
+    return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+Logger* Logger::getAnonymousLogger() {
+    return NULL;
+}



Mime
View raw message