summaryrefslogtreecommitdiff
path: root/apps/JAWS2/JAWS
diff options
context:
space:
mode:
authornobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-03-05 17:14:45 +0000
committernobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-03-05 17:14:45 +0000
commit58033491c6d0bac82315c1fdb1ec9b39be58093f (patch)
treec69c3aa67ec66758066e959bd0d533ea336ec236 /apps/JAWS2/JAWS
parent2efc882384a34f61311a24fc641d1b5fd5776356 (diff)
downloadATCD-TAO-1_5.tar.gz
This commit was manufactured by cvs2svn to create tag 'TAO-1_5'.TAO-1_5
Diffstat (limited to 'apps/JAWS2/JAWS')
-rw-r--r--apps/JAWS2/JAWS/Assoc_Array.cpp269
-rw-r--r--apps/JAWS2/JAWS/Assoc_Array.h102
-rw-r--r--apps/JAWS2/JAWS/Cache_Hash_T.cpp237
-rw-r--r--apps/JAWS2/JAWS/Cache_Hash_T.h60
-rw-r--r--apps/JAWS2/JAWS/Cache_Heap_T.cpp290
-rw-r--r--apps/JAWS2/JAWS/Cache_Heap_T.h103
-rw-r--r--apps/JAWS2/JAWS/Cache_List_T.cpp217
-rw-r--r--apps/JAWS2/JAWS/Cache_List_T.h111
-rw-r--r--apps/JAWS2/JAWS/Cache_Manager.cpp188
-rw-r--r--apps/JAWS2/JAWS/Cache_Manager.h64
-rw-r--r--apps/JAWS2/JAWS/Cache_Manager_T.cpp579
-rw-r--r--apps/JAWS2/JAWS/Cache_Manager_T.h179
-rw-r--r--apps/JAWS2/JAWS/Cache_Object.cpp301
-rw-r--r--apps/JAWS2/JAWS/Cache_Object.h158
-rw-r--r--apps/JAWS2/JAWS/Concurrency.cpp349
-rw-r--r--apps/JAWS2/JAWS/Concurrency.h132
-rw-r--r--apps/JAWS2/JAWS/Data_Block.cpp76
-rw-r--r--apps/JAWS2/JAWS/Data_Block.h50
-rw-r--r--apps/JAWS2/JAWS/Export.h38
-rw-r--r--apps/JAWS2/JAWS/FILE.cpp68
-rw-r--r--apps/JAWS2/JAWS/FILE.h47
-rw-r--r--apps/JAWS2/JAWS/Filecache.cpp136
-rw-r--r--apps/JAWS2/JAWS/Filecache.h72
-rw-r--r--apps/JAWS2/JAWS/Hash_Bucket_T.cpp462
-rw-r--r--apps/JAWS2/JAWS/Hash_Bucket_T.h206
-rw-r--r--apps/JAWS2/JAWS/Headers.cpp168
-rw-r--r--apps/JAWS2/JAWS/Headers.h78
-rw-r--r--apps/JAWS2/JAWS/IO.cpp610
-rw-r--r--apps/JAWS2/JAWS/IO.h263
-rw-r--r--apps/JAWS2/JAWS/IO_Acceptor.cpp214
-rw-r--r--apps/JAWS2/JAWS/IO_Acceptor.h141
-rw-r--r--apps/JAWS2/JAWS/IO_Handler.cpp511
-rw-r--r--apps/JAWS2/JAWS/IO_Handler.h318
-rw-r--r--apps/JAWS2/JAWS/JAWS.h15
-rw-r--r--apps/JAWS2/JAWS/Parse_Headers.cpp443
-rw-r--r--apps/JAWS2/JAWS/Parse_Headers.h123
-rw-r--r--apps/JAWS2/JAWS/Pipeline.cpp27
-rw-r--r--apps/JAWS2/JAWS/Pipeline.h39
-rw-r--r--apps/JAWS2/JAWS/Pipeline_Handler_T.cpp31
-rw-r--r--apps/JAWS2/JAWS/Pipeline_Handler_T.h32
-rw-r--r--apps/JAWS2/JAWS/Pipeline_Tasks.cpp213
-rw-r--r--apps/JAWS2/JAWS/Pipeline_Tasks.h56
-rw-r--r--apps/JAWS2/JAWS/Policy.cpp89
-rw-r--r--apps/JAWS2/JAWS/Policy.h65
-rw-r--r--apps/JAWS2/JAWS/Reaper.cpp45
-rw-r--r--apps/JAWS2/JAWS/Reaper.h48
-rw-r--r--apps/JAWS2/JAWS/Server.cpp194
-rw-r--r--apps/JAWS2/JAWS/Server.h39
-rw-r--r--apps/JAWS2/JAWS/Waiter.cpp73
-rw-r--r--apps/JAWS2/JAWS/Waiter.h49
-rw-r--r--apps/JAWS2/JAWS/jaws2.mpc47
51 files changed, 0 insertions, 8425 deletions
diff --git a/apps/JAWS2/JAWS/Assoc_Array.cpp b/apps/JAWS2/JAWS/Assoc_Array.cpp
deleted file mode 100644
index 36fc7d64763..00000000000
--- a/apps/JAWS2/JAWS/Assoc_Array.cpp
+++ /dev/null
@@ -1,269 +0,0 @@
-// $Id$
-
-#ifndef JAWS_ASSOC_ARRAY_CPP
-#define JAWS_ASSOC_ARRAY_CPP
-
-#include "ace/config-all.h"
-#include "JAWS/Assoc_Array.h"
-
-ACE_RCSID(JAWS, Assoc_Array, "$Id$")
-
-template <class KEY, class DATA>
-JAWS_Assoc_Array<KEY,DATA>::JAWS_Assoc_Array (int maxsize)
- : k_array_ (0),
- d_array_ (0),
- maxsize_ (maxsize)
-{
- typedef void * ptr_type;
-
- this->k_array_ = reinterpret_cast<KEY **> (new ptr_type[this->maxsize_]);
- if (this->k_array_ == 0)
- {
- this->maxsize_ = 0;
- return;
- }
-
- this->d_array_ = reinterpret_cast<DATA **> (new ptr_type[this->maxsize_]);
- if (this->d_array_ == 0)
- {
- delete[] this->k_array_;
- this->maxsize_ = 0;
- return;
- }
-
- for (int i = 0; i < this->maxsize_; i++)
- {
- this->k_array_[i] = 0;
- this->d_array_[i] = 0;
- }
-}
-
-template <class KEY, class DATA>
-JAWS_Assoc_Array<KEY,DATA>::~JAWS_Assoc_Array (void)
-{
- this->clear ();
-
- delete[] reinterpret_cast<void **> (this->k_array_);
- delete[] reinterpret_cast<void **> (this->d_array_);
-
- this->k_array_ = 0;
- this->d_array_ = 0;
-}
-
-template <class KEY, class DATA> int
-JAWS_Assoc_Array<KEY,DATA>::index (const KEY &k)
-{
- return this->find_i (k);
-}
-
-template <class KEY, class DATA> DATA *
-JAWS_Assoc_Array<KEY,DATA>::find (const KEY &k)
-{
- int i = this->find_i (k);
-
- return (i < this->maxsize_) ? this->d_array_[i] : 0;
-}
-
-template <class KEY, class DATA> DATA *
-JAWS_Assoc_Array<KEY,DATA>::find_by_index (int i)
-{
- return ((0 <= i) && (i < this->maxsize_)) ? this->d_array_[i] : 0;
-}
-
-template <class KEY, class DATA> DATA *
-JAWS_Assoc_Array<KEY,DATA>::insert (const KEY &k, const DATA &d)
-{
- int i = this->find_i (k);
-
- if (i == this->maxsize_)
- return 0;
-
- KEY *&kk = this->k_array_[i];
- DATA *&dd = this->d_array_[i];
-
- if (kk == 0)
- {
- dd = new DATA (d);
- if (dd == 0)
- return 0;
-
- KEY *kkk = new KEY (k);
- if (kkk == 0)
- {
- delete dd;
- return 0;
- }
- kk = kkk;
- }
-
- return dd;
-}
-
-template <class KEY, class DATA> int
-JAWS_Assoc_Array<KEY,DATA>::remove (const KEY &k)
-{
- int i = this->find_i (k);
-
- if (i == this->maxsize_)
- return 0;
-
- KEY *&kk = this->k_array_[i];
- DATA *&dd = this->d_array_[i];
-
- if (kk != 0)
- {
- KEY *kkk = kk;
- kk = 0;
- delete kkk;
- delete dd;
- dd = 0;
- return 1;
- }
-
- return 0;
-}
-
-template <class KEY, class DATA> void
-JAWS_Assoc_Array<KEY,DATA>::clear (void)
-{
- for (int i = 0; i < this->maxsize_; i++)
- {
- if (this->k_array_[i] != 0)
- {
- delete this->k_array_[i];
- delete this->d_array_[i];
-
- this->k_array_[i] = 0;
- this->d_array_[i] = 0;
- }
- }
-}
-
-template <class KEY, class DATA> int
-JAWS_Assoc_Array<KEY,DATA>::find_i (const KEY &k)
-{
- int j = this->maxsize_;
-
- for (int i = 0; i < this->maxsize_; i++)
- {
- KEY *kk = this->k_array_[i];
- if (kk)
- {
- if (*kk == k)
- return i;
- }
- else if (j == this->maxsize_)
- j = i;
- }
- return j;
-}
-
-template <class KEY, class DATA>
-JAWS_Assoc_Array_Iterator<KEY,DATA>::
-JAWS_Assoc_Array_Iterator (const JAWS_Assoc_Array<KEY, DATA> &aa)
- : aa_ (aa),
- i_ (0),
- j_ (0)
-{
-}
-
-template <class KEY, class DATA>
-JAWS_Assoc_Array_Iterator<KEY,DATA>::~JAWS_Assoc_Array_Iterator (void)
-{
-}
-
-template <class KEY, class DATA> KEY *
-JAWS_Assoc_Array_Iterator<KEY,DATA>::key (void)
-{
- return this->aa_.k_array_[this->i_];
-}
-
-template <class KEY, class DATA> DATA *
-JAWS_Assoc_Array_Iterator<KEY,DATA>::data (void)
-{
- return this->aa_.d_array_[this->i_];
-}
-
-template <class KEY, class DATA> int
-JAWS_Assoc_Array_Iterator<KEY,DATA>::first (void)
-{
- this->i_ = 0;
- for (this->j_ = 0; this->j_ < this->aa_.maxsize_; this->j_++)
- {
- if (this->aa_.k_array_[this->j_] != 0)
- break;
- }
- return this->next ();
-}
-
-template <class KEY, class DATA> int
-JAWS_Assoc_Array_Iterator<KEY,DATA>::last (void)
-{
- this->j_ = this->aa_.maxsize_;
- for (this->i_ = this->aa_.maxsize_; this->i_ > 0; this->i_--)
- {
- if (this->aa_.k_array_[this->i_-1] != 0)
- break;
- }
-
- return (this->i_-- > 0);
-}
-
-template <class KEY, class DATA> int
-JAWS_Assoc_Array_Iterator<KEY,DATA>::next (void)
-{
- if (this->j_ < this->aa_.maxsize_)
- {
- this->i_ = this->j_;
- for (this->j_++; this->j_ < this->aa_.maxsize_; this->j_++)
- {
- if (this->aa_.k_array_[this->j_] != 0)
- break;
- }
- }
-
- return (this->i_ < this->aa_.maxsize_);
-}
-
-template <class KEY, class DATA> int
-JAWS_Assoc_Array_Iterator<KEY,DATA>::previous (void)
-{
- if (this->i_ > 0)
- {
- for (this->j_ = this->i_; this->i_ > 0; this->i_--)
- {
- if (this->aa_.k_array_[this->i_-1] != 0)
- break;
- }
- }
-
- if (this->i_ == 0)
- this->first ();
- else
- this->i_--;
-
- return 1;
-}
-
-template <class KEY, class DATA> int
-JAWS_Assoc_Array_Iterator<KEY,DATA>::is_done (void)
-{
- return (this->j_ == this->aa_.maxsize_);
-}
-
-template <class KEY, class DATA>
-JAWS_Assoc_Array_Iterator<KEY,DATA>::
-JAWS_Assoc_Array_Iterator (const JAWS_Assoc_Array_Iterator<KEY, DATA> &aai)
- : aa_ (aai.aa_),
- i_ (aai.i_),
- j_ (aai.j_)
-{
-}
-
-template <class KEY, class DATA> void
-JAWS_Assoc_Array_Iterator<KEY,DATA>::
-operator= (const JAWS_Assoc_Array_Iterator<KEY, DATA> &)
-{
-}
-
-#endif /* !defined (JAWS_ASSOC_ARRAY_CPP) */
diff --git a/apps/JAWS2/JAWS/Assoc_Array.h b/apps/JAWS2/JAWS/Assoc_Array.h
deleted file mode 100644
index d5692a5cf03..00000000000
--- a/apps/JAWS2/JAWS/Assoc_Array.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_ASSOC_ARRAY_H
-#define JAWS_ASSOC_ARRAY_H
-
-template <class KEY, class DATA> class JAWS_Assoc_Array_Iterator;
-
-template <class KEY, class DATA>
-class JAWS_Assoc_Array
-{
-
-friend class JAWS_Assoc_Array_Iterator<KEY, DATA>;
-
-public:
- JAWS_Assoc_Array (int maxsize = 1024);
- ~JAWS_Assoc_Array (void);
-
- int index (const KEY &k);
- // Returns the index into the array associated with key k
- // Returns -1 if not found.
-
- DATA * find (const KEY &k);
- // Returns the data associated with key k. 0 if not found.
-
- DATA * find_by_index (int i);
- // Returns the data associated with array index i. Returns 0 if the
- // index is invalid.
-
- DATA * insert (const KEY &k, const DATA &d);
- // Inserts a *copy* of the key and data into the associated array.
- // Both KEY and DATA must have well defined semantics for copy
- // construction. This method returns a pointer to the inserted item
- // copy, or 0 if an error occurred. NOTE: if an identical key
- // already exists in the tree, no new item is created, and the
- // returned pointer addresses the existing item associated with the
- // existing key.
-
- int remove (const KEY &k);
- // Removes the item associated with the given key from the
- // tree and destroys it. Returns 1 if it found the item
- // and successfully destroyed it, 0 if it did not find the
- // item, or -1 if an error occurred.
-
- void clear (void);
- // Destroys all keys and associated data.
-
-protected:
-
- int find_i (const KEY &k);
- // If k points to an associated data item, then this function
- // returns the index into the arrays that hold it. Otherwise, it
- // returns an index suitable to insert the item. If the item is not
- // found and the table is full, maxsize_ is returned.
-
-private:
- KEY **k_array_;
- DATA **d_array_;
- int maxsize_;
-};
-
-template <class KEY, class DATA>
-class JAWS_Assoc_Array_Iterator
-{
-public:
-
- JAWS_Assoc_Array_Iterator (const JAWS_Assoc_Array<KEY, DATA> &aa);
- ~JAWS_Assoc_Array_Iterator (void);
-
- KEY * key (void);
- DATA * data (void);
-
- int first (void);
- int last (void);
- int next (void);
- int previous (void);
- int is_done (void);
-
-private:
-
- // declare private and do not define: explicitly
- // prevent assignment and copy construction of iterators
- JAWS_Assoc_Array_Iterator (const JAWS_Assoc_Array_Iterator<KEY, DATA> &);
- void operator= (const JAWS_Assoc_Array_Iterator<KEY, DATA> &);
-
-private:
-
- const JAWS_Assoc_Array<KEY, DATA> &aa_;
-
- int i_;
- // The current item pointed by iterator.
-
- int j_;
- // The next item to be pointed to by iterator.
-
-};
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "JAWS/Assoc_Array.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#endif /* !defined (JAWS_ASSOC_ARRAY_H) */
diff --git a/apps/JAWS2/JAWS/Cache_Hash_T.cpp b/apps/JAWS2/JAWS/Cache_Hash_T.cpp
deleted file mode 100644
index a908c4147f1..00000000000
--- a/apps/JAWS2/JAWS/Cache_Hash_T.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-// $Id$
-
-#ifndef JAWS_CACHE_HASH_T_CPP
-#define JAWS_CACHE_HASH_T_CPP
-
-#include "JAWS/Cache_Hash_T.h"
-#include "JAWS/Hash_Bucket_T.h"
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> unsigned long
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::hash (const EXT_ID &ext_id) const
-{
- return HASH_FUNC (ext_id) % this->size_;
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::isprime (unsigned long number) const
-{
- unsigned long d = 3;
-
- if (number <= 2) return (number == 2);
-
- if (number % 2 == 0) return 0;
-
- while (d <= number/d)
- {
- if (number % d == 0) return 0;
- d += 2;
- }
-
- return 1;
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::new_cachebucket (size_t hash_idx)
-{
- if (this->hashtable_[hash_idx] == 0)
- {
- size_t alloc_size = sizeof (CACHE_BUCKET_MANAGER);
- ACE_NEW_MALLOC_RETURN (this->hashtable_[hash_idx],
- (CACHE_BUCKET_MANAGER *)
- this->allocator_->malloc (alloc_size),
- CACHE_BUCKET_MANAGER (this->allocator_), -1);
- }
-
- return 0;
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC>
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::JAWS_Cache_Hash (ACE_Allocator *alloc,
- size_t size)
- : allocator_ (alloc),
- hashtable_ (0)
-{
- while (!this->isprime (size))
- size++;
-
- this->size_ = size;
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- size_t memsize = this->size_ * sizeof (CACHE_BUCKET_MANAGER *);
-
- this->hashtable_
- = (CACHE_BUCKET_MANAGER **) this->allocator_->malloc (memsize);
-
- if (this->hashtable_)
- {
- for (size_t i = 0; i < this->size_; i++)
- this->hashtable_[i] = 0;
- }
- else
- {
- this->size_ = 0;
- // should indicate something is wrong to the user.
- }
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC>
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::~JAWS_Cache_Hash (void)
-{
- if (this->hashtable_)
- {
- for (size_t i = 0; i < this->size_; i++)
- {
- if (this->hashtable_[i])
- {
-
- ACE_DES_FREE_TEMPLATE3(this->hashtable_[i],
- this->allocator_->free,
- JAWS_Hash_Bucket_Manager,
- EXT_ID,
- JAWS_Cache_Object *,
- EQ_FUNC);
-
-
-
-
-
- this->hashtable_[i] = 0;
- }
- }
- this->allocator_->free (this->hashtable_);
- this->hashtable_ = 0;
- }
-
- this->allocator_ = 0;
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::find (const EXT_ID &ext_id) const
-{
- unsigned long hash_idx = this->hash (ext_id);
-
- if (this->hashtable_[hash_idx] == 0)
- return -1;
-
- return this->hashtable_[hash_idx]->find (ext_id);
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::find (const EXT_ID &ext_id,
- JAWS_Cache_Object *&int_id) const
-{
- unsigned long hash_idx = this->hash (ext_id);
-
- if (this->hashtable_[hash_idx] == 0)
- return -1;
-
- return this->hashtable_[hash_idx]->find (ext_id, int_id);
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::bind (const EXT_ID &ext_id,
- JAWS_Cache_Object *const &int_id)
-{
- int result;
- unsigned long hash_idx = this->hash (ext_id);
-
- if (this->hashtable_[hash_idx] == 0)
- {
- ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
-
- if (this->new_cachebucket (hash_idx) == -1)
- return -1;
-
- result = this->hashtable_[hash_idx]->bind (ext_id, int_id);
- }
- else
- result = this->hashtable_[hash_idx]->bind (ext_id, int_id);
-
- return result;
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::trybind (const EXT_ID &ext_id,
- JAWS_Cache_Object *&int_id)
-{
- int result;
- unsigned long hash_idx = this->hash (ext_id);
-
- if (this->hashtable_[hash_idx] == 0)
- {
- ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
-
- if (this->new_cachebucket (hash_idx) == -1)
- return -1;
-
- result = this->hashtable_[hash_idx]->trybind (ext_id, int_id);
- }
- else
- result = this->hashtable_[hash_idx]->trybind (ext_id, int_id);
-
- return result;
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::rebind (const EXT_ID &ext_id,
- JAWS_Cache_Object *const &int_id,
- EXT_ID &old_ext_id,
- JAWS_Cache_Object *&old_int_id)
-{
- int result;
- unsigned long hash_idx = this->hash (ext_id);
-
- if (this->hashtable_[hash_idx] == 0)
- {
- ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
-
- if (this->new_cachebucket (hash_idx) == -1)
- return -1;
-
- result = this->hashtable_[hash_idx]->rebind (ext_id, int_id,
- old_ext_id, old_int_id);
- }
- else
- result = this->hashtable_[hash_idx]->rebind (ext_id, int_id,
- old_ext_id, old_int_id);
-
- return result;
-}
-
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::unbind (const EXT_ID &ext_id)
-{
- unsigned long hash_idx = this->hash (ext_id);
-
- if (this->hashtable_[hash_idx] == 0)
- return -1;
-
- return this->hashtable_[hash_idx]->unbind (ext_id);
-}
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::unbind (const EXT_ID &ext_id,
- JAWS_Cache_Object *&int_id)
-{
- unsigned long hash_idx = this->hash (ext_id);
-
- if (this->hashtable_[hash_idx] == 0)
- return -1;
-
- return this->hashtable_[hash_idx]->unbind (ext_id, int_id);
-}
-
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC> size_t
-JAWS_Cache_Hash<EXT_ID,HASH_FUNC,EQ_FUNC>::size (void) const
-{
- return this->size_;
-}
-
-
-
-
-#endif /* JAWS_CACHEHASH_T_CPP */
diff --git a/apps/JAWS2/JAWS/Cache_Hash_T.h b/apps/JAWS2/JAWS/Cache_Hash_T.h
deleted file mode 100644
index f5f050c3801..00000000000
--- a/apps/JAWS2/JAWS/Cache_Hash_T.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_CACHE_HASH_T_H
-#define JAWS_CACHE_HASH_T_H
-
-#include "JAWS/Cache_Object.h"
-
-// Forward declaration
-template <class EXT_ID, class INT_ID, class EQ_FUNC>
-class JAWS_Hash_Bucket_Manager;
-
-template <class EXT_ID, class HASH_FUNC, class EQ_FUNC>
-class JAWS_Cache_Hash
-{
-public:
-
- typedef JAWS_Hash_Bucket_Manager<EXT_ID, JAWS_Cache_Object *, EQ_FUNC>
- CACHE_BUCKET_MANAGER;
-
- JAWS_Cache_Hash (ACE_Allocator *alloc = 0, size_t size = 521);
- // 521 == smallest number > 512 that is prime. Why is a prime
- // number important? I am trying to maximize scattering when using
- // mod on the hashed value. This might be bogus though.
-
- virtual ~JAWS_Cache_Hash (void);
-
- int find (const EXT_ID &ext_id) const;
- int find (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id) const;
- int bind (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id);
- int trybind (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id);
- int rebind (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id,
- EXT_ID &old_ext_id, JAWS_Cache_Object *&old_int_id);
-
- int unbind (const EXT_ID &ext_id);
- int unbind (const EXT_ID &ext_id, JAWS_Cache_Object *&int_id);
-
- size_t size (void) const;
-
-protected:
-
- virtual unsigned long hash (const EXT_ID &ext_id) const;
- int isprime (unsigned long number) const;
- int new_cachebucket (size_t idx);
-
-private:
-
- ACE_Allocator *allocator_;
- size_t size_;
-
- ACE_SYNCH_MUTEX lock_;
- CACHE_BUCKET_MANAGER **hashtable_;
-
-};
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "JAWS/Cache_Hash_T.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#endif /* ACE_CACHE_HASH_T_H */
diff --git a/apps/JAWS2/JAWS/Cache_Heap_T.cpp b/apps/JAWS2/JAWS/Cache_Heap_T.cpp
deleted file mode 100644
index b19ff8e79b1..00000000000
--- a/apps/JAWS2/JAWS/Cache_Heap_T.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-// $Id$
-
-#ifndef JAWS_CACHE_HEAP_T_CPP
-#define JAWS_CACHE_HEAP_T_CPP
-
-#include "JAWS/Cache_Heap_T.h"
-#include "JAWS/Cache_Manager_T.h"
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::JAWS_Cache_Heap (ACE_Allocator *alloc,
- size_t maxsize)
- : allocator_ (alloc),
- maxsize_ (maxsize),
- size_ (0)
-{
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- size_t memsize
- = this->maxsize_ * sizeof (Cache_Heap_Item *);
-
- this->heap_ = (Cache_Heap_Item **) this->allocator_->malloc (memsize);
- if (this->heap_)
- {
- for (size_t i = 0; i < this->maxsize_; i++)
- this->heap_[i] = 0;
- }
- else
- {
- this->maxsize_ = 0;
- // should indicate something
- }
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::~JAWS_Cache_Heap (void)
-{
- if (this->heap_ != 0)
- {
- for (size_t i = 0; i < this->maxsize_; i++)
- {
- if (this->heap_[i])
- {
- ACE_DES_FREE_TEMPLATE4(this->heap_[i], this->allocator_->free,
- JAWS_Cache_Heap_Item,
- EXT_ID, FACT, H_FN, E_FN);
-
- this->heap_[i] = 0;
- }
- }
- this->allocator_->free (this->heap_);
- this->heap_ = 0;
- }
-
- this->allocator_ = 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::is_empty (void) const
-{
- return (this->size_ == 0);
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::is_full (void) const
-{
- return (this->size_ == this->maxsize_);
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> size_t
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::size (void) const
-{
- return this->size_;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> size_t
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::maxsize (void) const
-{
- return this->maxsize_;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::maxsize (Cache_Manager *cm,
- size_t new_maxsize)
-{
- int result = -1;
-
- size_t memsize
- = new_maxsize * sizeof (Cache_Heap_Item *);
-
- Cache_Heap_Item **new_heap
- = (Cache_Heap_Item **) this->allocator_->malloc (memsize);
- if (new_heap)
- {
- while (new_maxsize < this->size_)
- cm->FLUSH_i ();
-
- for (size_t i = 0; i < new_maxsize; i++)
- if (i < this->size_)
- new_heap[i] = this->heap_[i];
- else
- new_heap[i] = 0;
-
- Cache_Heap_Item ** volatile temp = this->heap_;
- this->heap_ = new_heap;
- this->maxsize_ = new_maxsize;
- this->allocator_->free (temp);
- result = 0;
- }
-
- return result;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> void
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::insert_i (Cache_Heap_Item *item)
-{
- /* ASSERT: this->size_ < this->maxsize_ */
-
- size_t i;
-
- for (i = this->size_ + 1; i > 1; i /= 2)
- {
- if (item->priority () > this->heap_[i/2 - 1]->priority ())
- break;
-
- this->heap_[i-1] = this->heap_[i/2 - 1];
- this->heap_[i-1]->heap_idx_ = i-1;
- }
-
- this->heap_[i-1] = item;
- this->heap_[i-1]->heap_idx_ = i-1;
- this->size_++;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::insert (const EXT_ID &ext_id,
- JAWS_Cache_Object *const &int_id)
-{
- if (this->is_full ())
- return -1;
-
- Cache_Heap_Item *item;
- ACE_NEW_MALLOC_RETURN (item,
- (Cache_Heap_Item *)
- this->allocator_->malloc (sizeof (Cache_Heap_Item)),
- Cache_Heap_Item (ext_id, int_id), -1);
-
- this->insert_i (item);
-
- return 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> void
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::remove_i (void)
-{
- /* ASSERT: this->size_ > 0 */
- this->size_--;
- Cache_Heap_Item *temp = this->heap_[this->size_];
- this->heap_[this->size_] = 0;
-
- size_t i = 1;
- while (2*i <= this->size_)
- {
- size_t child = 2*i;
- if ((child < this->size_)
- && (this->heap_[2*i]->priority ()
- < this->heap_[2*i - 1]->priority ()))
- child = 2*i + 1;
-
- if (temp->priority () < this->heap_[child-1]->priority ())
- break;
-
- this->heap_[i-1] = this->heap_[child-1];
- this->heap_[i-1]->heap_idx_ = i-1;
- i = child;
- }
-
- if (this->size_ > 0)
- {
- this->heap_[i-1] = temp;
- this->heap_[i-1]->heap_idx_ = i-1;
- }
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> void
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::remove_i (size_t pos)
-{
- Cache_Heap_Item *item = this->heap_[pos];
-
- if (pos > 0)
- {
- int i = pos + 1;
- do
- {
- this->heap_[i-1] = this->heap_[i/2 - 1];
- this->heap_[i-1]->heap_idx_ = i-1;
- i /= 2;
- }
- while (i > 1);
- }
-
- this->heap_[0] = item;
-
- this->remove_i ();
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::remove (EXT_ID &ext_id,
- JAWS_Cache_Object *&int_id)
-{
- if (this->is_empty ())
- return -1;
-
- Cache_Heap_Item *item = this->heap_[0];
- item->int_id_->heap_item (0);
-
- this->remove_i ();
-
- ext_id = item->ext_id_;
- int_id = item->int_id_;
-
- ACE_DES_FREE_TEMPLATE4(item, this->allocator_->free,
- JAWS_Cache_Heap_Item,
- EXT_ID, FACT, H_FN, E_FN);
-
- item = 0;
- return 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::remove (void *item)
-{
- if (item == 0)
- return 0;
-
- Cache_Heap_Item *real_item = (Cache_Heap_Item *) item;
-
- // Make sure the item is where it thinks it is.
- if (this->heap_[real_item->heap_idx_] != real_item)
- return -1;
-
- real_item->int_id_->heap_item (0);
- this->remove_i (real_item->heap_idx_);
-
- ACE_DES_FREE_TEMPLATE4(real_item, this->allocator_->free,
- JAWS_Cache_Heap_Item,
- EXT_ID, FACT, H_FN, E_FN);
-
- real_item = 0;
-
- return 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_Heap<EXT_ID,FACT,H_FN,E_FN>::adjust (void *item)
-{
- if (item == 0)
- return 0;
-
- Cache_Heap_Item *real_item = (Cache_Heap_Item *) item;
-
- // Make sure the item is where it thinks it is.
- if (this->heap_[real_item->heap_idx_] != real_item)
- return -1;
-
- this->remove_i (real_item->heap_idx_);
- this->insert_i (real_item);
-
- return 0;
-}
-
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-JAWS_Cache_Heap_Item<EXT_ID,FACT,H_FN,E_FN>::
-JAWS_Cache_Heap_Item (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id)
- : ext_id_ (ext_id),
- int_id_ (int_id),
- heap_idx_ (0)
-{
- this->int_id_->heap_item (this);
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> unsigned int
-JAWS_Cache_Heap_Item<EXT_ID,FACT,H_FN,E_FN>::priority (void)
-{
- return this->int_id_->priority ();
-}
-
-
-#endif /* JAWS_CACHE_HEAP_T_CPP */
diff --git a/apps/JAWS2/JAWS/Cache_Heap_T.h b/apps/JAWS2/JAWS/Cache_Heap_T.h
deleted file mode 100644
index 16fbe890fe6..00000000000
--- a/apps/JAWS2/JAWS/Cache_Heap_T.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_CACHE_HEAP_T_H
-#define JAWS_CACHE_HEAP_T_H
-
-#include "ace/Malloc.h"
-#include "JAWS/Cache_Object.h"
-
-// Forward declarations
-template <class EXT_ID, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-class JAWS_Cache_Manager;
-
-template <class EXT_ID, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-class JAWS_Cache_Heap_Item;
-
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-class JAWS_Cache_Heap
-// Roll my own heap here. Eventually, a heap should be its own
-// standalone data structure.
-{
-public:
-
- typedef JAWS_Cache_Manager<EXT_ID, FACT, H_FN, E_FN> Cache_Manager;
- typedef JAWS_Cache_Heap_Item<EXT_ID, FACT, H_FN, E_FN> Cache_Heap_Item;
-
- JAWS_Cache_Heap (ACE_Allocator *alloc = 0, size_t maxsize = 8192);
- // maxsize is the total number of objects the in memory cache is
- // willing to manage
-
- ~JAWS_Cache_Heap (void);
-
- int is_empty (void) const;
- int is_full (void) const;
-
- size_t size (void) const;
- size_t maxsize (void) const;
-
- int maxsize (Cache_Manager *cm, size_t new_maxsize);
- // attempt to grow (or shrink) the heap. Return 0 on success, -1 on
- // error.
-
- int insert (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id);
- // attempt to insert int_id into heap.
-
- int remove (EXT_ID &ext_id, JAWS_Cache_Object *&int_id);
- // attempt to remove the top element of heap.
-
- int remove (void *item);
- // treat item as a Cache_Heap_Item, and remove it from the heap
-
- int adjust (void *item);
- // treat item as a Cache_Heap_Item, and alter its heap position
-
-protected:
-
- void insert_i (Cache_Heap_Item *item);
- // insert item into heap.
-
- void remove_i (size_t pos);
- // remove the element residing at pos, but do not delete it.
-
- void remove_i (void);
- // remove the element residing at the top of heap, but do not delete it.
-
-private:
-
- ACE_Allocator *allocator_;
-
- size_t maxsize_;
- size_t size_;
-
- Cache_Heap_Item **heap_;
-
-};
-
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-class JAWS_Cache_Heap_Item
-{
-
- friend class JAWS_Cache_Heap<EXT_ID, FACT, H_FN, E_FN>;
-
-public:
-
- JAWS_Cache_Heap_Item (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id);
- unsigned int priority (void);
-
-private:
-
- EXT_ID ext_id_;
- JAWS_Cache_Object *int_id_;
-
- size_t heap_idx_;
-
-};
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "JAWS/Cache_Heap_T.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#endif /* JAWS_CACHE_HEAP_T_H */
diff --git a/apps/JAWS2/JAWS/Cache_List_T.cpp b/apps/JAWS2/JAWS/Cache_List_T.cpp
deleted file mode 100644
index f6515d2652d..00000000000
--- a/apps/JAWS2/JAWS/Cache_List_T.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-// $Id$
-
-#ifndef JAWS_CACHE_LIST_T_CPP
-#define JAWS_CACHE_LIST_T_CPP
-
-#include "JAWS/Cache_List_T.h"
-#include "JAWS/Cache_Manager_T.h"
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::JAWS_Cache_List (ACE_Allocator *alloc,
- size_t maxsize)
- : allocator_ (alloc),
- maxsize_ (maxsize),
- size_ (0),
- head_ (0),
- tail_ (0)
-{
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::~JAWS_Cache_List (void)
-{
- while (this->head_ != 0)
- this->remove (this->head_);
-
- this->allocator_ = 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::is_empty (void) const
-{
- return (this->size_ == 0);
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::is_full (void) const
-{
- return (this->size_ == this->maxsize_);
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> size_t
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::size (void) const
-{
- return this->size_;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> size_t
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::maxsize (void) const
-{
- return this->maxsize_;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::maxsize (Cache_Manager *,
- size_t new_maxsize)
-{
- this->maxsize_ = new_maxsize;
- return 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> void
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::insert_i (Cache_List_Item *item)
-{
- /* ASSERT: this->size_ < this->maxsize_ */
- item->next_ = 0;
- item->prev_ = 0;
-
- if (this->size_++ == 0)
- this->head_ = this->tail_ = item;
- else
- {
- this->tail_->next_ = item;
- item->prev_ = this->tail_;
- this->tail_ = item;
- }
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::insert (const EXT_ID &ext_id,
- JAWS_Cache_Object *const &int_id)
-{
- if (this->is_full ())
- return -1;
-
- Cache_List_Item *item = 0;
- ACE_NEW_MALLOC_RETURN (item,
- (Cache_List_Item *)
- this->allocator_->malloc (sizeof (Cache_List_Item)),
- Cache_List_Item (ext_id, int_id), -1);
-
- this->insert_i (item);
-
- return 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> void
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::remove_i (void)
-{
- /* ASSERT: this->size_ > 0 */
- this->size_--;
- this->item_ = this->head_;
- if (this->head_ == this->tail_)
- {
- this->head_ = this->tail_ = 0;
- return;
- }
-
- this->head_ = this->head_->next_;
- this->head_->prev_ = 0;
- this->item_->next_ = 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> void
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::remove_i (Cache_List_Item *item)
-{
- this->size_--;
- this->item_ = item;
-
- if (item->next_ == 0 && item->prev_ == 0)
- {
- this->head_ = this->tail_ = 0;
- }
- else if (item->next_ == 0)
- {
- this->tail_ = item->prev_;
- this->tail_->next_ = 0;
- }
- else if (item->prev_ == 0)
- {
- this->head_ = item->next_;
- this->head_->prev_ = 0;
- }
- else
- {
- item->next_->prev_ = item->prev_;
- item->prev_->next_ = item->next_;
- }
-
- item->next_ = 0;
- item->prev_ = 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::remove (EXT_ID &ext_id,
- JAWS_Cache_Object *&int_id)
-{
- if (this->is_empty ())
- return -1;
-
- this->remove_i ();
-
- ext_id = this->item_->ext_id_;
- int_id = this->item_->int_id_;
- int_id->heap_item (0);
-
-
- ACE_DES_FREE_TEMPLATE4(this->item_, this->allocator_->free,
- JAWS_Cache_List_Item,
- EXT_ID, FACT, H_FN, E_FN);
-
- this->item_ = 0;
- return 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::remove (void *item)
-{
- if (item == 0)
- return 0;
-
- this->remove_i ((Cache_List_Item *) item);
- this->item_->int_id_->heap_item (0);
-
- ACE_DES_FREE_TEMPLATE4(this->item_, this->allocator_->free,
- JAWS_Cache_List_Item,
- EXT_ID, FACT, H_FN, E_FN);
-
- this->item_ = 0;
-
- return 0;
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> int
-JAWS_Cache_List<EXT_ID,FACT,H_FN,E_FN>::adjust (void *item)
-{
- if (item == 0)
- return 0;
-
- Cache_List_Item *real_item = (Cache_List_Item *) item;
-
- this->remove_i (real_item);
- this->insert_i (real_item);
- this->item_ = 0;
-
- return 0;
-}
-
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-JAWS_Cache_List_Item<EXT_ID,FACT,H_FN,E_FN>::
-JAWS_Cache_List_Item (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id)
- : ext_id_ (ext_id),
- int_id_ (int_id)
-{
- this->int_id_->heap_item (this);
-}
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN> unsigned int
-JAWS_Cache_List_Item<EXT_ID,FACT,H_FN,E_FN>::priority (void)
-{
- return this->int_id_->priority ();
-}
-
-
-#endif /* JAWS_CACHE_LIST_T_CPP */
diff --git a/apps/JAWS2/JAWS/Cache_List_T.h b/apps/JAWS2/JAWS/Cache_List_T.h
deleted file mode 100644
index 7dd9c7c8ca1..00000000000
--- a/apps/JAWS2/JAWS/Cache_List_T.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_CACHE_LIST_T_H
-#define JAWS_CACHE_LIST_T_H
-
-#include "ace/Malloc.h"
-#include "JAWS/Cache_Object.h"
-
-// Forward declarations
-template <class EXT_ID, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-class JAWS_Cache_Manager;
-
-template <class EXT_ID, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-class JAWS_Cache_List_Item;
-
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-class JAWS_Cache_List
-// Roll my own heap here. Eventually, a heap should be its own
-// standalone data structure.
-//
-// This version is not a heap, but a doubly linked list. We are
-// trying to simplify all the heap operations to be O(1).
-{
-public:
-
- typedef JAWS_Cache_Manager<EXT_ID, FACT, H_FN, E_FN> Cache_Manager;
- typedef JAWS_Cache_List_Item<EXT_ID, FACT, H_FN, E_FN> Cache_List_Item;
-
- JAWS_Cache_List (ACE_Allocator *alloc = 0, size_t maxsize = 8192);
- // maxsize is the total number of objects the in memory cache is
- // willing to manage
-
- ~JAWS_Cache_List (void);
-
- int is_empty (void) const;
- int is_full (void) const;
-
- size_t size (void) const;
- size_t maxsize (void) const;
-
- int maxsize (Cache_Manager *cm, size_t new_maxsize);
- // attempt to grow (or shrink) the heap. Return 0 on success, -1 on
- // error.
-
- int insert (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id);
- // attempt to insert int_id into heap.
-
- int remove (EXT_ID &ext_id, JAWS_Cache_Object *&int_id);
- // attempt to remove the top element of heap.
-
- int remove (void *item);
- // treat item as a Cache_List_Item, and remove it from the heap
-
- int adjust (void *item);
- // treat item as a Cache_List_Item, and alter its heap position
-
-protected:
-
- void insert_i (Cache_List_Item *item);
- // insert item into heap.
-
- void remove_i (Cache_List_Item *item);
- // remove the element residing at pos, but do not delete it.
-
- void remove_i (void);
- // remove the element residing at the top of heap, but do not delete it.
-
-private:
-
- ACE_Allocator *allocator_;
-
- size_t maxsize_;
- size_t size_;
-
- Cache_List_Item *item_;
-
- Cache_List_Item *head_;
- Cache_List_Item *tail_;
-
-};
-
-
-template <class EXT_ID, class FACT, class H_FN, class E_FN>
-class JAWS_Cache_List_Item
-{
-
- friend class JAWS_Cache_List<EXT_ID, FACT, H_FN, E_FN>;
-
-public:
-
- typedef JAWS_Cache_List<EXT_ID, FACT, H_FN, E_FN> Cache_List;
-
- JAWS_Cache_List_Item (const EXT_ID &ext_id, JAWS_Cache_Object *const &int_id);
- unsigned int priority (void);
-
-private:
-
- EXT_ID ext_id_;
- JAWS_Cache_Object *int_id_;
-
- JAWS_Cache_List_Item *next_;
- JAWS_Cache_List_Item *prev_;
-};
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "JAWS/Cache_List_T.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#endif /* JAWS_CACHE_LIST_T_H */
diff --git a/apps/JAWS2/JAWS/Cache_Manager.cpp b/apps/JAWS2/JAWS/Cache_Manager.cpp
deleted file mode 100644
index b6f2397fd1c..00000000000
--- a/apps/JAWS2/JAWS/Cache_Manager.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-// $Id$
-
-#include "ace/ACE.h"
-#include "ace/OS_NS_string.h"
-
-#include "JAWS/Cache_Manager.h"
-#include "JAWS/Cache_List_T.h"
-
-JAWS_String_Hash_Functor::JAWS_String_Hash_Functor (const char *s)
- : i_ (0)
-{
- this->i_ = ACE::hash_pjw (s);
-}
-
-JAWS_String_Hash_Functor::operator unsigned long (void) const
-{
- return this->i_;
-}
-
-JAWS_String_Equal_Functor::JAWS_String_Equal_Functor (const char *s1,
- const char *s2)
- : i_ (0)
-{
- this->i_ = ACE_OS::strcmp (s1, s2);
-}
-
-JAWS_String_Equal_Functor::operator int (void) const
-{
- return this->i_ == 0;
-}
-
-JAWS_Strdup_String::JAWS_Strdup_String (void)
- : c_ (0),
- s_ (0)
-{
-}
-
-JAWS_Strdup_String::JAWS_Strdup_String (const char *s)
- : c_ (0),
- s_ (0)
-{
- this->c_ = new int (1);
- this->s_ = ACE_OS::strdup (s);
-}
-
-JAWS_Strdup_String::JAWS_Strdup_String (const JAWS_Strdup_String &s)
- : c_ (s.c_),
- s_ (s.s_)
-{
- ++*(this->c_);
-}
-
-JAWS_Strdup_String::~JAWS_Strdup_String (void)
-{
- if (this->c_ && --*(this->c_) == 0)
- {
- if (this->s_)
- ACE_OS::free (this->s_);
- delete this->c_;
- }
- this->s_ = 0;
- this->c_ = 0;
-}
-
-JAWS_Strdup_String::operator const char * (void) const
-{
- return this->s_;
-}
-
-void
-JAWS_Strdup_String::operator = (const char *s)
-{
- if (this->c_ && --*(this->c_) == 0)
- {
- if (this->s_)
- ACE_OS::free (this->s_);
- delete this->c_;
- }
- this->c_ = new int (1);
- this->s_ = ACE_OS::strdup (s);
-}
-
-void
-JAWS_Strdup_String::operator = (const JAWS_Strdup_String &s)
-{
- if (this->c_ && --*(this->c_) == 0)
- {
- if (this->s_)
- ACE_OS::free (this->s_);
- delete this->c_;
- }
- this->c_ = s.c_;
- this->s_ = s.s_;
- ++*(this->c_);
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-
-template class JAWS_Hash_Bucket_Item<JAWS_Strdup_String, JAWS_Cache_Object *>;
-template class JAWS_Hash_Bucket_DLCStack<JAWS_Strdup_String, JAWS_Cache_Object *>;
-template class JAWS_Hash_Bucket_DLCStack_Iterator<JAWS_Strdup_String,
- JAWS_Cache_Object *>;
-template class JAWS_Hash_Bucket_Manager<JAWS_Strdup_String,
- JAWS_Cache_Object *,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_Hash<JAWS_Strdup_String,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_List_Item<JAWS_Strdup_String,
- JAWS_Referenced_Cache_Object_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_List<JAWS_Strdup_String,
- JAWS_Referenced_Cache_Object_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_Manager<JAWS_Strdup_String,
- JAWS_Referenced_Cache_Object_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_List_Item<JAWS_Strdup_String,
- JAWS_Counted_Cache_Object_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_List<JAWS_Strdup_String,
- JAWS_Counted_Cache_Object_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_Manager<JAWS_Strdup_String,
- JAWS_Counted_Cache_Object_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class ACE_Singleton<JAWS_Referenced_Cache_Object_Factory,
- ACE_SYNCH_MUTEX>;
-template class ACE_Singleton<JAWS_Counted_Cache_Object_Factory,
- ACE_SYNCH_MUTEX>;
-template class ACE_Singleton<JAWS_String_Referenced_Cache_Manager,
- ACE_SYNCH_MUTEX>;
-template class ACE_Singleton<JAWS_String_Counted_Cache_Manager,
- ACE_SYNCH_MUTEX>;
-
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-#pragma instantiate JAWS_Hash_Bucket_Item<JAWS_Strdup_String, JAWS_Cache_Object *>
-#pragma instantiate JAWS_Hash_Bucket_DLCStack<JAWS_Strdup_String, \
- JAWS_Cache_Object *>
-#pragma instantiate JAWS_Hash_Bucket_DLCStack_Iterator<JAWS_Strdup_String, \
- JAWS_Cache_Object *>
-#pragma instantiate JAWS_Hash_Bucket_Manager<JAWS_Strdup_String, \
- JAWS_Cache_Object *, \
- JAWS_String_Equal_Functor>
-#pragma instantiate JAWS_Cache_Hash<JAWS_Strdup_String, \
- JAWS_String_Hash_Functor, \
- JAWS_String_Equal_Functor>
-#pragma instantiate JAWS_Cache_Heap_Item<JAWS_Strdup_String, \
- ACE_Referenced_Cache_Object_Factory, \
- JAWS_String_Hash_Functor, \
- JAWS_String_Equal_Functor>
-#pragma instantiate JAWS_Cache_Heap<JAWS_Strdup_String, \
- JAWS_Referenced_Cache_Object_Factory, \
- JAWS_String_Hash_Functor, \
- JAWS_String_Equal_Functor>
-#pragma instantiate JAWS_Cache_Manager<JAWS_Strdup_String, \
- JAWS_Referenced_Cache_Object_Factory, \
- JAWS_String_Hash_Functor, \
- JAWS_String_Equal_Functor>
-#pragma instantiate JAWS_Cache_Heap_Item<JAWS_Strdup_String, \
- JAWS_Counted_Cache_Object_Factory, \
- JAWS_String_Hash_Functor, \
- JAWS_String_Equal_Functor>
-#pragma instantiate JAWS_Cache_Heap<JAWS_Strdup_String, \
- JAWS_Counted_Cache_Object_Factory, \
- JAWS_String_Hash_Functor, \
- JAWS_String_Equal_Functor>
-#pragma instantiate JAWS_Cache_Manager<JAWS_Strdup_String, \
- JAWS_Counted_Cache_Object_Factory, \
- JAWS_String_Hash_Functor, \
- JAWS_String_Equal_Functor>
-#pragma instantiate ACE_Singleton<JAWS_Referenced_Cache_Object_Factory, \
- ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_Singleton<JAWS_Counted_Cache_Object_Factory, \
- ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_Singleton<JAWS_String_Referenced_Cache_Manager, \
- ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_Singleton<JAWS_String_Counted_Cache_Manager, \
- ACE_SYNCH_MUTEX>
-
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/Cache_Manager.h b/apps/JAWS2/JAWS/Cache_Manager.h
deleted file mode 100644
index c7837b935ba..00000000000
--- a/apps/JAWS2/JAWS/Cache_Manager.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_CACHE_MANAGER_H
-#define JAWS_CACHE_MANAGER_H
-
-#include "ace/ACE.h"
-
-#include "JAWS/Cache_Manager_T.h"
-
-class JAWS_String_Hash_Functor
-{
-public:
- JAWS_String_Hash_Functor (const char *s);
- operator unsigned long (void) const;
-
-private:
- unsigned long i_;
-};
-
-class JAWS_String_Equal_Functor
-{
-public:
- JAWS_String_Equal_Functor (const char *s1, const char *s2);
- operator int (void) const;
-
-private:
- int i_;
-};
-
-class JAWS_Strdup_String
-{
-public:
-
- JAWS_Strdup_String (void);
- JAWS_Strdup_String (const char *s);
- JAWS_Strdup_String (const JAWS_Strdup_String &s);
- ~JAWS_Strdup_String (void);
-
- operator const char * (void) const;
- void operator = (const char *s);
- void operator = (const JAWS_Strdup_String &s);
-
-private:
-
- int *c_;
- char *s_;
-
-};
-
-typedef JAWS_Cache_Manager<JAWS_Strdup_String,
- JAWS_Referenced_Cache_Object_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>
- JAWS_String_Referenced_Cache_Manager;
-
-typedef JAWS_Cache_Manager<JAWS_Strdup_String,
- JAWS_Counted_Cache_Object_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>
- JAWS_String_Counted_Cache_Manager;
-
-
-#endif /* JAWS_CACHE_MANAGER_H */
diff --git a/apps/JAWS2/JAWS/Cache_Manager_T.cpp b/apps/JAWS2/JAWS/Cache_Manager_T.cpp
deleted file mode 100644
index a4e54f693d5..00000000000
--- a/apps/JAWS2/JAWS/Cache_Manager_T.cpp
+++ /dev/null
@@ -1,579 +0,0 @@
-// $Id$
-
-#ifndef JAWS_CACHE_MANAGER_T_CPP
-#define JAWS_CACHE_MANAGER_T_CPP
-
-#include "JAWS/Cache_Manager_T.h"
-#include "JAWS/Cache_Hash_T.h"
-#include "JAWS/Cache_List_T.h"
-
-// FUZZ: disable check_for_streams_include
-#include "ace/streams.h"
-
-class Cache_Manager;
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::JAWS_Cache_Manager (ACE_Allocator *alloc,
- JAWS_Cache_Object_Factory *cof,
- size_t hashsize,
- size_t maxsize,
- size_t maxobjsize,
- size_t minobjsize,
- size_t highwater,
- size_t lowwater,
- int timetolive,
- int counted)
- : allocator_ (alloc),
- factory_ (cof),
- hashsize_ (hashsize),
- maxsize_ (maxsize),
- maxobjsize_ (maxobjsize),
- minobjsize_ (minobjsize),
- highwater_ (highwater),
- lowwater_ (lowwater),
- waterlevel_ (0),
- timetolive_ (timetolive),
- counted_ (counted),
- hash_ (0),
- heap_ (0)
-{
- // Some sanity checking needed here --
- if (this->lowwater_ > this->highwater_)
- this->lowwater_ = this->highwater_ / 2;
-
- if (this->maxobjsize_ > (this->highwater_ - this->lowwater_) * 1024)
- this->maxobjsize_ = (this->highwater_ - this->lowwater_) * (1024/2);
-
- if (this->minobjsize_ > this->maxobjsize_)
- this->minobjsize_ = this->maxobjsize_ / 2;
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- if (this->factory_ == 0)
- this->factory_ = Object_Factory::instance ();
-
- ACE_NEW_MALLOC (this->hash_,
- (Cache_Hash *)
- this->allocator_->malloc (sizeof (Cache_Hash)),
- Cache_Hash (alloc, hashsize));
-
- if (this->hash_ == 0)
- {
- this->hashsize_ = 0;
- return;
- }
-
- ACE_NEW_MALLOC (this->heap_,
- (Cache_Heap *)
- this->allocator_->malloc (sizeof (Cache_Heap)),
- Cache_Heap (alloc, maxsize));
-
- if (this->heap_ == 0)
- {
- this->maxsize_ = 0;
-
-
- ACE_DES_FREE_TEMPLATE3(this->hash_, this->allocator_->free,
- JAWS_Cache_Hash,
- KEY, HASH_FUNC, EQ_FUNC);
-
-
-
- this->hash_ = 0;
- this->hashsize_ = 0;
- }
-}
-
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::open (ACE_Allocator *alloc,
- JAWS_Cache_Object_Factory *cof,
- size_t hashsize,
- size_t maxsize,
- size_t maxobjsize,
- size_t minobjsize,
- size_t highwater,
- size_t lowwater,
- int timetolive,
- int counted)
-{
- this->close ();
-
- this->allocator_ = alloc;
- this->factory_ = cof;
- this->hashsize_ = hashsize;
- this->maxsize_ = maxsize;
- this->maxobjsize_ = maxobjsize;
- this->minobjsize_ = minobjsize;
- this->highwater_ = highwater;
- this->lowwater_ = lowwater;
- this->waterlevel_ = 0;
- this->timetolive_ = timetolive;
- this->counted_ = counted;
-
- // Some sanity checking needed here --
- if (this->lowwater_ > this->highwater_)
- this->lowwater_ = this->highwater_ / 2;
-
- if (this->maxobjsize_ > (this->highwater_ - this->lowwater_) * 1024)
- this->maxobjsize_ = (this->highwater_ - this->lowwater_) * (1024/2);
-
- if (this->minobjsize_ > this->maxobjsize_)
- this->minobjsize_ = this->maxobjsize_ / 2;
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- if (this->factory_ == 0)
- this->factory_ = Object_Factory::instance ();
-
- this->hash_ = (Cache_Hash *) this->allocator_->malloc (sizeof (Cache_Hash));
- if (this->hash_ == 0)
- {
- errno = ENOMEM;
- this->hashsize_ = 0;
-
- return -1;
- }
- new (this->hash_) Cache_Hash (alloc, hashsize);
-
- this->heap_ = (Cache_Heap *) this->allocator_->malloc (sizeof (Cache_Heap));
- if (this->heap_ == 0)
- {
- errno = ENOMEM;
- this->maxsize_ = 0;
-
-
- ACE_DES_FREE_TEMPLATE3(this->hash_, this->allocator_->free,
- JAWS_Cache_Hash,
- KEY, HASH_FUNC, EQ_FUNC);
-
-
-
- this->hash_ = 0;
- this->hashsize_ = 0;
-
- return -1;
- }
- new (this->heap_) Cache_Heap (alloc, maxsize);
-
- return 0;
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>::~JAWS_Cache_Manager (void)
-{
- this->close ();
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>::close (void)
-{
- while (this->waterlevel_ > 0)
- this->FLUSH_i ();
-
- if (this->hash_)
- {
-
- ACE_DES_FREE_TEMPLATE3(this->hash_, this->allocator_->free,
- JAWS_Cache_Hash,
- KEY, HASH_FUNC, EQ_FUNC);
-
-
-
- this->hash_ = 0;
- }
-
- if (this->heap_)
- {
-
- ACE_DES_FREE_TEMPLATE4(this->heap_, this->allocator_->free,
- JAWS_Cache_List,
- KEY, FACTORY, HASH_FUNC, EQ_FUNC);
-
-
-
- this->heap_ = 0;
- }
-
- return 0;
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::GET_i (const KEY &key, JAWS_Cache_Object *&object)
-{
- int result = this->hash_->find (key, object);
-
- if (result == 0)
- this->TAKE (object);
- else
- object = 0;
-
- return result;
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::PUT_i (const KEY &key, const void *data, size_t size, JAWS_Cache_Object *&obj)
-{
- int result = 0;
-
- if (data == 0)
- {
- this->FLUSH_i (key);
- obj = 0;
- return 0;
- }
-
- result = this->MAKE (data, size, obj);
- if (result == -1)
- {
- if (size/1024 <= this->maxobjsize_)
- cerr << "MAKE failed. Bummer!" << endl;
- else
- this->DROP_i (obj);
- return -1;
- }
-
- obj->internal (new KEY (key));
-
- KEY old_key;
- JAWS_Cache_Object *old_obj;
-
- result = this->hash_->rebind (key, obj, old_key, old_obj);
- if (result == -1)
- {
- cerr << "*** hash bind error: " << key << endl;
- obj->release ();
- this->DROP_i (obj);
- return -1;
- }
- else if (result == 1)
- {
- this->heap_->remove (old_obj->heap_item ());
- this->waterlevel_ -= old_obj->size ();
- old_obj->release ();
- this->DROP_i (old_obj);
- }
-
- result = this->heap_->insert (key, obj);
- if (result == -1)
- {
- cerr << "*** heap insertion error: " << key << endl;
- this->hash_->unbind (key);
- obj->release ();
- this->DROP_i (obj);
- return -1;
- }
-
- this->waterlevel_ += size;
-
- // Acquire this one for the putter.
- this->TAKE (obj);
-
- return 0;
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::FLUSH_i (const KEY &key)
-{
- JAWS_Cache_Object *temp_object;
-
-#ifdef ENTERA_VERBOSE_TRACE
- cerr << "*** flush key unbinding: " << key << endl;
-#endif
- int result = this->hash_->unbind (key, temp_object);
- if (result == 0)
- {
- this->waterlevel_ -= temp_object->size ();
- if (this->heap_->remove (temp_object->heap_item ()) == -1)
- cerr << "*** flush key heap remove failed: " << endl;
- temp_object->release ();
- this->DROP_i (temp_object);
- }
- else
- cerr << "*** flush key hash unbind failed: " << key << endl;
-
- return result;
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::FLUSH_i (void)
-{
- KEY temp_key;
- JAWS_Cache_Object *temp_object;
-
- int result = this->heap_->remove (temp_key, temp_object);
- if (result == 0)
- {
-#ifdef ENTERA_VERBOSE_TRACE
- cerr << "*** flush unbinding: " << temp_key << endl;
-#endif
- result = this->hash_->unbind (temp_key);
- if (result == -1)
- cerr << "*** flush hash unbind failed: " << temp_key << endl;
- result = 0;
- this->waterlevel_ -= temp_object->size ();
- temp_object->release ();
- this->DROP_i (temp_object);
- }
- else
- {
- cerr << "*** flush heap remove failed" << endl;
- }
-
- return result;
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::DROP_i (JAWS_Cache_Object *&obj)
-{
- int result = 0;
-
- if (obj->count () == 0)
- {
- KEY *key = (KEY *) obj->internal ();
- this->factory_->destroy (obj);
- delete key;
- obj = 0;
- result = 1;
- }
- else
- result = this->heap_->adjust (obj->heap_item ());
-
- return result;
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::GET (const KEY &key, JAWS_Cache_Object *&object)
-{
- ACE_Read_Guard<ACE_SYNCH_RW_MUTEX> g (this->lock_);
-
- return this->GET_i (key, object);
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::PUT (const KEY &key, const void *data, size_t size, JAWS_Cache_Object *&obj)
-{
- ACE_Write_Guard<ACE_SYNCH_RW_MUTEX> g (this->lock_);
-
- return this->PUT_i (key, data, size, obj);
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::MAKE (const void *data, size_t size, JAWS_Cache_Object *&obj)
-{
- // verify object is within cacheable range
- if (size/1024 > this->maxobjsize_)
- {
-#if 0
- // What we do is cache it anyway, but remove it as soon as the
- // requester returns it.
- obj = this->factory_->create (data, size);
- return 0;
-#else
- // The above is a little tricky to implement. Think about it
- // some more.
- obj = this->factory_->create (data, size);
- return -1;
-
-#endif /* 0 */
- }
-
- if (size/1024 < this->minobjsize_)
-
- {
- // Don't bother to cache this.
- cerr << "*** " << static_cast<unsigned int>(size) << " is too small to cache" << endl;
- return -1;
- }
-
- // make sure we have sufficient memory
- if (this->waterlevel_ + size > this->highwater_ * (1024 * 1024))
- {
- do
- {
- if (this->FLUSH_i () == -1)
- {
- cerr << "*** cache flooded, flush error" << endl;
- return -1;
- }
- }
- while (this->waterlevel_ > this->lowwater_ * (1024 * 1024));
- }
-
- // make sure heap has enough room
- if (this->heap_->is_full ())
- {
- cerr << "*** heap full, flushing" << endl;
- if (this->FLUSH_i () == -1)
- {
- cerr << "*** heap full, flush error" << endl;
- return -1;
- }
- }
-
- obj = this->factory_->create (data, size);
- if (this->TAKE (obj) == -1)
- {
- cerr << "*** take error" << endl;
- this->factory_->destroy (obj);
- obj = 0;
- return -1;
- }
-
- return 0;
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::TAKE (JAWS_Cache_Object *const &obj)
-{
- if (obj == 0)
- return -1;
-
- return obj->acquire ();
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::DROP (JAWS_Cache_Object *&obj)
-{
- if (obj == 0)
- return -1;
-
-#if 0
- if (obj->size ()/1024 > this->maxobjsize_)
- {
- ACE_Write_Guard<ACE_SYNCH_RW_MUTEX> g (this->lock_);
-
- int result = obj->release ();
- if (result == 0)
- {
- if (obj->count () == 0)
- {
- KEY *key = (KEY *) obj->internal ();
-#ifdef ENTERA_VERBOSE_TRACE
- cerr << "*** drop large unbinding: " << key << endl;
-#endif
- result = this->hash_->unbind (*key);
- if (result == 0)
- {
- if (this->heap_->remove (obj->heap_item ()) == -1)
- cerr << "*** drop large heap remove failed: " << endl;
- this->factory_->destroy (obj);
- delete key;
- obj = 0;
- result = 1;
- }
- else
- cerr << "*** drop large hash unbind failed: " << key << endl;
- }
- }
- return result;
- }
-#endif /* 0 */
-
- {
- ACE_Write_Guard<ACE_SYNCH_RW_MUTEX> g (this->lock_);
-
- int result = obj->release ();
-
- if (result == 0)
- {
- if (obj->count () == 0)
- {
- KEY *key = (KEY *) obj->internal ();
- this->factory_->destroy (obj);
- delete key;
- obj = 0;
- result = 1;
- }
- else
- {
- result = this->DROP_i (obj);
- }
- }
-
- return result;
- }
-}
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC> int
-JAWS_Cache_Manager<KEY,FACTORY,HASH_FUNC,EQ_FUNC>
-::FLUSH (void)
-{
- ACE_Write_Guard<ACE_SYNCH_RW_MUTEX> g (this->lock_);
-
- return this->FLUSH_i ();
-}
-
-
-template <class KEY, class DATA, class CACHE_MANAGER>
-JAWS_Cache_Proxy<KEY, DATA, CACHE_MANAGER>
-::JAWS_Cache_Proxy (const KEY &key, Cache_Manager *manager)
- : object_ (0),
- manager_ (manager)
-{
- if (this->manager_ == 0)
- this->manager_ = Cache_Manager_Singleton::instance ();
-
- int result = this->manager_->GET (key, this->object_);
- if (result == -1)
- this->object_ = 0;
-}
-
-template <class KEY, class DATA, class CACHE_MANAGER>
-JAWS_Cache_Proxy<KEY, DATA, CACHE_MANAGER>
-::JAWS_Cache_Proxy (const KEY &key, DATA *data, size_t size,
- Cache_Manager *manager)
- : object_ (0),
- manager_ (manager)
-{
- if (this->manager_ == 0)
- this->manager_ = Cache_Manager_Singleton::instance ();
-
- int result = this->manager_->PUT (key, data, size, this->object_);
- if (result == -1)
- this->object_ = 0;
-}
-
-template <class KEY, class DATA, class CACHE_MANAGER>
-JAWS_Cache_Proxy<KEY, DATA, CACHE_MANAGER>::~JAWS_Cache_Proxy (void)
-{
- DATA *data = this->data ();
- this->manager_->DROP (this->object_);
- if (this->object_ == 0)
- this->close (data);
-}
-
-template <class KEY, class DATA, class CACHE_MANAGER> DATA *
-JAWS_Cache_Proxy<KEY, DATA, CACHE_MANAGER>::data (void) const
-{
- return this->object_ ? (DATA *) this->object_->data () : 0;
-}
-
-template <class KEY, class DATA, class CACHE_MANAGER>
-JAWS_Cache_Proxy<KEY, DATA, CACHE_MANAGER>::operator DATA * (void) const
-{
- return this->data ();
-}
-
-template <class KEY, class DATA, class CACHE_MANAGER> int
-JAWS_Cache_Proxy<KEY, DATA, CACHE_MANAGER>::close (DATA *)
-{
- return 0;
-}
-
-
-#endif /* JAWS_CACHE_MANAGER_T_CPP */
diff --git a/apps/JAWS2/JAWS/Cache_Manager_T.h b/apps/JAWS2/JAWS/Cache_Manager_T.h
deleted file mode 100644
index 10165a462a5..00000000000
--- a/apps/JAWS2/JAWS/Cache_Manager_T.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- c++ -*- */
-// Hey Emacs! This is a C++ file!
-// $Id$
-
-#ifndef JAWS_CACHE_MANAGER_T_H
-#define JAWS_CACHE_MANAGER_T_H
-
-#include "ace/Singleton.h"
-
-#include "JAWS/Cache_Object.h"
-
-template <class KEY, class HASH_FUNC, class EQ_FUNC> class JAWS_Cache_Hash;
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-class JAWS_Cache_Heap;
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-class JAWS_Cache_List;
-
-template <class KEY, class FACTORY, class HASH_FUNC, class EQ_FUNC>
-class JAWS_Cache_Manager
-{
-
- friend class JAWS_Cache_Hash<KEY, HASH_FUNC, EQ_FUNC>;
- friend class JAWS_Cache_Heap<KEY, FACTORY, HASH_FUNC, EQ_FUNC>;
- friend class JAWS_Cache_List<KEY, FACTORY, HASH_FUNC, EQ_FUNC>;
-
-public:
-
- typedef ACE_Singleton<FACTORY, ACE_SYNCH_MUTEX> Object_Factory;
- typedef JAWS_Cache_Hash<KEY, HASH_FUNC, EQ_FUNC> Cache_Hash;
- typedef JAWS_Cache_List<KEY, FACTORY, HASH_FUNC, EQ_FUNC> Cache_Heap;
-
- JAWS_Cache_Manager (ACE_Allocator *alloc = 0,
- JAWS_Cache_Object_Factory *cof = 0,
-
- size_t hashsize = 8192, // number of hash buckets
- size_t maxsize = 65535, // max number of in memory
- // objects
-
- size_t maxobjsize = 256, // max cached object size in kB
- size_t minobjsize = 0, // min cached object size in kB
-
- size_t highwater = 100, // max size of cache in MB
- size_t lowwater = 50, // min size of cache when
- // expiring after highwater
- // has been reached
-
- int timetolive = -1, // amt of time the lowest
- // priority item is allowed to
- // remain in the cache
-
- int counted = 0 // flag for whether to use
- // counts
- );
-
- int open (ACE_Allocator *alloc = 0,
- JAWS_Cache_Object_Factory *cof = 0,
-
- size_t hashsize = 1024, // number of hash buckets
- size_t maxsize = 4096, // max number of in memory
- // objects
-
- size_t maxobjsize = 5120, // max cached object size in kB
- size_t minobjsize = 0, // min cached object size in kB
-
- size_t highwater = 50, // max size of cache in MB
- size_t lowwater = 30, // min size of cache when
- // expiring after highwater
- // has been reached
-
- int timetolive = -1, // amount of time the lowest
- // priority item is allowed to
- // remain in the cache
-
- int counted = 0 // flag for whether to use
- // counts
- );
-
- ~JAWS_Cache_Manager (void);
-
- int close (void);
-
- // Search Methods
-
- int GET (const KEY &key, JAWS_Cache_Object *&cobj);
- // Retrieve the object associated with key from cache. Return 0 on
- // success, -1 on failure.
-
- int PUT (const KEY &key, const void *data, size_t size,
- JAWS_Cache_Object *&obj);
- // Inserts or replaces object associated with key into cache.
- // Return 0 on success, -1 on failure.
-
- int MAKE (const void *data, size_t size, JAWS_Cache_Object *&cobj);
- // Create a cached object, increment reference count.
-
- int TAKE (JAWS_Cache_Object *const &cobj);
- // Increment reference count.
-
- int DROP (JAWS_Cache_Object *&cobj);
- // Decrement reference count on cached object, perhaps delete.
- // Returns 0 if only decremented, 1 if deleted, -1 if error.
-
- int FLUSH (void);
- // Removes lowest priority object from cache.
-
-protected:
-
- int GET_i (const KEY &key, JAWS_Cache_Object *&object);
- // Retrieve the object associated with key from cache. Return 0 on
- // success, -1 on failure.
-
- int PUT_i (const KEY &key, const void *data, size_t size,
- JAWS_Cache_Object *&object);
- // Inserts or replaces object associated with key into cache.
- // Return 0 on success, -1 on failure.
-
- int FLUSH_i (void);
- // Removes lowest priority object from cache.
-
- int FLUSH_i (const KEY &key);
- // Removes object associated with key from cache.
-
- int DROP_i (JAWS_Cache_Object *&cobj);
- // Decrement reference count on cached object, perhaps delete.
-
-private:
-
- ACE_Allocator *allocator_;
- JAWS_Cache_Object_Factory *factory_;
-
- size_t hashsize_;
- size_t maxsize_;
- size_t maxobjsize_;
- size_t minobjsize_;
- size_t highwater_;
- size_t lowwater_;
- size_t waterlevel_;
- int timetolive_;
- int counted_;
-
- Cache_Hash *hash_;
- Cache_Heap *heap_;
-
- ACE_SYNCH_RW_MUTEX lock_;
-
-};
-
-
-template <class KEY, class DATA, class CACHE_MANAGER>
-class JAWS_Cache_Proxy
-{
-public:
- typedef CACHE_MANAGER Cache_Manager;
- typedef ACE_Singleton<Cache_Manager, ACE_SYNCH_MUTEX>
- Cache_Manager_Singleton;
-
- JAWS_Cache_Proxy (const KEY &, Cache_Manager * = 0);
- // Corresponds to a GET
-
- JAWS_Cache_Proxy (const KEY &, DATA *, size_t, Cache_Manager * = 0);
- // Corresponds to a U/PUT
-
- virtual ~JAWS_Cache_Proxy (void);
-
- DATA *data (void) const;
- operator DATA * (void) const;
-
- virtual int close (DATA *);
-
-private:
- JAWS_Cache_Object *object_;
- Cache_Manager *manager_;
-};
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "JAWS/Cache_Manager_T.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#endif /* JAWS_CACHE_MANAGER_T_H */
diff --git a/apps/JAWS2/JAWS/Cache_Object.cpp b/apps/JAWS2/JAWS/Cache_Object.cpp
deleted file mode 100644
index 651e2bc5bd9..00000000000
--- a/apps/JAWS2/JAWS/Cache_Object.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-// $Id$
-
-#include "JAWS/Cache_Object.h"
-
-#include "ace/Malloc_Base.h"
-#include "ace/Guard_T.h"
-#include "ace/OS_NS_time.h"
-
-
-
-JAWS_Cache_Object::JAWS_Cache_Object (const void *data, size_t size)
- : internal_ (0),
- data_ (data),
- size_ (size)
-{
- this->first_access_ = ACE_OS::time ((time_t *)0);
- this->new_last_access_ = this->last_access_ = this->first_access_;
-}
-
-JAWS_Cache_Object::~JAWS_Cache_Object ()
-{
- this->data_ = 0;
- this->size_ = 0;
-}
-
-void *
-JAWS_Cache_Object::internal (void) const
-{
- return this->internal_;
-}
-
-void
-JAWS_Cache_Object::internal (void *item)
-{
- this->internal_ = item;
-}
-
-const void *
-JAWS_Cache_Object::data (void) const
-{
- return this->data_;
-}
-
-size_t
-JAWS_Cache_Object::size (void) const
-{
- return this->size_;
-}
-
-unsigned int
-JAWS_Cache_Object::count (void) const
-{
- return this->count_i ();
-}
-
-int
-JAWS_Cache_Object::acquire (void)
-{
- this->new_last_access_ = ACE_OS::time ((time_t *)0);
- return this->acquire_i ();
-}
-
-int
-JAWS_Cache_Object::release (void)
-{
- this->last_access_ = this->new_last_access_;
- return this->release_i ();
-}
-
-time_t
-JAWS_Cache_Object::last_access (void) const
-{
- return this->last_access_;
-}
-
-time_t
-JAWS_Cache_Object::first_access (void) const
-{
- return this->first_access_;
-}
-
-unsigned int
-JAWS_Cache_Object::priority (void) const
-{
- return this->priority_i ();
-}
-
-void *
-JAWS_Cache_Object::heap_item (void) const
-{
- return this->heap_item_;
-}
-
-void
-JAWS_Cache_Object::heap_item (void *item)
-{
- this->heap_item_ = item;
-}
-
-
-JAWS_Referenced_Cache_Object::
-JAWS_Referenced_Cache_Object (const void *data, size_t size)
- : JAWS_Cache_Object (data, size),
- lock_adapter_ (count_)
-{
-}
-
-JAWS_Referenced_Cache_Object::~JAWS_Referenced_Cache_Object (void)
-{
-}
-
-ACE_Lock &
-JAWS_Referenced_Cache_Object::lock (void)
-{
- return this->lock_adapter_;
-}
-
-unsigned int
-JAWS_Referenced_Cache_Object::count_i (void) const
-{
- if (this->count_.tryacquire_write () == 0)
- return 0;
-
- return 1;
-}
-
-int
-JAWS_Referenced_Cache_Object::acquire_i (void)
-{
- return this->count_.acquire_read ();
-}
-
-int
-JAWS_Referenced_Cache_Object::release_i (void)
-{
- return this->count_.release ();
-}
-
-unsigned int
-JAWS_Referenced_Cache_Object::priority_i (void) const
-{
- unsigned int priority = ~(0U);
- double delta
- = ACE_OS::difftime (this->last_access (), this->first_access ());
-
- if (delta >= 0.0 && delta < ~(0U))
- priority = (unsigned) delta;
-
- return priority;
-}
-
-
-
-JAWS_Counted_Cache_Object::
-JAWS_Counted_Cache_Object (const void *data, size_t size)
- : JAWS_Cache_Object (data, size),
- count_ (0),
- new_count_ (0),
- lock_adapter_ (lock_)
-{
-}
-
-JAWS_Counted_Cache_Object::~JAWS_Counted_Cache_Object (void)
-{
-}
-
-ACE_Lock &
-JAWS_Counted_Cache_Object::lock (void)
-{
- return this->lock_adapter_;
-}
-
-unsigned int
-JAWS_Counted_Cache_Object::count_i (void) const
-{
- ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
-
- return this->count_;
-}
-
-int
-JAWS_Counted_Cache_Object::acquire_i (void)
-{
- ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
-
- this->new_count_++;
- return 0;
-}
-
-int
-JAWS_Counted_Cache_Object::release_i (void)
-{
- ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
-
- this->new_count_--;
- this->count_ = this->new_count_;
- return 0;
-}
-
-unsigned int
-JAWS_Counted_Cache_Object::priority_i (void) const
-{
- return this->count_i ();
-}
-
-JAWS_Cache_Object_Factory::JAWS_Cache_Object_Factory (ACE_Allocator *alloc)
- : allocator_ (alloc)
-{
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-}
-
-JAWS_Cache_Object_Factory::~JAWS_Cache_Object_Factory (void)
-{
-}
-
-int
-JAWS_Cache_Object_Factory::open (ACE_Allocator *alloc)
-{
- this->allocator_ = alloc;
-
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-
- return 0;
-}
-
-JAWS_Referenced_Cache_Object_Factory
-::JAWS_Referenced_Cache_Object_Factory (ACE_Allocator *alloc)
- : JAWS_Cache_Object_Factory (alloc)
-{
-}
-
-JAWS_Referenced_Cache_Object_Factory
-::~JAWS_Referenced_Cache_Object_Factory (void)
-{
-}
-
-JAWS_Cache_Object *
-JAWS_Referenced_Cache_Object_Factory::create (const void *data, size_t size)
-{
- JAWS_Referenced_Cache_Object *obj;
-
- size_t obj_size = sizeof (JAWS_Referenced_Cache_Object);
- ACE_NEW_MALLOC_RETURN (obj,
- (JAWS_Referenced_Cache_Object *)
- this->allocator_->malloc (obj_size),
- JAWS_Referenced_Cache_Object (data, size), 0);
-
- return obj;
-}
-
-void
-JAWS_Referenced_Cache_Object_Factory::destroy (JAWS_Cache_Object *obj)
-{
- JAWS_Referenced_Cache_Object *rco = (JAWS_Referenced_Cache_Object *) obj;
- ACE_DES_FREE (rco, this->allocator_->free, JAWS_Referenced_Cache_Object);
-}
-
-JAWS_Counted_Cache_Object_Factory
-::JAWS_Counted_Cache_Object_Factory (ACE_Allocator *alloc)
- : JAWS_Cache_Object_Factory (alloc)
-{
-}
-
-JAWS_Counted_Cache_Object_Factory
-::~JAWS_Counted_Cache_Object_Factory (void)
-{
-}
-
-JAWS_Cache_Object *
-JAWS_Counted_Cache_Object_Factory::create (const void *data, size_t size)
-{
- JAWS_Counted_Cache_Object *obj;
-
- size_t obj_size = sizeof (JAWS_Counted_Cache_Object);
- ACE_NEW_MALLOC_RETURN (obj,
- (JAWS_Counted_Cache_Object *)
- this->allocator_->malloc (obj_size),
- JAWS_Counted_Cache_Object (data, size), 0);
-
- return obj;
-}
-
-void
-JAWS_Counted_Cache_Object_Factory::destroy (JAWS_Cache_Object *obj)
-{
- JAWS_Counted_Cache_Object *cco = (JAWS_Counted_Cache_Object *) obj;
- ACE_DES_FREE (cco, this->allocator_->free, JAWS_Counted_Cache_Object);
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-// These are only specialized with ACE_HAS_THREADS.
-template class ACE_Lock_Adapter<ACE_SYNCH_RW_MUTEX>;
-template class ACE_Lock_Adapter<ACE_SYNCH_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-// These are only specialized with ACE_HAS_THREADS.
-#pragma instantiate ACE_Lock_Adapter<ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Lock_Adapter<ACE_SYNCH_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-
diff --git a/apps/JAWS2/JAWS/Cache_Object.h b/apps/JAWS2/JAWS/Cache_Object.h
deleted file mode 100644
index 9988379742f..00000000000
--- a/apps/JAWS2/JAWS/Cache_Object.h
+++ /dev/null
@@ -1,158 +0,0 @@
-// -*- C++ -*-
-
-// $Id$
-
-
-#ifndef JAWS_CACHE_OBJECT_H
-#define JAWS_CACHE_OBJECT_H
-
-#include "ace/Lock_Adapter_T.h"
-#include "ace/Synch_Traits.h"
-#include "ace/Thread_Mutex.h"
-#include "ace/Malloc.h"
-#include "ace/RW_Thread_Mutex.h"
-
-
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-class ACE_Allocator;
-ACE_END_VERSIONED_NAMESPACE_DECL
-
-
-// Cache bucket -- use Hash_Bucket to hold cacheable objects.
-
-class JAWS_Cache_Object
-{
-public:
- JAWS_Cache_Object (const void *, size_t);
- virtual ~JAWS_Cache_Object (void);
-
- void *internal (void) const;
- void internal (void *);
-
- const void *data (void) const;
- size_t size (void) const;
- unsigned int count (void) const;
-
- int acquire (void);
- int release (void);
-
- time_t last_access (void) const;
- time_t first_access (void) const;
-
- unsigned int priority (void) const;
-
- enum { ACE_CO_REFERENCED, ACE_CO_COUNTED };
-
- void *heap_item (void) const;
- void heap_item (void *item);
-
- virtual ACE_Lock & lock (void) = 0;
-
-protected:
-
- virtual unsigned int count_i (void) const = 0;
- virtual int acquire_i (void) = 0;
- virtual int release_i (void) = 0;
- virtual unsigned int priority_i (void) const = 0;
-
-private:
-
- void *internal_;
- const void *data_;
- size_t size_;
-
- time_t last_access_;
- time_t first_access_;
- time_t new_last_access_;
-
- void *heap_item_;
-
-};
-
-class JAWS_Referenced_Cache_Object : public JAWS_Cache_Object
-{
-public:
- JAWS_Referenced_Cache_Object (const void *, size_t);
- virtual ~JAWS_Referenced_Cache_Object (void);
-
- virtual ACE_Lock & lock (void);
-
-protected:
-
- virtual unsigned int count_i (void) const;
- virtual int acquire_i (void);
- virtual int release_i (void);
- virtual unsigned int priority_i (void) const;
-
-private:
-
- mutable ACE_SYNCH_RW_MUTEX count_;
- mutable ACE_Lock_Adapter<ACE_SYNCH_RW_MUTEX> lock_adapter_;
-
-};
-
-class JAWS_Counted_Cache_Object : public JAWS_Cache_Object
-{
-public:
- JAWS_Counted_Cache_Object (const void *, size_t);
- virtual ~JAWS_Counted_Cache_Object (void);
-
- virtual ACE_Lock & lock (void);
-
-protected:
-
- virtual unsigned int count_i (void) const;
- virtual int acquire_i (void);
- virtual int release_i (void);
- virtual unsigned int priority_i (void) const;
-
-private:
-
- unsigned int count_;
- unsigned int new_count_;
- mutable ACE_SYNCH_MUTEX lock_;
- mutable ACE_Lock_Adapter<ACE_SYNCH_MUTEX> lock_adapter_;
-
-};
-
-class JAWS_Cache_Object_Factory
-{
-public:
-
- JAWS_Cache_Object_Factory (ACE_Allocator *alloc = 0);
- virtual ~JAWS_Cache_Object_Factory (void);
-
- int open (ACE_Allocator *alloc = 0);
-
- virtual JAWS_Cache_Object * create (const void *, size_t) = 0;
- virtual void destroy (JAWS_Cache_Object *) = 0;
-
-protected:
-
- ACE_Allocator *allocator_;
-
-};
-
-class JAWS_Referenced_Cache_Object_Factory : public JAWS_Cache_Object_Factory
-{
-public:
- JAWS_Referenced_Cache_Object_Factory (ACE_Allocator *alloc = 0);
- virtual ~JAWS_Referenced_Cache_Object_Factory (void);
-
- virtual JAWS_Cache_Object * create (const void *, size_t);
- virtual void destroy (JAWS_Cache_Object *);
-
-};
-
-class JAWS_Counted_Cache_Object_Factory : public JAWS_Cache_Object_Factory
-{
-public:
- JAWS_Counted_Cache_Object_Factory (ACE_Allocator *alloc = 0);
- virtual ~JAWS_Counted_Cache_Object_Factory (void);
-
- virtual JAWS_Cache_Object * create (const void *, size_t);
- virtual void destroy (JAWS_Cache_Object *);
-
-};
-
-#endif /* JAWS_CACHE_OBJECT_H */
diff --git a/apps/JAWS2/JAWS/Concurrency.cpp b/apps/JAWS2/JAWS/Concurrency.cpp
deleted file mode 100644
index 34b0d94149f..00000000000
--- a/apps/JAWS2/JAWS/Concurrency.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-// $Id$
-
-#include "JAWS/JAWS.h"
-#include "JAWS/Concurrency.h"
-#include "JAWS/IO_Handler.h"
-#include "JAWS/Pipeline.h"
-#include "JAWS/Pipeline_Tasks.h"
-#include "JAWS/Policy.h"
-#include "JAWS/Data_Block.h"
-#include "JAWS/Waiter.h"
-#include "JAWS/Reaper.h"
-
-ACE_RCSID(JAWS, Concurrency, "$Id$")
-
-JAWS_Concurrency_Base::JAWS_Concurrency_Base (void)
- : ACE_Task<ACE_SYNCH> (new ACE_Thread_Manager),
- mb_acquired_ (0),
- mb_ (0),
- reaper_ (new JAWS_Reaper (this))
-{
-}
-
-JAWS_Concurrency_Base::~JAWS_Concurrency_Base (void)
-{
- delete this->thr_mgr_;
- delete this->reaper_;
-}
-
-ACE_Message_Block *
-JAWS_Concurrency_Base::singleton_mb (void)
-{
- if (this->mb_acquired_ == 0)
- {
- ACE_Guard<ACE_SYNCH_MUTEX> g(this->lock_);
-
- if (this->mb_acquired_ == 0)
- {
- int result;
- ACE_Message_Block *mb = 0;
-
- result = this->getq (mb);
- this->mb_acquired_ = 1;
-
- if (result == -1 || mb == 0)
- return 0;
-
- this->mb_ = mb;
- }
- }
-
- return this->mb_;
-}
-
-int
-JAWS_Concurrency_Base::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
-{
- return this->putq (mb, tv);
-}
-
-int
-JAWS_Concurrency_Base::svc (void)
-{
- JAWS_TRACE ("JAWS_Concurrency_Base::svc");
-
- ACE_Message_Block *mb = 0; // The message queue element
- JAWS_Data_Block *db = 0; // Contains the task list
-
- mb = this->singleton_mb ();
-
- // A NULL data block indicates that the thread should shut
- // itself down
- if (mb == 0)
- {
- JAWS_TRACE ("JAWS_Concurrency_Base::svc, empty message block");
- return -1;
- }
-
- db = dynamic_cast<JAWS_Data_Block *> (mb);
-
- this->svc_loop (db);
-
- return 0;
-}
-
-int
-JAWS_Concurrency_Base::svc_loop (JAWS_Data_Block *db)
-{
- JAWS_TRACE ("JAWS_Concurrency_Base::svc_loop");
-
- // Thread specific message block and data block
- ACE_DEBUG ((LM_DEBUG, "(%t) Creating DataBlock\n"));
- JAWS_Data_Block *ts_db = new JAWS_Data_Block (*db);
- if (ts_db == 0)
- {
- ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Concurrency_Base::svc_hook"));
- return -1;
- }
-
- for (;;)
- {
- if (this->svc_hook (ts_db) != 0)
- break;
- ts_db->task (db->task ());
- ts_db->policy (db->policy ());
- ts_db->payload (0);
- ts_db->io_handler (0);
- ts_db->rd_ptr (ts_db->wr_ptr ());
- ts_db->crunch ();
- }
-
- ACE_DEBUG ((LM_DEBUG, "(%t) Deleting DataBlock\n"));
- delete ts_db; // ts_db->release ();
-
- return 0;
-}
-
-int
-JAWS_Concurrency_Base::svc_hook (JAWS_Data_Block *ts_db)
-{
- JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook");
-
- int result = 0;
-
- JAWS_Dispatch_Policy *policy = 0; // Contains task policies
- JAWS_IO_Handler *handler = 0; // Keeps the state of the task
- JAWS_Pipeline_Handler *task = 0; // The task itself
- JAWS_Data_Block *mb = 0; // The task message block
-
- policy = ts_db->policy ();
- task = ts_db->task ();
- handler = 0;
-
- // Get the waiter index
- JAWS_Waiter *waiter = JAWS_Waiter_Singleton::instance ();
- int waiter_index = waiter->index ();
-
- mb = ts_db;
- do
- {
- JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, looping");
-
- // Use a NULL task to make the thread recycle now
- if (task == 0)
- {
- JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, recycling");
- if (handler)
- handler->done ();
- handler = 0;
- JAWS_IO_Handler **ioh = waiter->find_by_index (waiter_index);
- *ioh = 0;
- break;
- }
-
- // the task should set the handler to the appropriate next step
- result = task->put (mb);
-
- if (result == 0 || result == -3)
- handler = mb->io_handler ();
- else handler = 0;
-
- if (result == 1 || result == 2)
- {
- JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, waiting");
- // need to wait for an asynchronous event
-
- // We need a way to destroy all the handlers created by the
- // Asynch_Acceptor. Figure this out later.
- handler = waiter->wait_for_completion (waiter_index);
- if (handler == 0)
- {
- JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, bad proactor");
- // Proactor failed
- result = -1;
- break;
- }
- }
-
- if (result < 0)
- {
- JAWS_TRACE ("JAWS_Concurrency_Base::svc_hook, negative result");
- if (result == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Concurrency_Base::svc_hook"));
-
- if (handler)
- handler->done ();
-
- handler = 0;
- if (result == -2)
- {
- JAWS_IO_Handler **ioh = waiter->find_by_index (waiter_index);
- *ioh = 0;
- result = 0;
- }
- break;
- }
-
- if (handler == 0)
- break;
-
- mb = handler->message_block ();
- task = handler->task ();
- result = 0;
- }
- while (result == 0);
-
- return result;
-}
-
-int
-JAWS_Concurrency_Base::activate_hook (void)
-{
- return 0;
-}
-
-JAWS_Dispatcher::JAWS_Dispatcher (void)
- : policy_(0)
-{
-}
-
-int
-JAWS_Dispatcher::dispatch (ACE_Message_Block *mb)
-{
- return this->policy ()->concurrency ()->put (mb);
-}
-
-JAWS_Dispatch_Policy *
-JAWS_Dispatcher::policy (void)
-{
- return this->policy_;
-}
-
-JAWS_Dispatch_Policy *
-JAWS_Dispatcher::policy (JAWS_Dispatch_Policy *p)
-{
- this->policy_ = p;
- return this->policy_;
-}
-
-int
-JAWS_Thread_Pool_Task::make (long flags, int nthreads, int maxthreads)
-{
- this->flags_ = flags;
- this->nthreads_ = nthreads;
- this->maxthreads_ = maxthreads;
-
- ACE_thread_t *thr_names = new ACE_thread_t[nthreads];
-
- if (this->activate (flags | THR_SUSPENDED,
- nthreads,
- 0, // force active
- ACE_DEFAULT_THREAD_PRIORITY,
- -1, // group id
- 0, // ACE_Task_Base
- 0, // thread handles
- 0, // stack
- 0, // stack size
- thr_names) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate"),
- -1);
-
- for (int i = 0; i < nthreads; i++)
- {
- JAWS_Thread_ID thr_id(thr_names[i]);
- JAWS_IO_Handler *dummy = 0;
-
- JAWS_Waiter_Singleton::instance ()->insert (thr_id, dummy);
- }
-
- delete[] thr_names;
-
- this->thr_mgr_->resume_all ();
-
- if (this->reaper_->open () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Reaper::open"),
- -1);
-
- return 0;
-}
-
-int
-JAWS_Thread_Per_Task::make (long flags, int maxthreads)
-{
- this->flags_ = flags;
- this->maxthreads_ = maxthreads;
- return 0;
-}
-
-int
-JAWS_Thread_Per_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
-{
- JAWS_TRACE ("JAWS_Thread_Per_Task::put");
-
- this->putq (mb, tv);
- return this->activate_hook ();
-}
-
-int
-JAWS_Thread_Per_Task::svc_loop (JAWS_Data_Block *db)
-{
- return this->svc_hook (db);
-}
-
-int
-JAWS_Thread_Per_Task::activate_hook (void)
-{
- const int force_active = 1;
- const int nthreads = 1;
-
- ACE_thread_t thr_name;
-
- if (this->activate (this->flags_ | THR_SUSPENDED,
- nthreads,
- force_active,
- ACE_DEFAULT_THREAD_PRIORITY,
- -1, // group id
- 0, // ACE_Task_Base
- 0, // thread handle
- 0, // stack
- 0, // stack size
- &thr_name) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Thread_Pool_Task::activate"),
- -1);
-
- JAWS_Thread_ID thr_id (thr_name);
- JAWS_IO_Handler *dummy = 0;
-
- // In the thread-per-request strategy, need to take care of the
- // case when the waiter array is full. Think about that problem
- // later.
- JAWS_Waiter_Singleton::instance ()->insert (thr_id, dummy);
-
- this->thr_mgr_->resume (thr_name);
-
- if (this->reaper_->open () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Reaper::open"),
- -1);
-
- return 0;
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Singleton<JAWS_Dispatcher, ACE_SYNCH_MUTEX>;
-template class ACE_Singleton<JAWS_Thread_Pool_Task, ACE_SYNCH_MUTEX>;
-template class ACE_Singleton<JAWS_Thread_Per_Task, ACE_SYNCH_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Singleton<JAWS_Dispatcher, ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_Singleton<JAWS_Thread_Pool_Task, ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_Singleton<JAWS_Thread_Per_Task, ACE_SYNCH_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/Concurrency.h b/apps/JAWS2/JAWS/Concurrency.h
deleted file mode 100644
index c88d75c4dbe..00000000000
--- a/apps/JAWS2/JAWS/Concurrency.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_CONCURRENCY_H
-#define JAWS_CONCURRENCY_H
-
-#include "ace/Singleton.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Task.h"
-#include "ace/Synch_Traits.h"
-
-#include "JAWS/Export.h"
-#include "JAWS/IO.h"
-
-class JAWS_Data_Block;
-class JAWS_Dispatch_Policy;
-class JAWS_Reaper;
-
-class JAWS_Export JAWS_Concurrency_Base : public ACE_Task<ACE_SYNCH>
- // = TITLE
- // Base class for different concurrency models
- //
- // = DESCRIPTION
- // Provides a default implementaion of the virtual put() method
- // which calls putq(), but can be overloaded to do something
- // synchronously, such as call put_next().
-
-{
-public:
- JAWS_Concurrency_Base (void);
- ~JAWS_Concurrency_Base (void);
-
- virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0);
- virtual int svc (void);
-
- virtual int svc_loop (JAWS_Data_Block *db);
- // in thread pool, this is an infinite loop
- // in thread per request, it is a single iteration
-
- virtual int svc_hook (JAWS_Data_Block *db);
- // does the work of following the pipeline tasks
-
- virtual int activate_hook (void);
- // callback for IO_Handler when accept completes
-
- virtual ACE_Message_Block *singleton_mb (void);
-
-protected:
- int mb_acquired_;
- ACE_Message_Block *mb_;
- JAWS_Reaper *reaper_;
- ACE_SYNCH_MUTEX lock_;
-};
-
-class JAWS_Export JAWS_Dispatcher
- // = TITLE
- // The class that is responsible to delivering events to the
- // appropriate concurrency mechanism.
- //
- // = DESCRIPTION
- // JAWS_IO_Handler calls into the dispatcher so that the completed
- // IO can find a thread to take care of it.
-{
-public:
- JAWS_Dispatcher (void);
-
- int dispatch (ACE_Message_Block *mb);
- JAWS_Dispatch_Policy *policy (void);
- JAWS_Dispatch_Policy *policy (JAWS_Dispatch_Policy *p);
-
-private:
- JAWS_Dispatch_Policy *policy_;
-};
-
-class JAWS_Export JAWS_Thread_Pool_Task : public JAWS_Concurrency_Base
- // = TITLE
- // Used to implement Thread Pool Concurrency Strategy
- //
- // = DESCRIPTION
- // This task is created to hold a pool of threads that receive
- // requests through the message queue.
-{
-public:
- virtual int make (long flags, int nthreads, int maxthreads);
- // Initiate the thread_pool task
-
-private:
- long flags_;
- int nthreads_;
- int maxthreads_;
-};
-
-class JAWS_Export JAWS_Thread_Per_Task : public JAWS_Concurrency_Base
- // = TITLE
- // Used to implement Thread Per Request Concurrency Strategy
- //
- // = DESCRIPTION
- // As each new message arrives from the queue, a new thread is
- // spawned to handle it. This is done by overloading put to call
- // activate.
-{
-public:
- virtual int make (long flags, int maxthreads);
- // Initiate the thread_per task
-
- virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0);
-
- virtual int svc_loop (JAWS_Data_Block *db);
- // a single iteration
-
- virtual int activate_hook (void);
- // callback for IO_Handler when accept completes
-
-private:
- long flags_;
- int maxthreads_;
-};
-
-typedef ACE_Singleton<JAWS_Dispatcher, ACE_SYNCH_MUTEX>
- JAWS_Dispatcher_Singleton;
-
-typedef ACE_Singleton<JAWS_Thread_Pool_Task, ACE_SYNCH_MUTEX>
- JAWS_Thread_Pool_Singleton;
-
-typedef ACE_Singleton<JAWS_Thread_Per_Task, ACE_SYNCH_MUTEX>
- JAWS_Thread_Per_Singleton;
-
-#endif /* !defined (JAWS_CONCURRENCY_H) */
diff --git a/apps/JAWS2/JAWS/Data_Block.cpp b/apps/JAWS2/JAWS/Data_Block.cpp
deleted file mode 100644
index 9fb8b56cb20..00000000000
--- a/apps/JAWS2/JAWS/Data_Block.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// $Id$
-
-#include "JAWS/Data_Block.h"
-#include "JAWS/Policy.h"
-
-ACE_RCSID(JAWS, Data_Block, "$Id$")
-
-JAWS_Data_Block::JAWS_Data_Block (void)
- : ACE_Message_Block (JAWS_DATA_BLOCK_SIZE),
- io_handler_ (0),
- policy_ (0),
- task_ (0),
- payload_ (0)
-{
-}
-
-JAWS_Data_Block::JAWS_Data_Block (JAWS_Data_Block &db)
- : ACE_Message_Block (JAWS_DATA_BLOCK_SIZE),
- io_handler_ (db.io_handler_),
- policy_ (db.policy_),
- task_ (db.task_),
- payload_ (db.payload_)
-{
-}
-
-JAWS_Data_Block::~JAWS_Data_Block (void)
-{
-}
-
-JAWS_Pipeline_Handler *
-JAWS_Data_Block::task (void)
-{
- return this->task_;
-}
-
-JAWS_IO_Handler *
-JAWS_Data_Block::io_handler (void)
-{
- return this->io_handler_;
-}
-
-JAWS_Dispatch_Policy *
-JAWS_Data_Block::policy (void)
-{
- return this->policy_;
-}
-
-void *
-JAWS_Data_Block::payload (void)
-{
- return this->payload_;
-}
-
-void
-JAWS_Data_Block::task (JAWS_Pipeline_Handler *taskp)
-{
- this->task_ = taskp;
-}
-
-void
-JAWS_Data_Block::io_handler (JAWS_IO_Handler *handlerp)
-{
- this->io_handler_ = handlerp;
-}
-
-void
-JAWS_Data_Block::policy (JAWS_Dispatch_Policy *policyp)
-{
- this->policy_ = policyp;
-}
-
-void
-JAWS_Data_Block::payload (void *payloadp)
-{
- this->payload_ = payloadp;
-}
diff --git a/apps/JAWS2/JAWS/Data_Block.h b/apps/JAWS2/JAWS/Data_Block.h
deleted file mode 100644
index 94afaa93586..00000000000
--- a/apps/JAWS2/JAWS/Data_Block.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_DATA_BLOCK_H
-#define JAWS_DATA_BLOCK_H
-
-#include "ace/Message_Block.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "JAWS/Export.h"
-#include "JAWS/Pipeline.h"
-
-class JAWS_IO_Handler;
-class JAWS_Dispatch_Policy;
-class JAWS_Data_Block;
-class JAWS_Pipeline_Handler;
-
-class JAWS_Export JAWS_Data_Block : public ACE_Message_Block
-// = TITLE
-// Defines the communication unit between pipeline components
-{
-public:
- JAWS_Data_Block (void);
- JAWS_Data_Block (JAWS_Data_Block &db);
- ~JAWS_Data_Block (void);
-
- JAWS_Pipeline_Handler *task (void);
- JAWS_IO_Handler *io_handler (void);
- JAWS_Dispatch_Policy *policy (void);
- void *payload (void);
-
- void task (JAWS_Pipeline_Handler *taskp);
- void io_handler (JAWS_IO_Handler *handlerp);
- void policy (JAWS_Dispatch_Policy *policyp);
- void payload (void *payloadp);
-
- enum { JAWS_DATA_BLOCK_SIZE = 8192 };
-
-private:
- JAWS_IO_Handler *io_handler_;
- JAWS_Dispatch_Policy *policy_;
- JAWS_Pipeline_Handler *task_;
-
- void *payload_;
-};
-
-#endif /* !defined (JAWS_DATA_BLOCK_H) */
diff --git a/apps/JAWS2/JAWS/Export.h b/apps/JAWS2/JAWS/Export.h
deleted file mode 100644
index 432b23f6984..00000000000
--- a/apps/JAWS2/JAWS/Export.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// $Id$
-
-// Definition for Win32 Export directives.
-// This file is generated automatically by
-// ${TAO_ROOT}/TAO_IDL/GenExportH.BAT
-// ------------------------------
-#ifndef JAWS_EXPORT_H
-#define JAWS_EXPORT_H
-
-#include "ace/config-all.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#if defined (JAWS_HAS_DLL)
-# if (JAWS_HAS_DLL == 1)
-# if defined (JAWS_BUILD_DLL)
-# define JAWS_Export ACE_Proper_Export_Flag
-# define JAWS_SINGLETON_DECLARATION(T) \
- ACE_EXPORT_SINGLETON_DECLARATION (T)
-# else
-# define JAWS_Export ACE_Proper_Import_Flag
-# define JAWS_SINGLETON_DECLARATION(T) \
- ACE_IMPORT_SINGLETON_DECLARATION (T)
-# endif /* JAWS_BUILD_DLL */
-# else
-# define JAWS_Export
-# define JAWS_SINGLETON_DECLARATION(T)
-# endif /* ! JAWS_HAS_DLL == 1 */
-#else
-# define JAWS_Export
-# define JAWS_SINGLETON_DECLARATION(T)
-#endif /* JAWS_HAS_DLL */
-
-#endif /* JAWS_EXPORT_H */
- // End of auto generated file.
-
diff --git a/apps/JAWS2/JAWS/FILE.cpp b/apps/JAWS2/JAWS/FILE.cpp
deleted file mode 100644
index 3f01f368a88..00000000000
--- a/apps/JAWS2/JAWS/FILE.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// $Id$
-
-#include "ace/Guard_T.h"
-
-#include "JAWS/FILE.h"
-
-
-JAWS_FILE::JAWS_FILE (void)
- : map_ (0)
-{
-}
-
-JAWS_FILE::~JAWS_FILE (void)
-{
- delete this->map_;
- this->map_ = 0;
-}
-
-ACE_Mem_Map *
-JAWS_FILE::mem_map (int length,
- int prot,
- int share,
- void *addr,
- off_t offset,
- LPSECURITY_ATTRIBUTES sa) const
-{
- JAWS_FILE *mutable_this = (JAWS_FILE *) this;
- return mutable_this->mem_map (length, prot, share, addr, offset, sa);
-}
-
-ACE_Mem_Map *
-JAWS_FILE::mem_map (int length,
- int prot,
- int share,
- void *addr,
- off_t offset,
- LPSECURITY_ATTRIBUTES sa)
-{
- if (this->map_ == 0)
- {
- ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
-
- if (this->map_ == 0)
- {
- this->map_ = new ACE_Mem_Map;
- if (this->map_ != 0)
- {
- int r = this->map_->map (this->get_handle (),
- length, prot, share, addr, offset, sa);
- if (r < 0)
- {
- delete this->map_;
- this->map_ = 0;
- }
- }
- }
- }
-
- return this->map_;
-
-}
-
-
-ACE_Mem_Map *
-JAWS_FILE::map (void) const
-{
- return this->map_;
-}
diff --git a/apps/JAWS2/JAWS/FILE.h b/apps/JAWS2/JAWS/FILE.h
deleted file mode 100644
index 478f3271e31..00000000000
--- a/apps/JAWS2/JAWS/FILE.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// $Id$
-
-/* -*- c++ -*- */
-
-#ifndef JAWS_FILE_H
-#define JAWS_FILE_H
-
-#include "ace/FILE_IO.h"
-#include "ace/Mem_Map.h"
-
-#include "JAWS/Export.h"
-#include "ace/Synch_Traits.h"
-#include "ace/Thread_Mutex.h"
-
-class JAWS_Export JAWS_FILE : public ACE_FILE_IO
-//
-// Like ACE_FILE_IO, but support for ACE_Mem_Map;
-{
-public:
-
- JAWS_FILE (void);
-
- ~JAWS_FILE (void);
-
- ACE_Mem_Map *mem_map (int length = -1,
- int prot = PROT_RDWR,
- int share = ACE_MAP_PRIVATE,
- void *addr = 0,
- off_t offset = 0,
- LPSECURITY_ATTRIBUTES sa = 0);
- ACE_Mem_Map *mem_map (int length = -1,
- int prot = PROT_RDWR,
- int share = ACE_MAP_PRIVATE,
- void *addr = 0,
- off_t offset = 0,
- LPSECURITY_ATTRIBUTES sa = 0) const;
-
- ACE_Mem_Map *map (void) const;
-
-private:
-
- ACE_SYNCH_MUTEX lock_;
- ACE_Mem_Map *map_;
-
-};
-
-#endif /* JAWS_FILE_H */
diff --git a/apps/JAWS2/JAWS/Filecache.cpp b/apps/JAWS2/JAWS/Filecache.cpp
deleted file mode 100644
index 3e1eb1f6102..00000000000
--- a/apps/JAWS2/JAWS/Filecache.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-// $Id$
-
-#include "ace/FILE_Connector.h"
-#include "ace/OS_NS_unistd.h"
-
-#include "JAWS/Filecache.h"
-#include "JAWS/Cache_List_T.h"
-
-void
-JAWS_Referenced_Filecache_Factory::destroy (JAWS_Cache_Object *object)
-{
- JAWS_FILE *file = (JAWS_FILE *) object->data ();
- file->close ();
- if (file->map ())
- file->map ()->close ();
- delete file;
- this->JAWS_Referenced_Cache_Object_Factory::destroy (object);
-}
-
-void
-JAWS_Counted_Filecache_Factory::destroy (JAWS_Cache_Object *object)
-{
- JAWS_FILE *file = (JAWS_FILE *) object->data ();
- file->close ();
- if (file->map ())
- file->map ()->close ();
- delete file;
- this->JAWS_Counted_Cache_Object_Factory::destroy (object);
-}
-
-JAWS_Cached_FILE::JAWS_Cached_FILE (const char *const &filename,
- JAWS_Filecache_Proxy::Cache_Manager *cm)
- : JAWS_Filecache_Proxy (filename, cm)
-{
- ACE_HANDLE handle = ACE_INVALID_HANDLE;
-
- if (this->data () != 0)
- {
- handle = ACE_OS::dup (this->data ()->get_handle ());
- }
- else
- {
- JAWS_FILE *file = new JAWS_FILE;
- ACE_FILE_Connector file_connector;
-
- int result = file_connector.connect (*file, ACE_FILE_Addr (filename));
- if (result == -1 || file->get_handle () == ACE_INVALID_HANDLE)
- {
- // TODO: do something here!
- }
-
- ACE_FILE_Info info;
- file->get_info (info);
-
- handle = ACE_OS::dup (file->get_handle ());
-
- {
- JAWS_Cached_FILE cf (filename, file, info.size_, cm);
- if (cf.data () != 0)
- {
- new (this) JAWS_Cached_FILE (filename, cm);
- return;
- }
- }
- }
-
- this->file_.set_handle (handle);
-}
-
-JAWS_Cached_FILE::JAWS_Cached_FILE (const char *const &filename,
- JAWS_FILE *&file,
- size_t size,
- JAWS_Filecache_Proxy::Cache_Manager *cm)
- : JAWS_Filecache_Proxy (filename, file, size, cm)
-{
-}
-
-JAWS_Cached_FILE::~JAWS_Cached_FILE (void)
-{
- this->file_.close ();
-}
-
-ACE_FILE_IO *
-JAWS_Cached_FILE::file (void)
-{
- return &(this->file_);
-}
-
-ACE_Mem_Map *
-JAWS_Cached_FILE::mmap (void)
-{
- return (this->data () == 0 ? 0 : this->data ()->mem_map ());
-}
-
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-
-template class JAWS_Cache_List_Item<JAWS_Strdup_String,
- JAWS_Referenced_Filecache_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_List_Item<JAWS_Strdup_String,
- JAWS_Counted_Filecache_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_List<JAWS_Strdup_String,
- JAWS_Referenced_Filecache_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_List<JAWS_Strdup_String,
- JAWS_Counted_Filecache_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_Manager<JAWS_Strdup_String,
- JAWS_Referenced_Filecache_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_Manager<JAWS_Strdup_String,
- JAWS_Counted_Filecache_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>;
-template class JAWS_Cache_Proxy<char const *,
- JAWS_FILE,
- JAWS_Referenced_Filecache_Manager>;
-template class JAWS_Cache_Proxy<char const *,
- JAWS_FILE,
- JAWS_Counted_Filecache_Manager>;
-template class ACE_Singleton<JAWS_Referenced_Filecache_Manager,
- ACE_Thread_Mutex>;
-template class ACE_Singleton<JAWS_Counted_Filecache_Manager,
- ACE_Thread_Mutex>;
-template class ACE_Singleton<JAWS_Referenced_Filecache_Factory,
- ACE_Thread_Mutex>;
-template class ACE_Singleton<JAWS_Counted_Filecache_Factory, ACE_Thread_Mutex>;
-
-#endif
diff --git a/apps/JAWS2/JAWS/Filecache.h b/apps/JAWS2/JAWS/Filecache.h
deleted file mode 100644
index 7ea313a43b1..00000000000
--- a/apps/JAWS2/JAWS/Filecache.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_FILECACHE_H
-#define JAWS_FILECACHE_H
-
-#include "ace/FILE_IO.h"
-
-#include "JAWS/Cache_Manager.h"
-#include "JAWS/FILE.h"
-#include "JAWS/Export.h"
-
-class JAWS_Export JAWS_Referenced_Filecache_Factory
- : public JAWS_Referenced_Cache_Object_Factory
-{
-public:
-
- virtual void destroy (JAWS_Cache_Object *);
-
-};
-
-class JAWS_Export JAWS_Counted_Filecache_Factory
- : public JAWS_Counted_Cache_Object_Factory
-{
-public:
-
- virtual void destroy (JAWS_Cache_Object *);
-
-};
-
-typedef JAWS_Cache_Manager<JAWS_Strdup_String,
- JAWS_Referenced_Filecache_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>
- JAWS_Referenced_Filecache_Manager;
-
-typedef JAWS_Cache_Manager<JAWS_Strdup_String,
- JAWS_Counted_Filecache_Factory,
- JAWS_String_Hash_Functor,
- JAWS_String_Equal_Functor>
- JAWS_Counted_Filecache_Manager;
-
-typedef JAWS_Counted_Filecache_Manager JAWS_Filecache_Manager;
-
-typedef JAWS_Cache_Proxy<const char *,
- JAWS_FILE, JAWS_Filecache_Manager>
- JAWS_Filecache_Proxy;
-
-class JAWS_Export JAWS_Cached_FILE : private JAWS_Filecache_Proxy
-{
-public:
-
- JAWS_Cached_FILE (const char *const &filename,
- JAWS_Filecache_Proxy::Cache_Manager *cm = 0);
- JAWS_Cached_FILE (const char *const &filename,
- JAWS_FILE *&file,
- size_t size,
- JAWS_Filecache_Proxy::Cache_Manager *cm = 0);
-
- ~JAWS_Cached_FILE (void);
-
- ACE_FILE_IO * file (void);
- ACE_Mem_Map * mmap (void);
-
-private:
-
- ACE_FILE_IO file_;
-
-};
-
-
-#endif /* JAWS_FILECACHE_H */
diff --git a/apps/JAWS2/JAWS/Hash_Bucket_T.cpp b/apps/JAWS2/JAWS/Hash_Bucket_T.cpp
deleted file mode 100644
index f498ce12681..00000000000
--- a/apps/JAWS2/JAWS/Hash_Bucket_T.cpp
+++ /dev/null
@@ -1,462 +0,0 @@
-// $Id$
-
-#ifndef JAWS_HASH_BUCKET_T_CPP
-#define JAWS_HASH_BUCKET_T_CPP
-
-#include "JAWS/Hash_Bucket_T.h"
-
-// -----------------
-// Hash_Bucket_Item
-// -----------------
-
-template <class EXT_ID, class INT_ID>
-JAWS_Hash_Bucket_Item<EXT_ID, INT_ID>
-::JAWS_Hash_Bucket_Item (const EXT_ID &ext_id, const INT_ID &int_id,
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *next,
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *prev)
- : ext_id_ (ext_id),
- int_id_ (int_id),
- next_ (next),
- prev_ (prev)
-{
-}
-
-template <class EXT_ID, class INT_ID>
-JAWS_Hash_Bucket_Item<EXT_ID, INT_ID>
-::JAWS_Hash_Bucket_Item (JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *next,
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *prev)
- : next_ (next),
- prev_ (prev)
-{
-}
-
-template <class EXT_ID, class INT_ID>
-JAWS_Hash_Bucket_Item<EXT_ID, INT_ID>::~JAWS_Hash_Bucket_Item (void)
-{
- this->next_ = 0;
- this->prev_ = 0;
-}
-
-
-// ---------------------
-// Hash_Bucket_DLCStack
-// ---------------------
-
-template <class EXT_ID, class INT_ID>
-JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID>::
-JAWS_Hash_Bucket_DLCStack (ACE_Allocator *alloc)
- : allocator_ (alloc),
- head_ (0),
- tail_ (0)
-{
- if (this->allocator_ == 0)
- this->allocator_ = ACE_Allocator::instance ();
-}
-
-template <class EXT_ID, class INT_ID>
-JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID>::
-~JAWS_Hash_Bucket_DLCStack (void)
-{
- this->reset ();
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID>::
-is_empty (void) const
-{
- return this->head_ == 0 && this->tail_ == 0;
-}
-
-template <class EXT_ID, class INT_ID> JAWS_HASH_BUCKET_ITEM *
-JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID>::
-push (const EXT_ID &ext_id, const INT_ID &int_id)
-{
- size_t malloc_size = sizeof (JAWS_HASH_BUCKET_ITEM);
- JAWS_HASH_BUCKET_ITEM *item;
- ACE_NEW_MALLOC_RETURN (item,
- (JAWS_HASH_BUCKET_ITEM *)
- this->allocator_->malloc (malloc_size),
- JAWS_HASH_BUCKET_ITEM (ext_id, int_id), 0);
-
- if (item != 0)
- {
- if (this->is_empty ())
- {
- this->head_ = item;
- this->tail_ = item;
- item->next_ = this->head_;
- item->prev_ = this->tail_;
- }
- else
- {
- item->next_ = this->head_;
- item->prev_ = this->tail_;
- this->head_->prev_ = item;
- this->tail_->next_ = item;
- this->head_ = item;
- }
- }
-
- return item;
-}
-
-template <class EXT_ID, class INT_ID> JAWS_HASH_BUCKET_ITEM *
-JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID>::pop (void)
-{
- JAWS_HASH_BUCKET_ITEM *item = 0;
-
- if (! this->is_empty ())
- {
- item = this->head_;
- if (this->head_ == this->tail_)
- {
- this->head_ = this->tail_ = 0;
- }
- else
- {
- this->head_ = this->head_->next_;
- this->head_->prev_ = this->tail_;
- this->tail_->next_ = this->head_;
- }
- item->next_ = 0;
- item->prev_ = 0;
- }
-
- return item;
-}
-
-template <class EXT_ID, class INT_ID> void
-JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID>::reset (void)
-{
- JAWS_HASH_BUCKET_ITEM *item = 0;
-
- while ((item = this->pop ()) != 0)
- this->remove (item);
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID>::remove (JAWS_HASH_BUCKET_ITEM *item)
-{
- int result = 0;
-
- if (item != 0)
- {
- if (item->next_ != 0 && item->prev_ != 0)
- {
- if (item->next_ != item)
- {
- if (this->head_ == item)
- this->head_ = item->next_;
- if (this->tail_ == item)
- this->tail_ = item->prev_;
- item->next_->prev_ = item->prev_;
- item->prev_->next_ = item->next_;
- }
- else
- {
- this->head_ = this->tail_ = 0;
- }
- item->next_ = 0;
- item->prev_ = 0;
- }
-
- if (item->next_ == 0 && item->prev_ == 0)
- {
- ACE_DES_FREE_TEMPLATE2 (item, this->allocator_->free,
- JAWS_Hash_Bucket_Item, EXT_ID, INT_ID);
- }
- else
- result = -1;
- }
-
- return result;
-}
-
-
-// ------------------------------
-// Hash_Bucket_DLCStack_Iterator
-// ------------------------------
-
-template <class EXT_ID, class INT_ID>
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::
-JAWS_Hash_Bucket_DLCStack_Iterator (const JAWS_HASH_BUCKET_DLCSTACK &dlcstack)
- : dlcstack_ (dlcstack),
- next_ (0),
- prev_ (0),
- done_ (0)
-{
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::first (void)
-{
- int result = 0;
-
- if (! this->dlcstack_.is_empty ())
- {
- result = 1;
- this->next_ = this->dlcstack_.head_;
- this->prev_ = this->dlcstack_.tail_;
- this->done_ = 0;
- }
-
- return result;
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::last (void)
-{
- return this->first ();
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::advance (void)
-{
- int result = 1;
-
- if (this->next_ != 0)
- {
- this->prev_ = this->next_;
- this->next_ = this->next_->next_;
- if (this->next_ == this->dlcstack_.head_)
- {
- this->done_ = 1;
- result = 0;
- }
- }
- else
- result = this->first ();
-
- return result;
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::revert (void)
-{
- int result = 1;
-
- if (this->prev_ != 0)
- {
- this->next_ = this->prev_;
- this->prev_ = this->prev_->prev_;
- if (this->prev_ == this->dlcstack_.tail_)
- {
- this->done_ = 1;
- result = 0;
- }
- }
- else
- result = this->last ();
-
- return result;
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::
-next (JAWS_HASH_BUCKET_ITEM *&item)
-{
- if (this->next_ == 0)
- this->first ();
-
- item = this->next_;
- return ! this->done ();
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::
-next (JAWS_HASH_BUCKET_ITEM *&item) const
-{
- item = this->next_;
- return ! this->done ();
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::
-prev (JAWS_HASH_BUCKET_ITEM *&item)
-{
- if (this->prev_ == 0)
- this->last ();
-
- item = this->prev_;
- return ! this->done ();
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::
-prev (JAWS_HASH_BUCKET_ITEM *&item) const
-{
- item = this->prev_;
- return ! this->done ();
-}
-
-template <class EXT_ID, class INT_ID> int
-JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>::done (void) const
-{
- return this->done_;
-}
-
-
-// --------------------
-// Hash_Bucket_Manager
-// --------------------
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC>
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>
-::JAWS_Hash_Bucket_Manager (ACE_Allocator *alloc)
- : dlcstack_ (alloc)
-{
- if (alloc == 0)
- this->dlcstack_.allocator_ = ACE_Allocator::instance ();
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::open (ACE_Allocator *alloc)
-{
- this->dlcstack_.allocator_ = alloc;
- if (alloc == 0)
- this->dlcstack_.allocator_ = ACE_Allocator::instance ();
-
- return 0;
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC>
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::~JAWS_Hash_Bucket_Manager (void)
-{
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::close (void)
-{
- this->dlcstack_.reset ();
- return 0;
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> JAWS_HASH_BUCKET_ITEM *
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>
-::find_i (const EXT_ID &ext_id) const
-{
- JAWS_HASH_BUCKET_DLCSTACK_ITERATOR iter (this->dlcstack_);
- JAWS_HASH_BUCKET_ITEM *item = 0;
-
- if (iter.first ())
- while (!iter.done ())
- {
- iter.next (item);
- if (item && EQ_FUNC (item->ext_id_, ext_id))
- break;
- iter.advance ();
- }
-
- return (item && EQ_FUNC (item->ext_id_, ext_id)) ? item : 0;
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::find (const EXT_ID &ext_id,
- INT_ID &int_id) const
-{
- int result = -1;
- JAWS_HASH_BUCKET_ITEM *item = this->find_i (ext_id);
-
- if (item)
- {
- int_id = item->int_id_;
- result = 0;
- }
-
- return result;
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>
-::find (const EXT_ID &ext_id) const
-{
- INT_ID dummy_id;
- return this->find (ext_id, dummy_id);
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::bind (const EXT_ID &ext_id,
- const INT_ID &int_id)
-{
- int result = 0;
-
- if (this->find (ext_id) == 0)
- {
- result = 1;
- }
- else
- {
- if (this->dlcstack_.push (ext_id, int_id) == 0)
- result = -1;
- }
-
- return result;
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::trybind (const EXT_ID &ext_id,
- INT_ID &int_id)
-{
- int result = 0;
-
- if (this->find (ext_id, int_id) == 0)
- {
- result = 1;
- }
- else
- {
- if (this->dlcstack_.push (ext_id, int_id) == 0)
- result = -1;
- }
-
- return result;
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::rebind (const EXT_ID &ext_id,
- const INT_ID &int_id,
- EXT_ID &old_ext_id,
- INT_ID &old_int_id)
-{
- int result = 0;
- JAWS_HASH_BUCKET_ITEM *item = this->find_i (ext_id);
-
- if (item)
- {
- result = 1;
- old_ext_id = item->ext_id_;
- old_int_id = item->int_id_;
- this->dlcstack_.remove (item);
- }
-
- if (this->dlcstack_.push (ext_id, int_id) == 0)
- result = -1;
-
- return result;
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::unbind (const EXT_ID &ext_id,
- INT_ID &int_id)
-{
- int result = -1;
- JAWS_HASH_BUCKET_ITEM *item = this->find_i (ext_id);
-
- if (item)
- {
- result = 0;
- int_id = item->int_id_;
- this->dlcstack_.remove (item);
- }
-
- return result;
-}
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC> int
-JAWS_Hash_Bucket_Manager<EXT_ID,INT_ID,EQ_FUNC>::unbind (const EXT_ID &ext_id)
-{
- INT_ID dummy_id;
- return this->unbind (ext_id, dummy_id);
-}
-
-#endif /* JAWS_HASH_BUCKET_T_CPP */
diff --git a/apps/JAWS2/JAWS/Hash_Bucket_T.h b/apps/JAWS2/JAWS/Hash_Bucket_T.h
deleted file mode 100644
index f37c959445f..00000000000
--- a/apps/JAWS2/JAWS/Hash_Bucket_T.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- c++ -*- */
-// Hey Emacs! This is a C++ file!
-// $Id$
-
-#ifndef JAWS_HASH_BUCKET_T_H
-#define JAWS_HASH_BUCKET_T_H
-
-#include "ace/Containers.h"
-
-#define JAWS_HASH_BUCKET_ITEM JAWS_Hash_Bucket_Item<EXT_ID, INT_ID>
-#define JAWS_HASH_BUCKET_DLCSTACK JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID>
-#define JAWS_HASH_BUCKET_DLCSTACK_ITERATOR \
- JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>
-
-
-// Why Hash_Bucket?
-//
-// This is an attempt to simplify the creation of high-performance
-// hash tables with respect to concurrent access by multiple threads.
-// To this end, we attempt to raise the amount of concurrency through
-// the use or readers/writer locks rather than through mutual
-// exclusion.
-
-template <class EXT_ID, class INT_ID>
-class JAWS_Hash_Bucket_Item
-{
-public:
- JAWS_Hash_Bucket_Item (const EXT_ID &ext_id, const INT_ID &int_id,
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *next = 0,
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *prev = 0);
- JAWS_Hash_Bucket_Item (JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *next = 0,
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *prev = 0);
-
- ~JAWS_Hash_Bucket_Item (void);
- // Destructor.
-
- EXT_ID ext_id_;
- // Key used to look up an entry.
-
- INT_ID int_id_;
- // The contents of the entry itself.
-
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *next_;
- // Pointer to the next item in the bucket of overflow nodes.
-
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *prev_;
- // Pointer to the prev item in the bucket of overflow nodes.
-
-};
-
-
-template <class EXT_ID, class INT_ID> class JAWS_Hash_Bucket_DLCStack_Iterator;
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC>
-class JAWS_Hash_Bucket_Manager;
-
-template <class EXT_ID, class INT_ID>
-class JAWS_Hash_Bucket_DLCStack
-// Create a doubly linked circular stack to be managed by the
-// Hash_Bucket_Manager
-{
- friend class JAWS_Hash_Bucket_DLCStack_Iterator<EXT_ID, INT_ID>;
-
-public:
-
- JAWS_Hash_Bucket_DLCStack (ACE_Allocator *alloc = 0);
- ~JAWS_Hash_Bucket_DLCStack (void);
-
- int is_empty (void) const;
- // Returns 1 if the container is empty, otherwise returns 0.
-
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *push (const EXT_ID &ext_id,
- const INT_ID &int_id);
- // Adds <new_item> to the head of the list.
- // Returns the new item that was inserted.
-
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *pop (void);
- // Removes and returns the first <item> in the list. Returns
- // internal node's address on success, 0 if the queue was empty.
- // This method will *not* free the internal node.
-
- void reset (void);
- // Reset the <JAWS_Hash_Bucket_DLCStack> to be empty.
- // Notice that since no one is interested in the items within,
- // This operation will delete all items.
-
- int remove (JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *item);
- // If item is still part of the CStack, it is removed.
- // In anycase, if there is no error, item is freed.
- // Returns 0 if ok, -1 on error.
-
- ACE_Allocator *allocator_;
-
-private:
-
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *head_;
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *tail_;
-
-};
-
-
-template <class EXT_ID, class INT_ID>
-class JAWS_Hash_Bucket_DLCStack_Iterator
-{
-public:
-
- JAWS_Hash_Bucket_DLCStack_Iterator (const JAWS_HASH_BUCKET_DLCSTACK &dlcstack);
-
- int first (void);
- // Moves to first element in the set, clears done flag. Returns 0
- // if empty, 1 otherwise.
-
- int last (void);
- // Moves to last element in the set, clears done flag. Returns 0 if
- // empty, 1 otherwise.
-
- int advance (void);
- // Move forward by one element of set. Returns 0 if empty or we end
- // up being the first element in the set, 1 otherwise. If advance
- // takes us to the first element, done is set to true.
-
- int revert (void);
- // Move backward by one element of set. Returns 0 if empty or we
- // end up being the last element in the set, 1 otherwise. If revert
- // takes us to the last element, done is set to true.
-
- int next (JAWS_HASH_BUCKET_ITEM *&item);
- int next (JAWS_HASH_BUCKET_ITEM *&item) const;
- // Pass back the next item. Returns 0 if done is true, 1 otherwise.
-
- int prev (JAWS_HASH_BUCKET_ITEM *&item);
- int prev (JAWS_HASH_BUCKET_ITEM *&item) const;
- // Pass back the previous item. Returns 0 if done is true, 1
- // otherwise.
-
- int done (void) const;
- // Returns 1 if done_ flag is set, 0 otherwise. done_ flag is set
- // if next takes us to first element or prev takes us to last
- // element.
-
-private:
- const JAWS_HASH_BUCKET_DLCSTACK &dlcstack_;
- JAWS_HASH_BUCKET_ITEM *next_;
- JAWS_HASH_BUCKET_ITEM *prev_;
- int done_;
-};
-
-
-template <class EXT_ID, class INT_ID, class EQ_FUNC>
-class JAWS_Hash_Bucket_Manager
-{
-public:
- JAWS_Hash_Bucket_Manager (ACE_Allocator *alloc = 0);
- int open (ACE_Allocator *alloc = 0);
-
- ~JAWS_Hash_Bucket_Manager (void);
- int close (void);
-
- int find (const EXT_ID &ext_id) const;
- int find (const EXT_ID &ext_id, INT_ID &int_id) const;
- // Locate <ext_id> and pass out parameter via <int_id>. If found,
- // return 0, returns -1 if not found.
-
- int bind (const EXT_ID &ext_id, const INT_ID &int_id);
- int trybind (const EXT_ID &ext_id, INT_ID &int_id);
- // Associate <ext_id> with <int_id> if and only if <ext_id> is not
- // in the map. If <ext_id> is already in the map then the <int_id>
- // parameter is assigned the existing value in the map. Returns 0
- // if a new entry is bound successfully, returns 1 if an attempt is
- // made to bind an existing entry, and returns -1 if failures occur.
-
- int rebind (const EXT_ID &ext_id, const INT_ID &int_id,
- EXT_ID &old_ext_id, INT_ID &old_int_id);
- // Associate <ext_id> with <int_id>. If <ext_id> is not in the map
- // then behaves just like <bind>. Otherwise, store the old values
- // of <ext_id> and <int_id> into the "out" parameters and rebind the
- // new parameters. This is very useful if you need to have an
- // atomic way of updating <JAWS_Hash_Map_Entrys> and you also need full
- // control over memory allocation. Returns 0 if a new entry is
- // bound successfully, returns 1 if an existing entry was rebound,
- // and returns -1 if failures occur.
-
- int unbind (const EXT_ID &ext_id);
- int unbind (const EXT_ID &ext_id, INT_ID &int_id);
- // Break any association of <ext_id>. Returns the value of <int_id>
- // in case the caller needs to deallocate memory. Return value is 0
- // if unbind succeeds, -1 otherwise.
-
-protected:
-
- JAWS_Hash_Bucket_Item<EXT_ID, INT_ID> *find_i (const EXT_ID &ext_id) const;
- // Returns the item associated with ext_id if found in list.
- // Returns NULL if not found.
-
-private:
-
- JAWS_Hash_Bucket_DLCStack<EXT_ID, INT_ID> dlcstack_;
-
-};
-
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "JAWS/Hash_Bucket_T.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#endif /* JAWS_HASH_BUCKET_T_H */
diff --git a/apps/JAWS2/JAWS/Headers.cpp b/apps/JAWS2/JAWS/Headers.cpp
deleted file mode 100644
index a7e77f56a3a..00000000000
--- a/apps/JAWS2/JAWS/Headers.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $Id$ */
-
-#include "JAWS/Headers.h"
-#include "ace/OS_NS_stdlib.h"
-#include "ace/OS_NS_strings.h"
-#include "ace/OS_NS_string.h"
-
-// Header Data
-
-JAWS_Header_Data::JAWS_Header_Data (const char *name, const char *value,
- int type)
- : header_name_ (name ? ACE_OS::strdup (name) : 0),
- header_value_ (value ? ACE_OS::strdup (value) : 0),
- header_type_ (type)
-{
-}
-
-JAWS_Header_Data::JAWS_Header_Data (const char *name, int type,
- const char *value)
- : header_name_ (name ? ACE_OS::strdup (name) : 0),
- header_value_ (value ? ACE_OS::strdup (value) : 0),
- header_type_ (type)
-{
-}
-
-JAWS_Header_Data::~JAWS_Header_Data (void)
-{
- if ( this->header_name_ )
- ACE_OS::free ((void *)this->header_name_);
- if ( this->header_value_ )
- ACE_OS::free ((void *)this->header_value_);
- this->header_name_ = 0;
- this->header_value_ = 0;
-}
-
-const char *
-JAWS_Header_Data::header_name (void) const
-{
- return this->header_name_;
-}
-
-const char *
-JAWS_Header_Data::header_value (void) const
-{
- return this->header_value_;
-}
-
-int
-JAWS_Header_Data::header_type (void) const
-{
- return this->header_type_;
-}
-
-void
-JAWS_Header_Data::header_name (const char *name)
-{
- if (this->header_name_)
- ACE_OS::free ((void *)this->header_name_);
- this->header_name_ = name ? ACE_OS::strdup (name) : 0;
-}
-
-void
-JAWS_Header_Data::header_value (const char *value)
-{
- if (this->header_value_)
- ACE_OS::free ((void *)this->header_value_);
- this->header_value_ = value ? ACE_OS::strdup (value) : 0;
-}
-
-void
-JAWS_Header_Data::header_type (int type)
-{
- this->header_type_ = type;
-}
-
-
-// Header Table
-
-JAWS_Headers::JAWS_Headers (void)
- : iter_ (*this)
-{
-}
-
-JAWS_Headers::~JAWS_Headers (void)
-{
-}
-
-JAWS_Header_Table_Iterator &
-JAWS_Headers::iter (void)
-{
- return this->iter_;
-}
-
-int
-JAWS_Headers::insert (JAWS_Header_Data *new_data)
-{
- // Since there may be duplicate header entries, we don't worry about
- // doing this find anymore. Make the application developer figure
- // out how to interpret duplicate entries.
-
- return (JAWS_Header_Table::insert_tail (new_data) ? 0 : -1);
-}
-
-JAWS_Header_Data *
-JAWS_Headers::find (const char *const &header_name)
-{
- this->iter_.first ();
- return this->find_next (header_name);
-}
-
-JAWS_Header_Data *
-JAWS_Headers::find_next (const char *const &header_name)
-{
- JAWS_Header_Data *data = 0;
- JAWS_Header_Table_Iterator &i = this->iter_;
-
- while (! i.done ())
- {
- data = i.next ();
- if (data != 0)
- {
- if (ACE_OS::strcasecmp (data->header_name (), header_name) != 0)
- data = 0;
- }
- i.advance ();
- if (data != 0)
- break;
- }
-
- return data;
-}
-
-void
-JAWS_Headers::remove_all (const char *const &header_name)
-{
- JAWS_Header_Data *data;
- int done;
-
- do
- {
- JAWS_Header_Table_Iterator i (*this);
- i.first ();
- done = 1;
- while (! i.done ())
- {
- data = i.next ();
- if (data != 0
- && ACE_OS::strcasecmp (data->header_name (), header_name) == 0)
- {
- i.remove ();
- delete data;
- done = 0;
- break;
- }
- else
- i.advance ();
- }
- }
- while (! done);
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_DLList<JAWS_Header_Data>;
-template class ACE_DLList_Iterator<JAWS_Header_Data>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_DLList<JAWS_Header_Data>
-#pragma instantiate ACE_DLList_Iterator<JAWS_Header_Data>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/Headers.h b/apps/JAWS2/JAWS/Headers.h
deleted file mode 100644
index f16db921915..00000000000
--- a/apps/JAWS2/JAWS/Headers.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_HEADERS_H
-#define JAWS_HEADERS_H
-
-#include "JAWS/Export.h"
-#include "ace/Containers.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-// Use scenario --
-
-// Parse_Headers will parse out a header name and then will want to
-// update "last header data" in Header_Info. At this point, only the
-// header name is strdup'd.
-
-// Parse_Headers will then append additional data to the header value
-// until the header value of "last header data" is done.
-
-// Parse_Headers will notify Header_Info that "last header data" is
-// done and is ready to be inserted into the Headers data structure.
-// At this point, the header value is strdup'd.
-
-class JAWS_Export JAWS_Header_Data
-{
-public:
- JAWS_Header_Data (const char *name, const char *value = 0, int type = 0);
- JAWS_Header_Data (const char *name, int type, const char *value = 0);
- ~JAWS_Header_Data (void);
-
- const char * header_name (void) const;
- const char * header_value (void) const;
- int header_type (void) const;
-
- void header_name (const char *name);
- void header_value (const char *value);
- void header_type (int type);
-
-private:
- const char * header_name_;
- const char * header_value_;
- int header_type_;
-};
-
-typedef ACE_DLList<JAWS_Header_Data> JAWS_Header_Table;
-typedef ACE_DLList_Iterator<JAWS_Header_Data> JAWS_Header_Table_Iterator;
-
-class JAWS_Export JAWS_Headers : public JAWS_Header_Table
-{
-public:
- JAWS_Headers (void);
- ~JAWS_Headers (void);
-
- int insert (JAWS_Header_Data *new_data);
- // insert the new data 0 -> success, -1 -> failure
-
- JAWS_Header_Data * find (const char *const &header_name);
- // find always begins from the beginning of the list
- // result is NULL if not found
-
- JAWS_Header_Data * find_next (const char *const &header_name);
- // behaves like find, but from where that last find left off
- // result is NULL if not found
-
- void remove_all (const char *const &header_name);
- // remove all headers from list that match header_name
-
- JAWS_Header_Table_Iterator &iter (void);
- // returns an iterator to the headers container
-
-private:
- JAWS_Header_Table_Iterator iter_;
-};
-
-#endif /* !defined (JAWS_HEADERS_H) */
diff --git a/apps/JAWS2/JAWS/IO.cpp b/apps/JAWS2/JAWS/IO.cpp
deleted file mode 100644
index dba86cbf8f2..00000000000
--- a/apps/JAWS2/JAWS/IO.cpp
+++ /dev/null
@@ -1,610 +0,0 @@
-// $Id$
-
-#include "ace/Message_Block.h"
-#include "ace/SOCK_Stream.h"
-#include "ace/Filecache.h"
-#include "ace/OS_NS_string.h"
-#include "ace/OS_NS_unistd.h"
-#include "ace/OS_NS_sys_uio.h"
-#include "ace/OS_NS_sys_socket.h"
-#include "ace/Min_Max.h"
-
-#include "JAWS/JAWS.h"
-#include "JAWS/Data_Block.h"
-#include "JAWS/Policy.h"
-#include "JAWS/IO.h"
-#include "JAWS/IO_Handler.h"
-#include "JAWS/IO_Acceptor.h"
-#include "JAWS/Filecache.h"
-
-#include "ace/Asynch_IO.h" //for ACE_Asynch_Write_Stream
-
-// #include "HTTP_Helpers.h"
-
-ACE_RCSID(JAWS, IO, "$Id$")
-
-JAWS_IO::JAWS_IO (void)
- : handle_ (ACE_INVALID_HANDLE),
- handler_ (0),
- inet_addr_ (0),
- acceptor_ (0)
-{
-}
-
-JAWS_IO::~JAWS_IO (void)
-{
-}
-
-#if 0
-ACE_HANDLE
-JAWS_IO::handle (void)
-{
- return this->handle_;
-}
-
-void
-JAWS_IO::handle (ACE_HANDLE handle)
-{
- this->handle_ = handle;
-}
-
-void
-JAWS_IO::handler (JAWS_IO_Handler *handler)
-{
- this->handler_ = handler;
-}
-
-void
-JAWS_IO::acceptor (JAWS_IO_Acceptor *acceptor)
-{
- this->acceptor_ = acceptor;
-}
-#endif /* 0 */
-
-JAWS_Synch_IO::JAWS_Synch_IO (void)
-{
- this->acceptor_ = JAWS_IO_Synch_Acceptor_Singleton::instance ();
-}
-
-JAWS_Synch_IO::~JAWS_Synch_IO (void)
-{
- if (this->handle_ != ACE_INVALID_HANDLE)
- ACE_OS::closesocket (this->handle_);
-}
-
-void
-JAWS_Synch_IO::accept (JAWS_IO_Handler *ioh,
- ACE_Message_Block *,
- unsigned int)
-{
- ACE_SOCK_Stream new_stream;
- new_stream.set_handle (ACE_INVALID_HANDLE);
- if (this->acceptor_->accept (new_stream) == -1)
- ioh->accept_error ();
- else
- ioh->accept_complete (new_stream.get_handle ());
-}
-
-void
-JAWS_Synch_IO::read (JAWS_IO_Handler *ioh,
- ACE_Message_Block *mb,
- unsigned int size)
-{
- JAWS_TRACE ("JAWS_Synch_IO::read");
-
- ACE_SOCK_Stream stream;
-
- stream.set_handle (ioh->handle ());
- int result = stream.recv (mb->wr_ptr (), size);
-
- if (result <= 0)
- ioh->read_error ();
- else
- {
- JAWS_TRACE ("JAWS_Synch_IO::read success");
- mb->wr_ptr (result);
- ioh->read_complete (mb);
- }
-}
-
-void
-JAWS_Synch_IO::receive_file (JAWS_IO_Handler *ioh,
- const char *filename,
- void *initial_data,
- unsigned int initial_data_length,
- unsigned int entire_length)
-{
- ACE_Filecache_Handle handle (filename,
- (int) entire_length);
-
- int result = handle.error ();
-
- if (result == ACE_Filecache_Handle::ACE_SUCCESS)
- {
- ACE_SOCK_Stream stream;
- stream.set_handle (ioh->handle ());
-
- int bytes_to_memcpy = ACE_MIN (entire_length, initial_data_length);
- ACE_OS::memcpy (handle.address (), initial_data, bytes_to_memcpy);
-
- int bytes_to_read = entire_length - bytes_to_memcpy;
-
- int bytes = stream.recv_n ((char *)
- handle.address () + initial_data_length,
- bytes_to_read);
- if (bytes == bytes_to_read)
- ioh->receive_file_complete ();
- else
- result = -1;
- }
-
- if (result != ACE_Filecache_Handle::ACE_SUCCESS)
- ioh->receive_file_error (result);
-}
-
-void
-JAWS_Synch_IO::transmit_file (JAWS_IO_Handler *ioh,
- ACE_HANDLE handle,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size)
-{
- int result = 0;
-
- if (handle != ACE_INVALID_HANDLE)
- {
- ACE_SOCK_Stream stream;
- stream.set_handle (ioh->handle ());
-
- if ((unsigned long) stream.send_n (header, header_size) < header_size)
- {
- result = -1;
- }
- else
- {
- int count;
- char buf[BUFSIZ];
-
- do
- {
- count = ACE_OS::read (handle, buf, sizeof (buf));
- if (count <= 0)
- break;
-
- if (stream.send_n (buf, count) < count)
- {
- result = -1;
- }
- }
- while (result == 0);
-
- if ((unsigned long) stream.send_n (trailer, trailer_size)
- < trailer_size)
- {
- result = -1;
- }
- }
- }
-
- if (result == 0)
- ioh->transmit_file_complete ();
- else
- ioh->transmit_file_error (result);
-}
-
-void
-JAWS_Synch_IO::transmit_file (JAWS_IO_Handler *ioh,
- const char *filename,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size)
-{
- int result = 0;
-
- if (filename == 0)
- {
- ioh->transmit_file_error (-1);
- return;
- }
-
- JAWS_Cached_FILE cf (filename);
-
- if (cf.file ()->get_handle () != ACE_INVALID_HANDLE
- && cf.mmap () != 0)
- {
-#if defined (ACE_JAWS_BASELINE) || defined (ACE_WIN32)
- ACE_FILE_Info info;
- cf.file ()->get_info (info);
-
- if (cf.file ()->get_info (info) == 0 && info.size_ > 0)
- {
- ACE_SOCK_Stream stream;
- stream.set_handle (ioh->handle ());
- if (((u_long) stream.send_n (header, header_size) == header_size)
- && (stream.send_n (cf.mmap ()->addr (), info.size_)
- == info.size_)
- && ((u_long) stream.send_n (trailer, trailer_size)
- == trailer_size))
- {
- ioh->transmit_file_complete ();
- return;
- }
- else
- {
- result = -1;
- }
- }
- else
- {
- result = -1;
- }
-#else
- // Attempting to use writev
- // Is this faster?
- iovec iov[3];
- int iovcnt = 0;
- if (header_size > 0)
- {
- iov[iovcnt].iov_base = const_cast<char*> (header);
- iov[iovcnt].iov_len = header_size;
- iovcnt++;
- }
-
- ACE_FILE_Info info;
-
- if (cf.file ()->get_info (info) == 0 && info.size_ > 0)
- {
- iov[iovcnt].iov_base = (char *) cf.mmap ()->addr ();
- iov[iovcnt].iov_len = info.size_;
- iovcnt++;
- }
- if (trailer_size > 0)
- {
- iov[iovcnt].iov_base = const_cast<char*> (trailer);
- iov[iovcnt].iov_len = trailer_size;
- iovcnt++;
- }
- if (ACE_OS::writev (ioh->handle (), iov, iovcnt) < 0)
- {
- result = -1;
- }
- else
- {
- ioh->transmit_file_complete ();
- return;
- }
-#endif /* ACE_JAWS_BASELINE */
- }
- else if (cf.file ()->get_handle () != ACE_INVALID_HANDLE
- && cf.mmap () == 0)
- {
- this->transmit_file (ioh,
- cf.file ()->get_handle (),
- header, header_size,
- trailer, trailer_size);
- return;
- }
- else
- {
- result = -1;
- }
-
- if (result != 0)
- {
- ioh->transmit_file_error (result);
- }
-}
-
-void
-JAWS_Synch_IO::send_confirmation_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length)
-{
- this->send_message (ioh, buffer, length);
- ioh->confirmation_message_complete ();
-}
-
-void
-JAWS_Synch_IO::send_error_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length)
-{
- this->send_message (ioh, buffer, length);
- ioh->error_message_complete ();
-}
-
-void
-JAWS_Synch_IO::send_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length)
-{
- ACE_SOCK_Stream stream;
- stream.set_handle (ioh->handle ());
- stream.send_n (buffer, length);
-}
-
-// This only works on Win32
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
-
-JAWS_Asynch_IO::JAWS_Asynch_IO (void)
-{
-}
-
-JAWS_Asynch_IO::~JAWS_Asynch_IO (void)
-{
- if (this->handle_ != ACE_INVALID_HANDLE)
- ACE_OS::closesocket (this->handle_);
-}
-
-void
-JAWS_Asynch_IO::accept (JAWS_IO_Handler *ioh,
- ACE_Message_Block *,
- unsigned int)
-{
- JAWS_TRACE ("JAWS_Asynch_IO::accept");
-
- ioh->idle ();
-
- JAWS_Data_Block *db = ioh->message_block ();
- //ACE_HANDLE listen_handle = db->policy ()->acceptor ()->get_handle ();
-
- //JAWS_Asynch_IO_Handler *aioh =
- // dynamic_cast<JAWS_Asynch_IO_Handler *> (ioh);
-
- size_t bytes_to_read = JAWS_Data_Block::JAWS_DATA_BLOCK_SIZE;
-
- if (db->policy ()->acceptor ()->accept (bytes_to_read, ioh) == -1)
- ioh->accept_error ();
-}
-
-void
-JAWS_Asynch_IO::read (JAWS_IO_Handler *ioh,
- ACE_Message_Block* mb,
- unsigned int size)
-{
- JAWS_TRACE ("JAWS_Asynch_IO::read");
-
- ioh->idle ();
-
- JAWS_Asynch_IO_Handler *aioh =
- dynamic_cast<JAWS_Asynch_IO_Handler *> (ioh);
-
- ACE_Asynch_Read_Stream ar;
-
- if (ar.open (*(aioh->handler ()), aioh->handle ()) == -1
- || ar.read (*mb, size) == -1)
- aioh->read_error ();
-}
-
-void
-JAWS_Asynch_IO::receive_file (JAWS_IO_Handler *ioh,
- const char *filename,
- void *initial_data,
- unsigned int initial_data_length,
- unsigned int entire_length)
-{
- JAWS_TRACE ("JAWS_Asynch_IO::receive_file");
-
- ioh->idle ();
-
- JAWS_Asynch_IO_Handler *aioh =
- dynamic_cast<JAWS_Asynch_IO_Handler *> (ioh);
-
- ACE_Message_Block *mb = 0;
- ACE_Filecache_Handle *handle;
-
- ACE_NEW (handle, ACE_Filecache_Handle (filename, entire_length, ACE_NOMAP));
-
- int result = handle->error ();
-
- if (result == ACE_Filecache_Handle::ACE_SUCCESS)
- {
- ACE_OS::memcpy (handle->address (),
- initial_data,
- initial_data_length);
-
- int bytes_to_read = entire_length - initial_data_length;
-
- ACE_NEW (mb, ACE_Message_Block ((char *)handle->address ()
- + initial_data_length, bytes_to_read));
-
- if (mb == 0)
- {
- errno = ENOMEM;
- result = -1;
- }
- else
- {
- ACE_Asynch_Read_Stream ar;
-
- if (ar.open (*(aioh->handler ()), aioh->handle ()) == -1
- || ar.read (*mb, mb->size () - mb->length (), handle) == -1)
- result = -1;
- }
- }
-
- if (result != ACE_Filecache_Handle::ACE_SUCCESS)
- {
- this->handler_->receive_file_error (result);
- delete mb;
- delete handle;
- }
-}
-
-void
-JAWS_Asynch_IO::transmit_file (JAWS_IO_Handler *ioh,
- ACE_HANDLE handle,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size)
-{
- JAWS_TRACE ("JAWS_Asynch_IO::transmit_file");
-
- ioh->idle ();
-
- JAWS_Asynch_IO_Handler *aioh =
- dynamic_cast<JAWS_Asynch_IO_Handler *> (ioh);
-
- ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer = 0;
-
- int result = 0;
-
- if (handle != ACE_INVALID_HANDLE)
- {
- ACE_Message_Block hdr_mb (header, header_size);
- ACE_Message_Block trl_mb (trailer, trailer_size);
-
- header_and_trailer =
- new ACE_Asynch_Transmit_File::Header_And_Trailer (hdr_mb.duplicate (),
- header_size,
- trl_mb.duplicate (),
- trailer_size);
-
- ACE_Asynch_Transmit_File tf;
-
- if (tf.open (*(aioh->handler ()), aioh->handle ()) == -1
- || tf.transmit_file (handle, // file handle
- header_and_trailer, // header and trailer data
- 0, // bytes_to_write
- 0, // offset
- 0, // offset_high
- 0, // bytes_per_send
- 0, // flags
- 0 // act
- ) == -1)
- result = -1;
- }
-
- if (result != 0)
- {
- ioh->transmit_file_error (result);
- delete header_and_trailer;
- }
-}
-
-void
-JAWS_Asynch_IO::transmit_file (JAWS_IO_Handler *ioh,
- const char *filename,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size)
-{
- int result = 0;
-
- JAWS_TRACE ("JAWS_Asynch_IO::transmit_file");
-
- ioh->idle ();
-
- JAWS_Asynch_IO_Handler *aioh =
- dynamic_cast<JAWS_Asynch_IO_Handler *> (ioh);
-
- ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer = 0;
- JAWS_Cached_FILE *cf = new JAWS_Cached_FILE (filename);
-
- if (cf->file ()->get_handle () != ACE_INVALID_HANDLE)
- {
- ACE_Message_Block hdr_mb (header, header_size);
- ACE_Message_Block trl_mb (trailer, trailer_size);
-
- header_and_trailer = new ACE_Asynch_Transmit_File::Header_And_Trailer
- (hdr_mb.duplicate (), header_size, trl_mb.duplicate (), trailer_size);
-
- ACE_Asynch_Transmit_File tf;
-
- if (tf.open (*(aioh->handler ()), aioh->handle ()) == -1
- || tf.transmit_file (cf->file ()->get_handle (), // file handle
- header_and_trailer, // header and trailer data
- 0, // bytes_to_write
- 0, // offset
- 0, // offset_high
- 0, // bytes_per_send
- 0, // flags
- cf // act
- ) == -1)
- result = -1;
- }
-
- if (result != 0)
- {
- ioh->transmit_file_error (result);
- delete header_and_trailer;
- delete cf;
- }
-}
-
-void
-JAWS_Asynch_IO::send_confirmation_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length)
-{
- this->send_message (ioh, buffer, length, CONFIRMATION);
-}
-
-void
-JAWS_Asynch_IO::send_error_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length)
-{
- this->send_message (ioh, buffer, length, ERROR_MESSAGE);
-}
-
-void
-JAWS_Asynch_IO::send_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length,
- long act)
-{
- ioh->idle ();
-
- JAWS_Asynch_IO_Handler *aioh =
- dynamic_cast<JAWS_Asynch_IO_Handler *> (ioh);
-
- ACE_Message_Block *mb;
- ACE_NEW (mb, ACE_Message_Block (buffer, length));
-
- if (mb == 0)
- {
- this->handler_->error_message_complete ();
- return;
- }
-
- ACE_Asynch_Write_Stream aw;
- if (aw.open (*(aioh->handler ()), aioh->handle ()) == -1
- || aw.write (*mb, length, (void *) act) == -1)
- {
- mb->release ();
-
- if (act == CONFIRMATION)
- ioh->confirmation_message_complete ();
- else
- ioh->error_message_complete ();
- }
-}
-
-void
-JAWS_Asynch2_IO::accept (JAWS_IO_Handler *,
- ACE_Message_Block *,
- unsigned int)
-{
-}
-
-#endif /* ACE_WIN32 */
-
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Singleton<JAWS_Synch_IO, ACE_SYNCH_MUTEX>;
- #if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- template class ACE_Singleton<JAWS_Asynch_IO, ACE_SYNCH_MUTEX>;
- template class ACE_Singleton<JAWS_Asynch2_IO, ACE_SYNCH_MUTEX>;
- #endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)*/
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Singleton<JAWS_Synch_IO, ACE_SYNCH_MUTEX>
- #if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- #pragma instantiate ACE_Singleton<JAWS_Asynch_IO, ACE_SYNCH_MUTEX>
- #pragma instantiate ACE_Singleton<JAWS_Asynch2_IO, ACE_SYNCH_MUTEX>
- #endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)*/
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/IO.h b/apps/JAWS2/JAWS/IO.h
deleted file mode 100644
index 840ff327380..00000000000
--- a/apps/JAWS2/JAWS/IO.h
+++ /dev/null
@@ -1,263 +0,0 @@
-/* -*- c++ -*- */
-// Hey, Emacs! This is a C++ file!
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// jaws
-//
-// = FILENAME
-// IO.h
-//
-// = AUTHOR
-// James Hu
-//
-// ============================================================================
-
-#ifndef JAWS_IO_H
-#define JAWS_IO_H
-
-#include "ace/ACE.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Asynch_IO.h"
-#include "ace/SOCK_Stream.h"
-#include "ace/Singleton.h"
-#include "ace/Synch_Traits.h"
-
-#include "JAWS/Export.h"
-
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-class ACE_Message_Block;
-ACE_END_VERSIONED_NAMESPACE_DECL
-
-class JAWS_IO_Handler;
-class JAWS_IO_Acceptor;
-
-
-
-class JAWS_Export JAWS_IO
- // = TITLE
- //
- // This class defines the abstract interface for an I/O class in
- // the context of Web-likes servers
- //
- // = DESCRIPTION
- //
- // An I/O class should have the following interface. Derived
- // classes will define the exactly how the I/O will take place
- // (Asynchronous, Synchronous, Reactive)
-{
-public:
- JAWS_IO (void);
- virtual ~JAWS_IO (void);
-
- // void acceptor (JAWS_IO_Acceptor *acceptor);
- // void handler (JAWS_IO_Handler *handler);
- // void handle (ACE_HANDLE h);
- // ACE_HANDLE handle (void);
-
- // James, please add documentation here.
-
- virtual void accept (JAWS_IO_Handler *ioh,
- ACE_Message_Block *mb = 0,
- unsigned int size = 0) = 0;
- // accept a passive connection
-
- virtual void read (JAWS_IO_Handler *ioh,
- ACE_Message_Block *mb,
- unsigned int size) = 0;
- // read from the handle size bytes into the message block.
-
- virtual void transmit_file (JAWS_IO_Handler *ioh,
- ACE_HANDLE file,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size) = 0;
- // send header, filename, trailer to the handle.
-
- virtual void transmit_file (JAWS_IO_Handler *ioh,
- const char *filename,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size) = 0;
- // send header, filename, trailer to the handle.
-
- virtual void receive_file (JAWS_IO_Handler *ioh,
- const char *filename,
- void *initial_data,
- unsigned int initial_data_length,
- unsigned int entire_length) = 0;
- // read data from the handle and store in filename.
-
- virtual void send_confirmation_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length) = 0;
- // send a confirmation message to the handle.
-
- virtual void send_error_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length) = 0;
- // send an error message to the handle.
-
-protected:
- ACE_HANDLE handle_;
- JAWS_IO_Handler *handler_;
- ACE_INET_Addr *inet_addr_;
- JAWS_IO_Acceptor *acceptor_;
-};
-
-class JAWS_Export JAWS_Synch_IO : public JAWS_IO
- // = TITLE
- //
- // This class defines the interface for a Synchronous I/O class.
- //
- // = DESCRIPTION
-{
-public:
- JAWS_Synch_IO (void);
-
- virtual ~JAWS_Synch_IO (void);
-
- virtual void accept (JAWS_IO_Handler *ioh,
- ACE_Message_Block *mb = 0,
- unsigned int size = 0);
-
- virtual void read (JAWS_IO_Handler *ioh,
- ACE_Message_Block *mb,
- unsigned int size);
-
- virtual void transmit_file (JAWS_IO_Handler *ioh,
- ACE_HANDLE handle,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size);
-
- virtual void transmit_file (JAWS_IO_Handler *ioh,
- const char *filename,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size);
-
- virtual void receive_file (JAWS_IO_Handler *ioh,
- const char *filename,
- void *initial_data,
- unsigned int initial_data_length,
- unsigned int entire_length);
-
- virtual void send_confirmation_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length);
-
- virtual void send_error_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length);
-
-protected:
- virtual void send_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length);
-};
-
-typedef ACE_Singleton<JAWS_Synch_IO, ACE_SYNCH_MUTEX>
- JAWS_Synch_IO_Singleton;
-
-// This only works on Win32
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
-
-class JAWS_Export JAWS_Asynch_IO : public JAWS_IO
- // = TITLE
- //
- // This class defines the interface for a Asynchronous I/O class.
- //
- // = DESCRIPTION
-{
-public:
- JAWS_Asynch_IO (void);
-
- virtual ~JAWS_Asynch_IO (void);
-
- virtual void accept (JAWS_IO_Handler *ioh,
- ACE_Message_Block *mb = 0,
- unsigned int size = 0);
-
- virtual void read (JAWS_IO_Handler *ioh,
- ACE_Message_Block *mb,
- unsigned int size);
-
- virtual void transmit_file (JAWS_IO_Handler *ioh,
- ACE_HANDLE handle,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size);
-
- virtual void transmit_file (JAWS_IO_Handler *ioh,
- const char *filename,
- const char *header,
- unsigned int header_size,
- const char *trailer,
- unsigned int trailer_size);
-
- virtual void receive_file (JAWS_IO_Handler *ioh,
- const char *filename,
- void *initial_data,
- unsigned int initial_data_length,
- unsigned int entire_length);
-
- virtual void send_confirmation_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length);
-
- virtual void send_error_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length);
-
-#ifdef ACE_LYNXOS_MAJOR
-#ifdef ERROR_MESSAGE
-#undef ERROR_MESSAGE
-#endif /* ERROR_MESSAGE */
-#endif /* ACE_LYNXOS_MAJOR */
-
- enum Message_Types
- {
- CONFIRMATION,
- ERROR_MESSAGE
- };
-
-protected:
-
- virtual void send_message (JAWS_IO_Handler *ioh,
- const char *buffer,
- unsigned int length,
- long act);
-};
-
-typedef ACE_Singleton<JAWS_Asynch_IO, ACE_SYNCH_MUTEX>
- JAWS_Asynch_IO_Singleton;
-
-class JAWS_Export JAWS_Asynch2_IO : public JAWS_Asynch_IO
-{
- // This version of Asynch_IO has a do nothing accept() implementation.
-public:
- virtual void accept (JAWS_IO_Handler *ioh,
- ACE_Message_Block *mb = 0,
- unsigned int size = 0);
- // does nothing
-
-};
-
-typedef ACE_Singleton<JAWS_Asynch2_IO, ACE_SYNCH_MUTEX>
- JAWS_Asynch2_IO_Singleton;
-
-#endif /* ACE_WIN32 */
-
-#endif /* JAWS_IO_H */
diff --git a/apps/JAWS2/JAWS/IO_Acceptor.cpp b/apps/JAWS2/JAWS/IO_Acceptor.cpp
deleted file mode 100644
index e8aefec3fb2..00000000000
--- a/apps/JAWS2/JAWS/IO_Acceptor.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-// $Id$
-
-#include "JAWS/Data_Block.h"
-#include "JAWS/IO_Acceptor.h"
-
-#include "ace/OS_NS_sys_socket.h"
-
-ACE_RCSID(JAWS, IO_Acceptor, "$Id$")
-
-JAWS_IO_Acceptor::JAWS_IO_Acceptor (void)
-{
-}
-
-JAWS_IO_Acceptor::~JAWS_IO_Acceptor (void)
-{
-}
-
-int
-JAWS_IO_Acceptor::open (const ACE_INET_Addr &, int)
-{
- return -1;
-}
-
-int
-JAWS_IO_Acceptor::open (const ACE_HANDLE &)
-{
- return -1;
-}
-
-void
-JAWS_IO_Acceptor::close (void)
-{
-}
-
-int
-JAWS_IO_Acceptor::accept (ACE_SOCK_Stream &, ACE_Addr *, ACE_Time_Value *,
- int, int) const
-{
- return -1;
-}
-
-int
-JAWS_IO_Acceptor::accept (size_t, const void *)
-{
- return -1;
-}
-
-ACE_HANDLE
-JAWS_IO_Acceptor::get_handle (void)
-{
- return ACE_INVALID_HANDLE;
-}
-
-int
-JAWS_IO_Synch_Acceptor::open (const ACE_INET_Addr &local_sap, int backlog)
-{
- return this->acceptor_.open (local_sap, 1, PF_INET, backlog);
-}
-
-int
-JAWS_IO_Synch_Acceptor::open (const ACE_HANDLE &socket)
-{
- ACE_HANDLE handle = this->acceptor_.get_handle ();
- if (handle == socket)
- return 0;
-
- if (handle != ACE_INVALID_HANDLE)
- ACE_OS::closesocket (this->acceptor_.get_handle ());
- this->acceptor_.set_handle (socket);
-
- return 0;
-}
-
-int
-JAWS_IO_Synch_Acceptor::accept (ACE_SOCK_Stream &new_stream,
- ACE_Addr *remote_addr,
- ACE_Time_Value *timeout,
- int restart,
- int reset_new_handle) const
-{
- return this->acceptor_.accept (new_stream, remote_addr, timeout,
- restart, reset_new_handle);
-}
-
-int
-JAWS_IO_Synch_Acceptor::accept (size_t, const void *)
-{
- return -1;
-}
-
-ACE_HANDLE
-JAWS_IO_Synch_Acceptor::get_handle (void)
-{
- return this->acceptor_.get_handle ();
-}
-
-
-
-JAWS_IO_Asynch_Acceptor::JAWS_IO_Asynch_Acceptor (void)
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- : acceptor_ (*(new ACE_Asynch_Acceptor<JAWS_Asynch_Handler>)),
- acceptor_ptr_ (&acceptor_)
-#endif
-{
-}
-
-JAWS_IO_Asynch_Acceptor::~JAWS_IO_Asynch_Acceptor (void)
-{
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- delete this->acceptor_ptr_;
- this->acceptor_ptr_ = 0;
-#endif
-}
-
-int
-JAWS_IO_Asynch_Acceptor::open (const ACE_INET_Addr &address, int backlog)
-{
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- // Tell the acceptor to listen on this->port_, which sets up an
- // asynchronous I/O request to the OS.
-
- return this->acceptor_.open (address,
- JAWS_Data_Block::JAWS_DATA_BLOCK_SIZE,
- 1,
- backlog,
- 1,
- 0,
- 0,
- 0,
- 0);
-
-#else
- ACE_UNUSED_ARG (address);
- ACE_UNUSED_ARG (backlog);
- return -1;
-#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
-}
-
-int
-JAWS_IO_Asynch_Acceptor::open (const ACE_HANDLE &socket)
-{
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- ACE_HANDLE handle = this->handle_;
- if (handle == socket)
- return 0;
-
- if (handle != ACE_INVALID_HANDLE)
- ACE_OS::closesocket (handle);
- this->handle_ = socket;
-
- return 0;
-#else
- ACE_UNUSED_ARG (socket);
- return -1;
-#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
-}
-
-int
-JAWS_IO_Asynch_Acceptor::accept (size_t bytes_to_read, const void *act)
-{
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- return this->acceptor_.accept (bytes_to_read, act);
-#else
- ACE_UNUSED_ARG (bytes_to_read);
- ACE_UNUSED_ARG (act);
- return -1;
-#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
-}
-
-int
-JAWS_IO_Asynch_Acceptor::accept (ACE_SOCK_Stream &, ACE_Addr *,
- ACE_Time_Value *, int, int) const
-{
- return -1;
-}
-
-ACE_HANDLE
-JAWS_IO_Asynch_Acceptor::get_handle (void)
-{
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- return this->acceptor_.get_handle ();
-#else
- return ACE_INVALID_HANDLE;
-#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
-}
-
-
-void
-JAWS_IO_Asynch_Acceptor::close (void)
-{
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- delete this->acceptor_ptr_;
- this->acceptor_ptr_ = 0;
-#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
-}
-
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
-template class ACE_Asynch_Acceptor<JAWS_Asynch_Handler>;
-#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
-template class ACE_Singleton<JAWS_IO_Asynch_Acceptor, ACE_SYNCH_MUTEX>;
-template class ACE_Singleton<JAWS_IO_Synch_Acceptor, ACE_SYNCH_MUTEX>;
-template class ACE_LOCK_SOCK_Acceptor<ACE_SYNCH_MUTEX>;
-template class ACE_LOCK_SOCK_Acceptor<ACE_SYNCH_NULL_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
-#pragma instantiate ACE_Asynch_Acceptor<JAWS_Asynch_Handler>
-#pragma instantiate ACE_Singleton<JAWS_IO_Asynch_Acceptor, ACE_SYNCH_MUTEX>
-#endif /* defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) */
-#pragma instantiate ACE_Singleton<JAWS_IO_Synch_Acceptor, ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_LOCK_SOCK_Acceptor<ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_LOCK_SOCK_Acceptor<ACE_SYNCH_NULL_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/IO_Acceptor.h b/apps/JAWS2/JAWS/IO_Acceptor.h
deleted file mode 100644
index e18bcd55c30..00000000000
--- a/apps/JAWS2/JAWS/IO_Acceptor.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_IO_ACCEPTOR_H
-#define JAWS_IO_ACCEPTOR_H
-
-// Use the Adapter pattern to encapsulate either a LOCK_SOCK_Acceptor or
-// an ACE_Asynch_Acceptor
-
-#include "ace/Asynch_Acceptor.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/LOCK_SOCK_Acceptor.h"
-#include "ace/Singleton.h"
-
-#include "JAWS/Export.h"
-#include "JAWS/IO.h"
-#include "JAWS/IO_Handler.h"
-
-// Forward declaration.
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-class ACE_Proactor;
-class ACE_Reactor;
-ACE_END_VERSIONED_NAMESPACE_DECL
-
-#if defined (JAWS_HAS_THREAD_SAFE_ACCEPT)
-typedef ACE_LOCK_SOCK_Acceptor<ACE_SYNCH_NULL_MUTEX> JAWS_IO_SOCK_Acceptor;
-#else
-typedef ACE_LOCK_SOCK_Acceptor<ACE_SYNCH_MUTEX> JAWS_IO_SOCK_Acceptor;
-#endif /* JAWS_HAS_THREAD_SAFE_ACCEPT */
-
-class JAWS_Export JAWS_IO_Acceptor
-{
-public:
-
- JAWS_IO_Acceptor (void);
- virtual ~JAWS_IO_Acceptor (void);
-
- virtual int open (const ACE_INET_Addr &address, int backlog = 20);
- // Initiate a passive mode socket.
-
- virtual int open (const ACE_HANDLE &socket);
- // Initiate a passive mode socket.
-
- virtual int accept (ACE_SOCK_Stream &new_stream,
- ACE_Addr *remote_addr = 0,
- ACE_Time_Value *timeout = 0,
- int restart = 1,
- int reset_new_handle = 0) const;
- // Synchronously accept the connection
-
- virtual int accept (size_t bytes_to_read = 0, const void *act = 0);
- // This initiates a new asynchronous accept through the AcceptEx call.
-
- virtual ACE_HANDLE get_handle (void);
- // Get the listener's handle
-
- virtual void close (void);
- // Close the acceptor.
-
- enum { ASYNC = 0, SYNCH = 1 };
- // identify if this is being used for asynchronous or synchronous
- // accept calls
-
-};
-
-class JAWS_Export JAWS_IO_Synch_Acceptor : public JAWS_IO_Acceptor
-{
-public:
-
- virtual int open (const ACE_INET_Addr &local_sap, int backlog = 20);
- // Initiate a passive mode socket.
-
- virtual int open (const ACE_HANDLE &socket);
- // Initiate a passive mode socket.
-
- virtual int accept (ACE_SOCK_Stream &new_stream,
- ACE_Addr *remote_addr = 0,
- ACE_Time_Value *timeout = 0,
- int restart = 1,
- int reset_new_handle = 0) const;
- // Accept the connection
-
- virtual ACE_HANDLE get_handle (void);
- // Get the listener's handle
-
-private:
- virtual int accept (size_t bytes_to_read = 0, const void *act = 0);
-
-private:
- JAWS_IO_SOCK_Acceptor acceptor_;
-};
-
-
-class JAWS_Export JAWS_IO_Asynch_Acceptor : public JAWS_IO_Acceptor
-{
-public:
-
- JAWS_IO_Asynch_Acceptor (void);
- virtual ~JAWS_IO_Asynch_Acceptor (void);
-
- virtual int open (const ACE_INET_Addr &address, int backlog = 20);
- // Initiate an asynchronous passive connection
-
- virtual int open (const ACE_HANDLE &socket);
- // Initiate an asynchronous passive connection
-
- virtual int accept (size_t bytes_to_read = 0, const void *act = 0);
- // This initiates a new asynchronous accept through the AcceptEx call.
-
- virtual ACE_HANDLE get_handle (void);
- // Get the listener's handle
-
- virtual void close (void);
-
-private:
-
- virtual int accept (ACE_SOCK_Stream &new_stream,
- ACE_Addr *remote_addr = 0,
- ACE_Time_Value *timeout = 0,
- int restart = 1,
- int reset_new_handle = 0) const;
-
-private:
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- ACE_Asynch_Acceptor<JAWS_Asynch_Handler> &acceptor_;
- ACE_Asynch_Acceptor<JAWS_Asynch_Handler> *acceptor_ptr_;
- ACE_HANDLE handle_;
-#endif /* defined (ACE_WIN32) */
-};
-
-typedef ACE_Singleton<JAWS_IO_Synch_Acceptor, ACE_SYNCH_MUTEX>
- JAWS_IO_Synch_Acceptor_Singleton;
-
-typedef ACE_Singleton<JAWS_IO_Asynch_Acceptor, ACE_SYNCH_MUTEX>
- JAWS_IO_Asynch_Acceptor_Singleton;
-
-#endif /* !defined (JAWS_IO_ACCEPTOR_H) */
diff --git a/apps/JAWS2/JAWS/IO_Handler.cpp b/apps/JAWS2/JAWS/IO_Handler.cpp
deleted file mode 100644
index 595885c3686..00000000000
--- a/apps/JAWS2/JAWS/IO_Handler.cpp
+++ /dev/null
@@ -1,511 +0,0 @@
-// $Id$
-
-#include "ace/Proactor.h"
-#include "ace/Filecache.h"
-#include "ace/OS_NS_unistd.h"
-
-#include "JAWS/JAWS.h"
-#include "JAWS/IO.h"
-#include "JAWS/IO_Handler.h"
-#include "JAWS/IO_Acceptor.h"
-#include "JAWS/Data_Block.h"
-#include "JAWS/Policy.h"
-#include "JAWS/Waiter.h"
-#include "JAWS/Filecache.h"
-
-ACE_RCSID(JAWS, IO_Handler, "$Id$")
-
-JAWS_Abstract_IO_Handler::~JAWS_Abstract_IO_Handler (void)
-{
-}
-
-JAWS_IO_Handler_Factory::~JAWS_IO_Handler_Factory (void)
-{
-}
-
-JAWS_IO_Handler *
-JAWS_IO_Handler_Factory::create_io_handler (void)
-{
- JAWS_TRACE ("JAWS_IO_Handler_Factory::create");
-
- JAWS_IO_Handler *handler;
- handler = new JAWS_IO_Handler (this);
-
- return handler;
-}
-
-void
-JAWS_IO_Handler_Factory::destroy_io_handler (JAWS_IO_Handler *handler)
-{
- JAWS_TRACE ("JAWS_IO_Handler_Factory::destroy");
- if (handler != 0)
- {
- delete handler->message_block ();
- delete handler;
- }
-}
-
-JAWS_IO_Handler::JAWS_IO_Handler (JAWS_IO_Handler_Factory *factory)
- : status_ (0),
- mb_ (0),
- handle_ (ACE_INVALID_HANDLE),
- task_ (0),
- factory_ (factory)
-{
-}
-
-JAWS_IO_Handler::~JAWS_IO_Handler (void)
-{
- this->mb_ = 0;
- this->status_ = 0;
- this->task_ = 0;
- this->factory_ = 0;
-
- ACE_OS::close (this->handle_);
- this->handle_ = ACE_INVALID_HANDLE;
-}
-
-void
-JAWS_IO_Handler::accept_complete (ACE_HANDLE handle)
-{
- // callback into pipeline task, notify that the accept has completed
- this->handle_ = handle;
- this->status_ |= ACCEPT_OK;
- this->status_ &= (ACCEPT_OK+1);
-
- JAWS_Dispatch_Policy *policy = this->mb_->policy ();
-
- // Do this so that Thread Per Request can spawn a new thread
- policy->concurrency ()->activate_hook ();
-}
-
-void
-JAWS_IO_Handler::accept_error (void)
-{
- // callback into pipeline task, notify that the accept has failed
- this->status_ |= ACCEPT_ERROR;
- this->status_ &= (ACCEPT_ERROR+1);
-}
-
-void
-JAWS_IO_Handler::read_complete (ACE_Message_Block *data)
-{
- ACE_UNUSED_ARG (data);
- // We can call back into the pipeline task at this point
- // this->pipeline_->read_complete (data);
- this->status_ |= READ_OK;
- this->status_ &= (READ_OK+1);
-}
-
-void
-JAWS_IO_Handler::read_error (void)
-{
- // this->pipeline_->read_error ();
- this->status_ |= READ_ERROR;
- this->status_ &= (READ_ERROR+1);
-}
-
-void
-JAWS_IO_Handler::transmit_file_complete (void)
-{
- JAWS_TRACE ("JAWS_IO_Handler::transmit_file_complete");
- // this->pipeline_->transmit_file_complete ();
- this->status_ |= TRANSMIT_OK;
- this->status_ &= (TRANSMIT_OK+1);
-}
-
-void
-JAWS_IO_Handler::transmit_file_error (int result)
-{
- JAWS_TRACE ("JAWS_IO_Handler::transmit_file_error");
- ACE_UNUSED_ARG (result);
- // this->pipeline_->transmit_file_complete (result);
- this->status_ |= TRANSMIT_ERROR;
- this->status_ &= (TRANSMIT_ERROR+1);
-}
-
-void
-JAWS_IO_Handler::receive_file_complete (void)
-{
- this->status_ |= RECEIVE_OK;
- this->status_ &= (RECEIVE_OK+1);
-}
-
-void
-JAWS_IO_Handler::receive_file_error (int result)
-{
- ACE_UNUSED_ARG(result);
- this->status_ |= RECEIVE_ERROR;
- this->status_ &= (RECEIVE_ERROR+1);
-}
-
-void
-JAWS_IO_Handler::write_error (void)
-{
- ACE_DEBUG ((LM_DEBUG, " (%t) error in writing response\n"));
-
- this->status_ |= WRITE_ERROR;
- this->status_ &= (WRITE_ERROR+1);
- this->done ();
-}
-
-void
-JAWS_IO_Handler::confirmation_message_complete (void)
-{
- this->status_ |= WRITE_OK;
- this->status_ &= (WRITE_OK+1);
-}
-
-void
-JAWS_IO_Handler::error_message_complete (void)
-{
- this->status_ |= WRITE_OK;
- this->status_ &= (WRITE_OK+1);
-}
-
-JAWS_IO_Handler_Factory *
-JAWS_IO_Handler::factory (void)
-{
- return this->factory_;
-}
-
-ACE_HANDLE
-JAWS_IO_Handler::handle (void) const
-{
- return this->handle_;
-}
-
-void
-JAWS_IO_Handler::task (JAWS_Pipeline_Handler *ph)
-{
- this->task_ = ph;
-}
-
-JAWS_Pipeline_Handler *
-JAWS_IO_Handler::task (void)
-{
- return this->task_;
-}
-
-void
-JAWS_IO_Handler::message_block (JAWS_Data_Block *mb)
-{
- this->mb_ = mb;
-}
-
-JAWS_Data_Block *
-JAWS_IO_Handler::message_block (void)
-{
- return this->mb_;
-}
-
-void
-JAWS_IO_Handler::done (void)
-{
- this->factory ()->destroy_io_handler (this);
-}
-
-int
-JAWS_IO_Handler::status (void)
-{
- return this->status_;
-}
-
-void
-JAWS_IO_Handler::idle (void)
-{
- this->status_ &= (IDLE+1);
-}
-
-void
-JAWS_IO_Handler::acquire (void)
-{
-}
-
-void
-JAWS_IO_Handler::lock (void)
-{
-}
-
-void
-JAWS_IO_Handler::release (void)
-{
-}
-
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
-
-JAWS_Asynch_IO_Handler_Factory::~JAWS_Asynch_IO_Handler_Factory (void)
-{
-}
-
-JAWS_IO_Handler *
-JAWS_Asynch_IO_Handler_Factory::create_io_handler (void)
-{
- JAWS_TRACE ("JAWS_Asynch_IO_Handler_Factory::create");
-
- JAWS_Asynch_IO_Handler *handler = 0;
- handler = new JAWS_Asynch_IO_Handler (this);
-
- return handler;
-}
-
-void
-JAWS_Asynch_IO_Handler_Factory::destroy_io_handler (JAWS_IO_Handler *handler)
-{
- JAWS_TRACE ("JAWS_IO_Handler_Factory::destroy");
-
- if (handler != 0)
- {
- //cerr << "(" << thr_self () << ") locking for destruction: " << handler << endl;
- handler->lock ();
- delete handler->message_block ();
- handler->message_block (0);
- delete handler;
- }
-}
-
-
-JAWS_Asynch_IO_Handler::JAWS_Asynch_IO_Handler (JAWS_Asynch_IO_Handler_Factory *factory)
- : JAWS_IO_Handler (factory),
- handler_ (0)
-{
- this->status_ = 1;
-}
-
-JAWS_Asynch_IO_Handler::~JAWS_Asynch_IO_Handler (void)
-{
- delete this->handler_;
- this->handler_ = 0;
-}
-
-ACE_Handler *
-JAWS_Asynch_IO_Handler::handler (void)
-{
- return this->handler_;
-}
-
-void
-JAWS_Asynch_IO_Handler::acquire (void)
-{
- //cerr << "(" << thr_self () << ") acquire handler: " << this << endl;
- this->count_.acquire_read ();
-}
-
-void
-JAWS_Asynch_IO_Handler::lock (void)
-{
- //cerr << "(" << thr_self () << ") locking handler: " << this << endl;
- this->count_.acquire_write ();
-}
-
-void
-JAWS_Asynch_IO_Handler::release (void)
-{
- //cerr << "(" << thr_self () << ") release handler: " << this << endl;
- this->count_.release ();
-}
-
-JAWS_Asynch_Handler::JAWS_Asynch_Handler (void)
- : ioh_ (0)
-{
- this->proactor (ACE_Proactor::instance ());
-}
-
-JAWS_Asynch_Handler::~JAWS_Asynch_Handler (void)
-{
-}
-
-void
-JAWS_Asynch_Handler::open (ACE_HANDLE h,
- ACE_Message_Block &mb)
-{
- JAWS_TRACE ("JAWS_Asynch_Handler::open");
-
- // This currently does nothing, but just in case.
- ACE_Service_Handler::open (h, mb);
-
- // ioh_ set from the ACT hopefully
- //this->dispatch_handler ();
-
-#if !defined (ACE_WIN32)
- // Assume at this point there is no data.
- mb.rd_ptr (mb.wr_ptr ());
- mb.crunch ();
-#else
- // AcceptEx reads some initial data from the socket.
- this->handler ()->message_block ()->copy (mb.rd_ptr (), mb.length ());
-#endif
-
- ACE_Asynch_Accept_Result_Impl *fake_result
- = ACE_Proactor::instance ()->create_asynch_accept_result
- (this->proxy (), JAWS_IO_Asynch_Acceptor_Singleton::instance ()->get_handle (),
- h, mb, JAWS_Data_Block::JAWS_DATA_BLOCK_SIZE,
- this->ioh_, ACE_INVALID_HANDLE, 0);
-
- this->handler ()->handler_ = this;
-
- fake_result->complete (0, 1, 0);
-}
-
-void
-JAWS_Asynch_Handler::act (const void *act_ref)
-{
- JAWS_TRACE ("JAWS_Asynch_Handler::act");
-
- // Set the ioh from the act
- this->ioh_ = (JAWS_Asynch_IO_Handler *) act_ref;
-}
-
-#if 0
-ACE_HANDLE
-JAWS_Asynch_Handler::handle (void) const
-{
- return this->ioh_->handle ();
-}
-#endif
-
-void
-JAWS_Asynch_Handler::dispatch_handler (void)
-{
-#if 0
- // A future version of ACE will support this.
- ACE_Thread_ID tid = ACE_OS::thr_self ();
-#else
- // Do it this way for now
- ACE_thread_t thr_name;
- thr_name = ACE_OS::thr_self ();
-
- JAWS_Thread_ID tid (thr_name);
-#endif /* 0 */
-
- JAWS_IO_Handler **iohref = JAWS_Waiter_Singleton::instance ()->find (tid);
-
- *iohref = this->handler ();
-}
-
-void
-JAWS_Asynch_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result
- &result)
-{
- JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream");
-
- this->dispatch_handler ();
-
- if (result.act () != 0)
- {
- // This callback is for io->receive_file()
- JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream (recv_file)");
-
- int code = 0;
- if (result.success () && result.bytes_transferred () != 0)
- {
- if (result.message_block ().length ()
- == result.message_block ().size ())
- code = ACE_Filecache_Handle::ACE_SUCCESS;
- else
- {
- ACE_Asynch_Read_Stream ar;
- if (ar.open (*this, this->handler ()->handle ()) == -1
- || ar.read (result.message_block (),
- result.message_block ().size ()
- - result.message_block ().length (),
- result.act ()) == -1)
- code = -1;
- else
- return;
- }
- }
- else
- code = -1;
-
- if (code == ACE_Filecache_Handle::ACE_SUCCESS)
- this->handler ()->receive_file_complete ();
- else
- this->handler ()->receive_file_error (code);
-
- result.message_block ().release ();
- delete (ACE_Filecache_Handle *) result.act ();
- }
- else
- {
- // This callback is for this->read()
- JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream (read)");
-
- if (result.success ()
- && result.bytes_transferred () != 0)
- this->handler ()->read_complete (&result.message_block ());
- else
- this->handler ()->read_error ();
- }
-}
-
-void
-JAWS_Asynch_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result
- &result)
-{
- this->dispatch_handler ();
-
- result.message_block ().release ();
-
- if (result.act () == (void *) JAWS_Asynch_IO::CONFIRMATION)
- this->handler ()->confirmation_message_complete ();
- else
- this->handler ()->error_message_complete ();
-}
-
-void
-JAWS_Asynch_Handler::handle_transmit_file (const
- ACE_Asynch_Transmit_File::Result
- &result)
-{
- this->dispatch_handler ();
-
- if (result.success ())
- this->handler ()->transmit_file_complete ();
- else
- this->handler ()->transmit_file_error (-1);
-
- result.header_and_trailer ()->header ()->release ();
- result.header_and_trailer ()->trailer ()->release ();
- delete result.header_and_trailer ();
- delete (JAWS_Cached_FILE *) result.act ();
-}
-
-void
-JAWS_Asynch_Handler::handle_accept (const ACE_Asynch_Accept::Result &result)
-{
- JAWS_TRACE ("JAWS_Asynch_Handler::handle_accept");
- this->dispatch_handler ();
-
- if (result.success ())
- {
- JAWS_TRACE ("JAWS_Asynch_Handler::handle_accept, success");
- this->handler ()->accept_complete (result.accept_handle ());
- }
- else
- this->handler ()->accept_error ();
-
-}
-
-void
-JAWS_Asynch_Handler::handler (JAWS_Asynch_IO_Handler *ioh)
-{
- this->ioh_ = ioh;
-}
-
-JAWS_Asynch_IO_Handler *
-JAWS_Asynch_Handler::handler (void)
-{
- return this->ioh_;
-}
-
-#endif /* ACE_WIN32 */
-
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Singleton<JAWS_Synch_IO_Handler_Factory, ACE_SYNCH_MUTEX>;
-template class ACE_Singleton<JAWS_Asynch_IO_Handler_Factory, ACE_SYNCH_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Singleton<JAWS_Synch_IO_Handler_Factory, ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_Singleton<JAWS_Asynch_IO_Handler_Factory, ACE_SYNCH_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/IO_Handler.h b/apps/JAWS2/JAWS/IO_Handler.h
deleted file mode 100644
index 7420a8825c8..00000000000
--- a/apps/JAWS2/JAWS/IO_Handler.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/* -*- c++ -*- */
-// Hey, Emacs! This is a C++ file!
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// jaws
-//
-// = FILENAME
-// IO.h
-//
-// = AUTHOR
-// James Hu
-//
-// ============================================================================
-
-#ifndef JAWS_IO_HANDLER_H
-#define JAWS_IO_HANDLER_H
-
-#include "ace/Asynch_IO.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Singleton.h"
-#include "ace/Synch_Traits.h"
-#include "ace/RW_Thread_Mutex.h"
-
-#include "JAWS/Export.h"
-
-// #include "JAWS/IO.h"
-class JAWS_IO;
-class JAWS_Synch_IO;
-class JAWS_Asynch_IO;
-class JAWS_IO_Handler;
-class JAWS_IO_Handler_Factory;
-class JAWS_Data_Block;
-class JAWS_Pipeline_Handler;
-class JAWS_Waiter;
-
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-class ACE_Message_Block;
-ACE_END_VERSIONED_NAMESPACE_DECL
-
-class JAWS_Export JAWS_Abstract_IO_Handler
- // = TITLE
- //
- // This class defines the abstract interface for an I/O handler
- // class in the context of Web-likes servers
- //
- // = DESCRIPTION
-{
-public:
- virtual ~JAWS_Abstract_IO_Handler (void);
-
- virtual void task (JAWS_Pipeline_Handler *ph) = 0;
- virtual JAWS_Pipeline_Handler *task (void) = 0;
-
- virtual void message_block (JAWS_Data_Block *mb) = 0;
- virtual JAWS_Data_Block *message_block (void) = 0;
-
- virtual void accept_complete (ACE_HANDLE handle) = 0;
- // This method is called by the IO class when new passive connection has
- // been established.
-
- virtual void accept_error (void) = 0;
- // This method is called by the IO class when new passive connection has
- // been established.
-
-#if 0
- virtual void connect_complete (ACE_Message_Block *) = 0;
- // This method is called by the IO class when new active connection has
- // been established.
-
- virtual void connect_error (ACE_Message_Block *) = 0;
- // This method is called by the IO class when new active connection has
- // been established.
-#endif
-
- virtual void read_complete (ACE_Message_Block *data) = 0;
- // This method is called by the IO class when new client data shows
- // up.
-
- virtual void read_error (void) = 0;
- // This method is called by the IO class when there was an error in
- // reading new data from the client.
-
- virtual void transmit_file_complete (void) = 0;
- // This method is called by the IO class when the requested file has
- // been successfully transmitted to the client.
-
- virtual void transmit_file_error (int result) = 0;
- // This method is called by the IO class when there was an error in
- // transmitting the requested file to the client.
-
- virtual void receive_file_complete (void) = 0;
- // This method is called by the IO class when the requested file has
- // been successfully received from the client.
-
- virtual void receive_file_error (int result) = 0;
- // This method is called by the IO class when there was an error in
- // receiving the requested file from the client.
-
- virtual void write_error (void) = 0;
- // This method is called by the IO class when there was an error in
- // writing data to the client.
-
- virtual void confirmation_message_complete (void) = 0;
- // This method is called by the IO class when the confirmation
- // message has been delivered to the client.
-
- virtual void error_message_complete (void) = 0;
- // This method is called by the IO class when the error message has
- // been delivered to the client.
-
- virtual JAWS_IO_Handler_Factory *factory (void) = 0;
- // Returns the factory for this IO handler
-
- virtual ACE_HANDLE handle (void) const = 0;
- // Returns the socket handle for this handler
-
- virtual void done (void) = 0;
- // Cleans up the handler.
-
- virtual int status (void) = 0;
- // Returns the status of the handler
-
- virtual void idle (void) = 0;
- // puts handler in an idle state
-
- enum { IDLE = 0, IDLE_A = 1,
- ACCEPT_OK = 2, ACCEPT_OK_A = 3,
- ACCEPT_ERROR = 4, ACCEPT_ERROR_A = 5,
- READ_OK = 6, READ_OK_A = 7,
- READ_ERROR = 8, READ_ERROR_A = 9,
- WRITE_OK = 10, WRITE_OK_A = 11,
- WRITE_ERROR = 12, WRITE_ERROR_A = 13,
- TRANSMIT_OK = 14, TRANSMIT_OK_A = 15,
- TRANSMIT_ERROR = 16, TRANSMIT_ERROR_A = 17,
- RECEIVE_OK = 18, RECEIVE_OK_A = 19,
- RECEIVE_ERROR = 20, RECEIVE_ERROR_A = 21 };
- // The different states of the handler
-
-};
-
-#if defined(ACE_WIN32) || defined(ACE_HAS_AIO_CALLS)
-
-// Forward reference.
-class JAWS_Asynch_IO_Handler;
-
-class JAWS_Export JAWS_Asynch_Handler : public ACE_Service_Handler
-{
-public:
- JAWS_Asynch_Handler (void);
- virtual ~JAWS_Asynch_Handler (void);
-
- virtual void handle_read_stream (const ACE_Asynch_Read_Stream::Result
- &result);
- // This method will be called when an asynchronous read completes on
- // a stream.
-
- virtual void handle_write_stream (const ACE_Asynch_Write_Stream::Result
- &result);
- // This method will be called when an asynchronous write completes
- // on a stream.
-
- virtual void handle_transmit_file (const ACE_Asynch_Transmit_File::Result
- &result);
- // This method will be called when an asynchronous transmit file
- // completes.
-
- virtual void handle_accept (const ACE_Asynch_Accept::Result &result);
- // This method will be called when an asynchronous accept completes.
-
- virtual void handler (JAWS_Asynch_IO_Handler *ioh);
- virtual JAWS_Asynch_IO_Handler * handler (void);
-
- virtual void dispatch_handler (void);
-
- virtual void open (ACE_HANDLE h, ACE_Message_Block &mb);
- // Call back entry point for ACE_Asynch_Acceptor
-
- virtual void act (const void *act_ref);
- // Receives the ACT.
-
- //virtual ACE_HANDLE handle (void) const;
-
-private:
- JAWS_Asynch_IO_Handler *ioh_;
-};
-#endif /* defined(ACE_WIN32) || defined(ACE_HAS_AIO_CALLS) */
-
-
-class JAWS_Export JAWS_IO_Handler : public JAWS_Abstract_IO_Handler
-{
-public:
- JAWS_IO_Handler (JAWS_IO_Handler_Factory *factory);
- virtual ~JAWS_IO_Handler (void);
-
- // Inherited from JAWS_IO_Handler
-
- virtual void accept_complete (ACE_HANDLE handle);
- virtual void accept_error (void);
- virtual void read_complete (ACE_Message_Block *data);
- virtual void read_error (void);
- virtual void transmit_file_complete (void);
- virtual void transmit_file_error (int result);
- virtual void receive_file_complete (void);
- virtual void receive_file_error (int result);
- virtual void write_error (void);
- virtual void confirmation_message_complete (void);
- virtual void error_message_complete (void);
-
- virtual JAWS_IO_Handler_Factory *factory (void);
- virtual ACE_HANDLE handle (void) const;
-
- virtual void done (void);
- virtual int status (void);
- virtual void idle (void);
-
- virtual void acquire (void);
- virtual void lock (void);
- virtual void release (void);
-
- virtual void task (JAWS_Pipeline_Handler *ph);
- virtual JAWS_Pipeline_Handler *task (void);
-
- virtual void message_block (JAWS_Data_Block *mb);
- virtual JAWS_Data_Block *message_block (void);
-
-protected:
- int status_;
- // The state of the handler.
-
- JAWS_Data_Block *mb_;
- // This maintains the state of the request.
-
- ACE_HANDLE handle_;
- // The socket handle returned from accept.
-
- JAWS_Pipeline_Handler *task_;
- // This is a reference to the next stage of the pipeline when the IO
- // request completes.
-
- JAWS_IO_Handler_Factory *factory_;
- // The reference to the handler's factory.
-};
-
-class JAWS_Export JAWS_IO_Handler_Factory
-{
-public:
- virtual ~JAWS_IO_Handler_Factory (void);
- // Destructor
-
- virtual JAWS_IO_Handler *create_io_handler (void);
- // This creates a new JAWS_IO_Handler
-
- virtual void destroy_io_handler (JAWS_IO_Handler *handler);
- // This deletes a JAWS_IO_Handler
-};
-
-typedef JAWS_IO_Handler JAWS_Synch_IO_Handler;
-typedef JAWS_IO_Handler_Factory JAWS_Synch_IO_Handler_Factory;
-
-typedef ACE_Singleton<JAWS_Synch_IO_Handler_Factory, ACE_SYNCH_MUTEX>
- JAWS_Synch_IO_Handler_Factory_Singleton;
-
-#if defined(ACE_WIN32) || defined(ACE_HAS_AIO_CALLS)
-
-class JAWS_Export JAWS_Asynch_IO_Handler_Factory : public JAWS_IO_Handler_Factory
-{
-public:
- virtual ~JAWS_Asynch_IO_Handler_Factory (void);
- // Destructor
-
- virtual JAWS_IO_Handler *create_io_handler (void);
- // This creates a new JAWS_IO_Handler
-
- virtual void destroy_io_handler (JAWS_IO_Handler *handler);
- // This deletes a JAWS_IO_Handler
-};
-
-class JAWS_Export JAWS_Asynch_IO_Handler : public JAWS_IO_Handler
-{
-friend class JAWS_Asynch_Handler;
-friend class JAWS_Asynch_IO_Handler_Factory;
-friend class JAWS_Waiter;
-
- // Provide implementations for the common functions.
-public:
- explicit JAWS_Asynch_IO_Handler (JAWS_Asynch_IO_Handler_Factory *factory);
- virtual ~JAWS_Asynch_IO_Handler (void);
-
- virtual ACE_Handler *handler (void);
-
- virtual void acquire (void);
- virtual void lock (void);
- virtual void release (void);
-
-protected:
-
- JAWS_Asynch_Handler *handler_;
- ACE_SYNCH_RW_MUTEX count_;
-};
-
-#else
-
-typedef JAWS_IO_Handler JAWS_Asynch_IO_Handler;
-typedef JAWS_IO_Handler_Factory JAWS_Asynch_IO_Handler_Factory;
-
-#endif /* defined(ACE_WIN32) || defined(ACE_HAS_AIO_CALLS) */
-
-typedef ACE_Singleton<JAWS_Asynch_IO_Handler_Factory, ACE_SYNCH_MUTEX>
- JAWS_Asynch_IO_Handler_Factory_Singleton;
-
-#endif /* JAWS_IO_HANDLER_H */
diff --git a/apps/JAWS2/JAWS/JAWS.h b/apps/JAWS2/JAWS/JAWS.h
deleted file mode 100644
index 3078ea3a8af..00000000000
--- a/apps/JAWS2/JAWS/JAWS.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// $Id$
-
-#if defined (JAWS_NTRACE) && (JAWS_NTRACE == 1)
-# define JAWS_TRACE(X)
-#else
-# define JAWS_TRACE(X) ACE_Trace ____ (ACE_TEXT (X), \
- __LINE__, \
- ACE_TEXT (__FILE__))
-#include "ace/Trace.h"
-#endif /* JAWS_NTRACE */
-
-#ifndef JAWS_JAWS_H
-#define JAWS_JAWS_H
-
-#endif /* JAWS_JAWS_H */
diff --git a/apps/JAWS2/JAWS/Parse_Headers.cpp b/apps/JAWS2/JAWS/Parse_Headers.cpp
deleted file mode 100644
index fdf240dbcd7..00000000000
--- a/apps/JAWS2/JAWS/Parse_Headers.cpp
+++ /dev/null
@@ -1,443 +0,0 @@
-// $Id$
-
-#include "JAWS/Parse_Headers.h"
-#include "ace/OS_NS_string.h"
-#include "ace/Log_Msg.h"
-
-#define ACCESSOR(T,C,x) \
-T C :: x (void) const { return this-> x##_; }\
-void C :: x (T t) { this-> x##_ = t; }
-
-int
-JAWS_Parse_Headers::parse_headers (JAWS_Header_Info *info,
- ACE_Message_Block &mb)
-{
- for (;;)
- {
- if (mb.rd_ptr () == mb.wr_ptr ())
- break;
-
- char *p = mb.rd_ptr ();
-
- if (info->end_of_line ()
- && (*p != ' ' && *p != '\t'))
- {
- int r = this->parse_header_name (info, mb);
- if (r == 1)
- return info->end_of_headers ();
- continue;
- }
- else
- {
- int r = this->parse_header_value (info, mb);
- if (r == 1)
- {
- if (info->end_of_headers ())
- return 1;
- break;
- }
- continue;
- }
- }
-
- // If we arrive here, it means either there is nothing more to read,
- // or parse_header_value ran into difficulties (like maybe the
- // header value was too long).
-
- if (mb.rd_ptr () != mb.base ())
- {
- mb.crunch ();
- return 0;
- }
- else if (mb.length () < mb.size ())
- {
- return 0;
- }
- else if (mb.length () == mb.size ())
- {
- // This is one of those cases that should rarely ever happen.
- // If we get here, the header type name is over 8K long. We
- // flag this as a bad thing.
-
- // In HTTP/1.1, I have to remember that a bad request means the
- // connection needs to be closed and the client has to
- // reinitiate the connection.
-
- info->status (JAWS_Header_Info::STATUS_CODE_TOO_LONG);
- return 1;
- }
- else if (mb.length () > mb.size ())
- {
- ACE_DEBUG ((LM_DEBUG, "JAWS_Parse_Headers: buffer overrun!!\n"));
- info->status (JAWS_Header_Info::STATUS_CODE_TOO_LONG);
- return 1;
- }
-
- ACE_DEBUG ((LM_DEBUG, "JAWS_Parse_Headers -- shouldn't be here!\n"));
- return 1;
-}
-
-char *
-JAWS_Parse_Headers::skipset (const char *set, char *start, char *end)
-{
- char *p = start;
- while (p < end)
- {
- if (ACE_OS::strchr (set, *p) != NULL)
- break;
- p++;
- }
- return p;
-}
-
-char *
-JAWS_Parse_Headers::skipcset (const char *set, char *start, char *end)
-{
- char *p = start;
- while (p < end)
- {
- if (ACE_OS::strchr (set, *p) == NULL)
- break;
- p++;
- }
- return p;
-}
-
-int
-JAWS_Parse_Headers::parse_header_name (JAWS_Header_Info *info,
- ACE_Message_Block &mb)
-{
- char *p = mb.rd_ptr ();
- char *q;
-
- q = this->skipset (":\n", p, mb.wr_ptr ());
- if (q == mb.wr_ptr ())
- {
- // no more progress can be made until we find a ':'
- return 1;
- }
- if (*q != '\n' && q == p)
- {
- // Ignore empty header type names
- info->finish_last_header_value ();
- info->create_next_header_value (0);
- info->end_of_line (0);
- mb.rd_ptr (q+1);
- return 0;
- }
- if (*q == '\n')
- {
- // ignore this line
- mb.rd_ptr (q+1);
- if (q == p || ((q-1) == p && q[-1] == '\r'))
- {
- // blank line means end of headers
- info->finish_last_header_value ();
- info->create_next_header_value (0);
- info->end_of_headers (1);
- if (mb.rd_ptr () == mb.wr_ptr ())
- mb.crunch ();
- return 1;
- }
-
- // not a blank line, but no ':', so ignore it
- info->finish_last_header_value ();
- info->create_next_header_value (0);
- return 0;
- }
-
- // otherwise, we have a header type name!
- *q = '\0';
- info->create_next_header_value (p);
- info->end_of_line (0);
-
- mb.rd_ptr (q+1);
- return 0;
-}
-
-int
-JAWS_Parse_Headers::parse_header_value (JAWS_Header_Info *info,
- ACE_Message_Block &mb)
-{
- // break --> return 1;
- // continue --> return 0;
-
- char *q = mb.rd_ptr ();
-
- if (info->last_header_data () == 0)
- {
- // Ignoring this header (it is too long or something).
-
- q = this->skipset ("\n", mb.rd_ptr (), mb.wr_ptr ());
- if (q == mb.wr_ptr ())
- {
- info->end_of_line (0);
- mb.rd_ptr (q);
-
- // Move the rd_ptr back one character if the last thing we
- // see is a carriage return. Assert: wr_ptr > rd_ptr.
- if (q[-1] == '\r')
- mb.rd_ptr (q-1);
-
- return 1;
- }
-
- if (*q == '\0')
- {
- // We are in the middle of binary data. Get out!
- mb.rd_ptr (q);
- info->end_of_line (1);
- info->end_of_headers (1);
- return 1;
- }
-
- // Move past the newline, set the end of line flag
- if (*q == '\n')
- {
- info->end_of_line (1);
- q++;
- }
- mb.rd_ptr (q);
-
- return 0;
- }
- else
- {
- if (info->end_of_line ())
- {
- // Skip over leading linear white space
- q = this->skipcset (" \t", mb.rd_ptr (), mb.wr_ptr ());
- if (q == mb.wr_ptr ())
- {
- // need more input
- info->end_of_line (1);
- mb.rd_ptr (q-1);
- return 1;
- }
-
- if (*q != '\n')
- info->append_last_header_value (' ');
- }
-
- // Append to last header value character by character
- while (q < mb.wr_ptr ())
- {
- if (*q == '\n')
- break;
- info->append_last_header_value (*q);
- q++;
- }
-
- // Need more input
- if (q == mb.wr_ptr ())
- {
- mb.rd_ptr (q);
- info->end_of_line (0);
- return 1;
- }
-
- // Reached a newline
- if (*q == '\n')
- {
- // Reduce by one character if line discipline is "\r\n"
- if (info->append_last_header_value () == '\r')
- info->reduce_last_header_value ();
-
- // Move past newline, set end of line flag
- mb.rd_ptr (q+1);
- info->end_of_line (1);
-
- return 0;
- }
- }
-
- // NOT REACHED
- return 1;
-}
-
-
-JAWS_Header_Info::JAWS_Header_Info (void)
- : end_of_headers_ (0),
- end_of_line_ (1),
- last_header_data_ (0),
- last_header_length_ (0),
- status_ (0)
-{
-}
-
-JAWS_Header_Info::~JAWS_Header_Info (void)
-{
- JAWS_Header_Table_Iterator iter (this->table_);
- JAWS_Header_Data *data_ptr;
-
- for (iter.first (); !iter.done (); iter.advance ())
- {
- data_ptr = iter.next ();
- if (data_ptr)
- delete data_ptr;
- }
-}
-
-void
-JAWS_Header_Info::dump (void)
-{
- JAWS_Header_Table_Iterator iter (this->table_);
-
- ACE_DEBUG ((LM_DEBUG, "== BEGIN HEADER INFO DUMP ==\n"));
- for (iter.first (); ! iter.done (); iter.advance ())
- {
- JAWS_Header_Data *data;
- data = iter.next ();
- if (data != 0)
- ACE_DEBUG ((LM_DEBUG,
- "%s -- %s\n",
- data->header_name (), data->header_value ()));
- else
- ACE_DEBUG ((LM_DEBUG, "NULL ENTRY\n"));
- }
- ACE_DEBUG ((LM_DEBUG, "== END HEADER INFO DUMP ==\n"));
-}
-
-JAWS_Headers *
-JAWS_Header_Info::table (void)
-{
- return &(this->table_);
-}
-
-void
-JAWS_Header_Info::append_last_header_value (char c)
-{
- if (this->last_header_data_ == 0)
- return;
-
- if (this->last_header_length_ == 0 && (c == ' ' || c == '\t'))
- return;
-
- if (this->last_header_length_ < MAX_HEADER_LENGTH-1)
- {
- this->header_buf_[this->last_header_length_] = c;
- this->last_header_length_++;
- this->header_buf_[this->last_header_length_] = '\0';
- }
-
-}
-
-int
-JAWS_Header_Info::append_last_header_value (void)
-{
- if (this->last_header_data_ == 0 || this->last_header_length_ == 0)
- return -1;
-
- return this->header_buf_[this->last_header_length_-1];
-}
-
-void
-JAWS_Header_Info::append_last_header_value (const char *begin, const char *end)
-{
- if (this->last_header_data_ == 0)
- return;
-
- while (this->last_header_length_ < MAX_HEADER_LENGTH-1)
- {
- if (begin == end)
- break;
-
- this->header_buf_[this->last_header_length_] = *begin;
- this->last_header_length_++;
- begin++;
- }
-
- this->header_buf_[this->last_header_length_] = '\0';
-}
-
-void
-JAWS_Header_Info::reduce_last_header_value (void)
-{
- if (this->last_header_data_ == 0) return;
-
- if (this->last_header_length_ > 0)
- {
- this->last_header_length_--;
- this->header_buf_[this->last_header_length_] = '\0';
- }
-}
-
-void
-JAWS_Header_Info::create_next_header_value (char *ht)
-{
- if (ht == 0)
- {
- // discard last header data
-
- delete this->last_header_data_;
- this->last_header_data_ = 0;
- this->last_header_length (0);
- return;
- }
-
- this->finish_last_header_value ();
-
- if (this->status () == JAWS_Header_Info::STATUS_CODE_OK)
- {
- // create a new last_header_data_ node
-
- this->last_header_data_ = new JAWS_Header_Data (ht, 0);
- // The above performs a strdup.
-
- if (this->last_header_data_ == 0 || this->last_header_name () == 0)
- {
- this->status (JAWS_Header_Info::STATUS_CODE_NO_MEMORY);
- delete this->last_header_data_;
- this->last_header_data_ = 0;
- }
- this->last_header_length (0);
- this->header_buf_[0] = '\0';
- }
-}
-
-void
-JAWS_Header_Info::finish_last_header_value (void)
-{
- if (this->last_header_data_ != 0)
- {
- // prepare to insert last header data into the table.
-
- this->last_header_data_->header_value (this->header_buf ());
- // The above performs a strdup.
-
- if (this->status () == JAWS_Header_Info::STATUS_CODE_OK)
- this->table_.insert (this->last_header_data_);
- else
- delete this->last_header_data_;
- this->last_header_data_ = 0;
- }
-}
-
-char *
-JAWS_Header_Info::header_buf (void)
-{
- return this->header_buf_;
-}
-
-const char *
-JAWS_Header_Info::last_header_name (void) const
-{
- return this->last_header_data_ ? this->last_header_data_->header_name () : 0;
-}
-
-const JAWS_Header_Data *
-JAWS_Header_Info::last_header_data (void) const
-{
- return this->last_header_data_;
-}
-
-ACCESSOR(int,JAWS_Header_Info,last_header_length)
-ACCESSOR(int,JAWS_Header_Info,end_of_line)
-ACCESSOR(int,JAWS_Header_Info,end_of_headers)
-ACCESSOR(int,JAWS_Header_Info,status)
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
- template class ACE_Singleton<JAWS_Parse_Headers, ACE_SYNCH_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-# pragma instantiate ACE_Singleton<JAWS_Parse_Headers, ACE_SYNCH_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/Parse_Headers.h b/apps/JAWS2/JAWS/Parse_Headers.h
deleted file mode 100644
index 89238136fa4..00000000000
--- a/apps/JAWS2/JAWS/Parse_Headers.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_PARSE_HEADERS_H
-#define JAWS_PARSE_HEADERS_H
-
-#include "JAWS/Export.h"
-#include "ace/Singleton.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Message_Block.h"
-#include "ace/Synch_Traits.h"
-
-#include "Headers.h"
-
-class JAWS_Export JAWS_Header_Info
-{
-public:
- JAWS_Header_Info (void);
- ~JAWS_Header_Info (void);
-
- int end_of_line (void) const;
- void end_of_line (int flag);
-
- const char *last_header_name (void) const;
-
- int last_header_length (void) const;
- void last_header_length (int len);
-
- const JAWS_Header_Data * last_header_data (void) const;
-
- char *header_buf (void);
-
- void append_last_header_value (char c);
- int append_last_header_value (void);
- void append_last_header_value (const char *begin, const char *end);
- void reduce_last_header_value (void);
-
- void create_next_header_value (char *ht);
- // This will insert last_header_data into the table if it is not
- // null. Then, it will create a new header_data node and populate
- // it. If ht is null, last_header_data is not inserted.
-
- void finish_last_header_value (void);
- // This will insert last_header_data into the table if it is not
- // null.
-
- int end_of_headers (void) const;
- void end_of_headers (int flag);
-
- int status (void) const;
- void status (int s);
-
- JAWS_Headers *table (void);
-
- enum STATUS_CODE
- {
- STATUS_CODE_OK = 0,
- STATUS_CODE_NO_MEMORY,
- STATUS_CODE_TOO_LONG
- };
-
- enum
- {
- MAX_HEADER_LENGTH = 8192
- };
- // Note that RFC 822 does not mention the maximum length of a header
- // line. So in theory, there is no maximum length.
- // In Apache, they assume that each header line should not exceed
- // 8K. Who am I to disagree?
-
- void dump (void);
-
-private:
- int end_of_headers_;
- int end_of_line_;
-
- JAWS_Header_Data *last_header_data_;
-
- int last_header_length_;
- int status_;
-
- char header_buf_[MAX_HEADER_LENGTH];
- JAWS_Headers table_;
-};
-
-class JAWS_Export JAWS_Parse_Headers
-{
-public:
-
- int parse_headers (JAWS_Header_Info *info, ACE_Message_Block &mb);
- // Return 0 means need more data, and call it again.
- // Return 1 means all done or error.
-
- int parse_header_name (JAWS_Header_Info *info, ACE_Message_Block &mb);
- // Return 0 means reiterate on remaining input.
- // Return 1 means input has ended (either because it ended
- // prematurely, or that there are no more headers).
-
- int parse_header_value (JAWS_Header_Info *info, ACE_Message_Block &mb);
- // Return 0 means reiterate on remaining input.
- // Return 1 means input has ended or that an error has occurred.
-
- char * skipset (const char *set, char *start, char *end);
- // Scans from start to end for characters that match skip set.
- // Returns pointer to first location between start and end of a
- // character that is in the skip set.
-
- char * skipcset (const char *set, char *start, char *end);
- // Scans from start to end for characters that match skip set.
- // Returns pointer to first location between start and end of a
- // character that is *not* in the skip set.
-
-};
-
-typedef ACE_Singleton<JAWS_Parse_Headers, ACE_SYNCH_MUTEX>
- JAWS_Parse_Headers_Singleton;
-
-
-#endif /* !defined (JAWS_PARSE_HEADERS_H) */
diff --git a/apps/JAWS2/JAWS/Pipeline.cpp b/apps/JAWS2/JAWS/Pipeline.cpp
deleted file mode 100644
index e0f298a48ea..00000000000
--- a/apps/JAWS2/JAWS/Pipeline.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-// $Id$
-
-#include "JAWS/Pipeline.h"
-
-ACE_RCSID(JAWS, Pipeline, "$Id$")
-
-JAWS_Pipeline::JAWS_Pipeline (void)
-{
-}
-
-int
-JAWS_Pipeline::open (void *)
-{
- // Simply call into the virtual svc() method.
- if (this->svc () == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%p\n",
- "JAWS_Pipeline::svc"),
- -1);
- return 0;
-}
-
-int
-JAWS_Pipeline::close (u_long)
-{
- return 0;
-}
diff --git a/apps/JAWS2/JAWS/Pipeline.h b/apps/JAWS2/JAWS/Pipeline.h
deleted file mode 100644
index 30e4bf37cc2..00000000000
--- a/apps/JAWS2/JAWS/Pipeline.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_PIPELINE_H
-#define JAWS_PIPELINE_H
-
-#include "ace/config-all.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Service_Config.h"
-#include "ace/Stream.h"
-#include "ace/Module.h"
-#include "ace/Task.h"
-
-#include "JAWS/Export.h"
-
-typedef ACE_Stream<ACE_NULL_SYNCH> JAWS_Pipeline_Stream;
-typedef ACE_Module<ACE_NULL_SYNCH> JAWS_Pipeline_Module;
-typedef ACE_Task<ACE_NULL_SYNCH> JAWS_Pipeline_Task;
-
-class JAWS_IO_Handler;
-class JAWS_Dispatch_Policy;
-
-class JAWS_Export JAWS_Pipeline : public JAWS_Pipeline_Task
- // = TITLE
- // Methods that are common to pipeline components
-{
-public:
- JAWS_Pipeline (void);
- // ACE_Task hooks
-
- virtual int open (void * = 0);
- virtual int close (u_long = 0);
-};
-
-#endif /* !defined (JAWS_PIPELINE_H) */
diff --git a/apps/JAWS2/JAWS/Pipeline_Handler_T.cpp b/apps/JAWS2/JAWS/Pipeline_Handler_T.cpp
deleted file mode 100644
index 3ea3ab17479..00000000000
--- a/apps/JAWS2/JAWS/Pipeline_Handler_T.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// $Id$
-
-#ifndef JAWS_PIPELINE_HANDLER_T_CPP
-#define JAWS_PIPELINE_HANDLER_T_CPP
-
-#include "JAWS/Pipeline_Handler_T.h"
-
-ACE_RCSID(JAWS, Pipeline_Handler_T, "$Id$")
-
-template <class TYPE>
-JAWS_Pipeline_Abstract_Handler<TYPE>::JAWS_Pipeline_Abstract_Handler (void)
-{
-}
-
-template <class TYPE>
-JAWS_Pipeline_Abstract_Handler<TYPE>::~JAWS_Pipeline_Abstract_Handler (void)
-{
-}
-
-template <class TYPE> int
-JAWS_Pipeline_Abstract_Handler<TYPE>::put (ACE_Message_Block *mb,
- ACE_Time_Value *tv)
-{
- TYPE *data = reinterpret_cast <TYPE *> (mb->data_block ());
-
- int status = this->handle_put (data, tv);
-
- return status;
-}
-
-#endif /* !defined (JAWS_PIPELINE_HANDLER_T_CPP) */
diff --git a/apps/JAWS2/JAWS/Pipeline_Handler_T.h b/apps/JAWS2/JAWS/Pipeline_Handler_T.h
deleted file mode 100644
index 4d4d808fee2..00000000000
--- a/apps/JAWS2/JAWS/Pipeline_Handler_T.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_PIPELINE_HANDLER_T_H
-#define JAWS_PIPELINE_HANDLER_T_H
-
-#include "JAWS/Export.h"
-#include "JAWS/Pipeline.h"
-
-template <class TYPE>
-class JAWS_Pipeline_Abstract_Handler : public JAWS_Pipeline_Task
- // = TITLE
- // Methods that are common to pipeline components
-{
-public:
- JAWS_Pipeline_Abstract_Handler (void);
- virtual ~JAWS_Pipeline_Abstract_Handler (void);
- // ACE_Task hooks
-
- virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0);
- // inherited from ACE_Task
-
- virtual int handle_put (TYPE *data, ACE_Time_Value *tv) = 0;
- // Callback hook for specialized data processing
-
-};
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "JAWS/Pipeline_Handler_T.cpp"
-#endif
-
-#endif /* !defined (JAWS_PIPELINE_HANDLER_T_H) */
diff --git a/apps/JAWS2/JAWS/Pipeline_Tasks.cpp b/apps/JAWS2/JAWS/Pipeline_Tasks.cpp
deleted file mode 100644
index 0616e600800..00000000000
--- a/apps/JAWS2/JAWS/Pipeline_Tasks.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-// $Id$
-
-#include "JAWS/JAWS.h"
-
-#include "JAWS/IO.h"
-#include "JAWS/Pipeline_Tasks.h"
-#include "JAWS/Pipeline_Handler_T.h"
-#include "JAWS/Data_Block.h"
-#include "JAWS/IO_Handler.h"
-#include "JAWS/Policy.h"
-
-ACE_RCSID(JAWS, Pipeline_Tasks, "$Id$")
-
-JAWS_Pipeline_Handler::JAWS_Pipeline_Handler (void)
- : policy_ (0)
-{
-}
-
-JAWS_Pipeline_Handler::~JAWS_Pipeline_Handler (void)
-{
-}
-
-int
-JAWS_Pipeline_Handler::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
-{
- JAWS_Data_Block *db = dynamic_cast<JAWS_Data_Block *> (mb);
- JAWS_IO_Handler *ioh = db->io_handler ();
-
- // guarantee the handler remains for the duration of this call
- ioh->acquire ();
-
- int status = this->handle_put (db, tv);
-
- if (status != -1 && status != 2)
- {
- JAWS_Pipeline_Handler *task = ioh->task ();
- JAWS_Pipeline_Handler *next
- = dynamic_cast<JAWS_Pipeline_Handler *> (task->next ());
-
- ioh->task (next);
- }
-
- ioh->release ();
-
- return status;
-}
-
-JAWS_Dispatch_Policy *
-JAWS_Pipeline_Handler::policy (void)
-{
- return this->policy_;
-}
-
-void
-JAWS_Pipeline_Handler::policy (JAWS_Dispatch_Policy *policy)
-{
- this->policy_ = policy;
-}
-
-int
-JAWS_Pipeline_Accept_Task::put (ACE_Message_Block *mb, ACE_Time_Value *tv)
-{
- JAWS_Data_Block *db = dynamic_cast<JAWS_Data_Block *> (mb);
-
- JAWS_Pipeline_Handler *task = db->task ();
- JAWS_Pipeline_Handler *next
- = dynamic_cast<JAWS_Pipeline_Handler *> (task->next ());
-
- JAWS_IO_Handler *ioh = this->new_handler (db);
- if (ioh == 0)
- {
- ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Pipeline_Accept_Task::put"));
- return -1;
- }
-
- ioh->acquire ();
-
- ioh->task (next);
- db->io_handler (ioh);
-
- int result = this->handle_put (ioh->message_block (), tv);
-
- ioh->release ();
-
- return result;
-}
-
-int
-JAWS_Pipeline_Accept_Task::handle_put (JAWS_Data_Block *data,
- ACE_Time_Value *)
-{
- int result = -1;
-
- // JAWS_Data_Block should contain an INET_Addr and an IO
- JAWS_IO_Handler *handler = data->io_handler ();
- JAWS_Dispatch_Policy *policy = this->policy ();
-
- if (policy == 0) policy = data->policy ();
-
- // data->policy ()->update (handler);
-
- JAWS_IO *io = policy->io ();
- io->accept (handler);
-
- // When accept returns, the resulting handle should be stored into
- // the JAWS_DATA_BLOCK somewhere.
-
- // Check the handler for status of the io call
- switch (handler->status ())
- {
- case JAWS_IO_Handler::ACCEPT_OK:
- {
- ACE_DEBUG ((LM_DEBUG, "(%t) ACCEPT_OK\n"));
- result = 0;
- JAWS_TRACE ("JAWS_Pipeline_Accept_Task::handle_put ACCEPT_OK");
- // Move on to next stage in pipeline
- break;
- }
- case JAWS_IO_Handler::ACCEPT_ERROR:
- {
- ACE_DEBUG ((LM_DEBUG, "(%t) ACCEPT_ERROR\n"));
- result = -1;
- JAWS_TRACE ("JAWS_Pipeline_Accept_Task::handle_put ACCEPT_ERROR");
- // Should recycle the thread
- break;
- }
- default:
- {
- result = 1;
- JAWS_TRACE ("JAWS_Pipeline_Accept_Task::handle_put ACCEPT_IDLE");
- // Should mean that the IO is asynchronous, and the word isn't out
- // yet.
- break;
- }
- }
-
- // In asynchronous and synchronous models, we can --
- // have the io_handler set the new task in the data_block
-
- // In asynchronous model, we can --
- // insert a wait task into the task queue
-
- ACE_DEBUG ((LM_DEBUG, "(%t) Returning %d\n", result));
- return result;
-}
-
-JAWS_IO_Handler *
-JAWS_Pipeline_Accept_Task::new_handler (JAWS_Data_Block *data)
-{
- // Create a new handler and message block
- JAWS_Data_Block *ndb = new JAWS_Data_Block (*data);
- if (ndb == 0)
- {
- JAWS_TRACE ("JAWS_Pipeline_Accept_Task::new_handler, failed DB");
- return 0;
- }
-
- JAWS_Dispatch_Policy *policy =
- (this->policy () == 0) ? data->policy () : this->policy ();
- JAWS_IO_Handler_Factory *ioh_factory = policy->ioh_factory ();
-
- JAWS_IO_Handler *nioh = ioh_factory->create_io_handler ();
- if (nioh == 0)
- {
- delete ndb;
- return 0;
- }
-
- ndb->io_handler (nioh);
- nioh->task (data->task ());
- nioh->message_block (ndb);
-
- return nioh;
-}
-
-int
-JAWS_Pipeline_Done_Task::put (ACE_Message_Block *mb, ACE_Time_Value *)
-{
- JAWS_TRACE ("JAWS_Pipeline_Done_Task::put");
-
- JAWS_Data_Block *data = dynamic_cast<JAWS_Data_Block *> (mb);
-
- JAWS_IO_Handler *handler = data->io_handler ();
- JAWS_Dispatch_Policy *policy = this->policy ();
- if (policy == 0) policy = data->policy ();
-
- // JAWS_IO *io = policy->io ();
-
- data->task (0);
- data->io_handler (0);
-
- if (handler)
- handler->done ();
-
- // hack, let Concurrency know we are done.
- return -2;
-}
-
-int
-JAWS_Pipeline_Done_Task::handle_put (JAWS_Data_Block *, ACE_Time_Value *)
-{
- return 0;
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class JAWS_Pipeline_Abstract_Handler<JAWS_Data_Block>;
-template class ACE_Singleton<JAWS_Pipeline_Accept_Task, ACE_SYNCH_MUTEX>;
-template class ACE_Singleton<JAWS_Pipeline_Done_Task, ACE_SYNCH_NULL_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate JAWS_Pipeline_Abstract_Handler<JAWS_Data_Block>
-#pragma instantiate ACE_Singleton<JAWS_Pipeline_Accept_Task, ACE_SYNCH_MUTEX>
-#pragma instantiate ACE_Singleton<JAWS_Pipeline_Done_Task, ACE_SYNCH_NULL_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/Pipeline_Tasks.h b/apps/JAWS2/JAWS/Pipeline_Tasks.h
deleted file mode 100644
index 3bbb5080593..00000000000
--- a/apps/JAWS2/JAWS/Pipeline_Tasks.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_PIPELINE_TASKS_H
-#define JAWS_PIPELINE_TASKS_H
-
-#include "ace/Singleton.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "JAWS/Export.h"
-#include "JAWS/Pipeline.h"
-#include "JAWS/Pipeline_Handler_T.h"
-#include "JAWS/Data_Block.h"
-
-class JAWS_Export JAWS_Pipeline_Handler
- : public JAWS_Pipeline_Abstract_Handler<JAWS_Data_Block>
-{
-public:
- JAWS_Pipeline_Handler (void);
- virtual ~JAWS_Pipeline_Handler (void);
- virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0);
- virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv) = 0;
-
- virtual JAWS_Dispatch_Policy * policy (void);
- virtual void policy (JAWS_Dispatch_Policy *);
-
-private:
- JAWS_Dispatch_Policy *policy_;
-};
-
-class JAWS_Pipeline_Accept_Task : public JAWS_Pipeline_Handler
-{
-public:
- virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0);
- virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv);
-
- virtual JAWS_IO_Handler * new_handler (JAWS_Data_Block *data);
-};
-
-class JAWS_Pipeline_Done_Task : public JAWS_Pipeline_Handler
-{
-public:
- virtual int put (ACE_Message_Block *mb, ACE_Time_Value *tv = 0);
- virtual int handle_put (JAWS_Data_Block *data, ACE_Time_Value *tv);
-};
-
-typedef ACE_Singleton<JAWS_Pipeline_Accept_Task, ACE_SYNCH_MUTEX>
- JAWS_Pipeline_Accept_Task_Singleton;
-
-typedef ACE_Singleton<JAWS_Pipeline_Done_Task, ACE_SYNCH_NULL_MUTEX>
- JAWS_Pipeline_Done_Task_Singleton;
-
-#endif /* !defined (JAWS_PIPELINE_TASKS_H) */
diff --git a/apps/JAWS2/JAWS/Policy.cpp b/apps/JAWS2/JAWS/Policy.cpp
deleted file mode 100644
index 9eac271416a..00000000000
--- a/apps/JAWS2/JAWS/Policy.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// $Id$
-
-#include "JAWS/Policy.h"
-#include "JAWS/Concurrency.h"
-#include "JAWS/IO_Handler.h"
-#include "JAWS/IO_Acceptor.h"
-
-ACE_RCSID(JAWS, Policy, "$Id$")
-
-JAWS_Dispatch_Policy::JAWS_Dispatch_Policy (void)
-{
-}
-
-JAWS_Dispatch_Policy::~JAWS_Dispatch_Policy (void)
-{
-}
-
-JAWS_Default_Dispatch_Policy::JAWS_Default_Dispatch_Policy (void)
- : ratio_ (1),
- concurrency_ (JAWS_Thread_Pool_Singleton::instance ()),
- ioh_factory_ (JAWS_Synch_IO_Handler_Factory_Singleton::instance ()),
- acceptor_ (JAWS_IO_Synch_Acceptor_Singleton::instance ()),
- io_ (JAWS_Synch_IO_Singleton::instance ())
-{
-}
-
-JAWS_Default_Dispatch_Policy::~JAWS_Default_Dispatch_Policy (void)
-{
-}
-
-int
-JAWS_Default_Dispatch_Policy::ratio (void)
-{
- return this->ratio_;
-}
-
-JAWS_IO *
-JAWS_Default_Dispatch_Policy::io (void)
-{
- return this->io_;
-}
-
-JAWS_IO_Handler_Factory *
-JAWS_Default_Dispatch_Policy::ioh_factory (void)
-{
- return this->ioh_factory_;
-}
-
-JAWS_IO_Acceptor *
-JAWS_Default_Dispatch_Policy::acceptor (void)
-{
- return this->acceptor_;
-}
-
-JAWS_Concurrency_Base *
-JAWS_Default_Dispatch_Policy::concurrency (void)
-{
- return this->concurrency_;
-}
-
-void
-JAWS_Default_Dispatch_Policy::ratio (int r)
-{
- this->ratio_ = r;
-}
-
-void
-JAWS_Default_Dispatch_Policy::io (JAWS_IO *io)
-{
- this->io_ = io;
-}
-
-void
-JAWS_Default_Dispatch_Policy::ioh_factory (JAWS_IO_Handler_Factory *iohf)
-{
- this->ioh_factory_ = iohf;
-}
-
-void
-JAWS_Default_Dispatch_Policy::acceptor (JAWS_IO_Acceptor *acceptor)
-{
- this->acceptor_ = acceptor;
-}
-
-void
-JAWS_Default_Dispatch_Policy::concurrency (JAWS_Concurrency_Base *concp)
-{
- this->concurrency_ = concp;
-}
diff --git a/apps/JAWS2/JAWS/Policy.h b/apps/JAWS2/JAWS/Policy.h
deleted file mode 100644
index 9255594c056..00000000000
--- a/apps/JAWS2/JAWS/Policy.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_POLICY_H
-#define JAWS_POLICY_H
-
-#include "JAWS/Export.h"
-#include "JAWS/Concurrency.h"
-
-class JAWS_IO;
-class JAWS_IO_Handler;
-class JAWS_IO_Handler_Factory;
-
-class JAWS_Export JAWS_Dispatch_Policy
- // = TITLE
- // Policy mechanism for choosing different concurrency models.
- //
- // = DESCRIPTION
- // Given some (unspecified) state, decides what the concurrency
- // model should be. (For now, we always return the same model.)
-{
-public:
- JAWS_Dispatch_Policy (void);
- virtual ~JAWS_Dispatch_Policy (void);
-
- virtual int ratio (void) = 0;
- virtual JAWS_IO * io (void) = 0;
- virtual JAWS_IO_Handler_Factory *ioh_factory (void) = 0;
- virtual JAWS_IO_Acceptor *acceptor (void) = 0;
- virtual JAWS_Concurrency_Base * concurrency (void) = 0;
-
- virtual void ratio (int r) = 0;
- virtual void io (JAWS_IO *iop) = 0;
- virtual void ioh_factory (JAWS_IO_Handler_Factory *factoryp) = 0;
- virtual void acceptor (JAWS_IO_Acceptor *acceptorp) = 0;
- virtual void concurrency (JAWS_Concurrency_Base *concp) = 0;
-};
-
-class JAWS_Export JAWS_Default_Dispatch_Policy : public JAWS_Dispatch_Policy
-{
-public:
- JAWS_Default_Dispatch_Policy (void);
- virtual ~JAWS_Default_Dispatch_Policy (void);
-
- virtual int ratio (void);
- virtual JAWS_IO *io (void);
- virtual JAWS_IO_Handler_Factory *ioh_factory (void);
- virtual JAWS_IO_Acceptor *acceptor (void);
- virtual JAWS_Concurrency_Base *concurrency (void);
-
- virtual void ratio (int r);
- virtual void io (JAWS_IO *iop);
- virtual void ioh_factory (JAWS_IO_Handler_Factory *factoryp);
- virtual void acceptor (JAWS_IO_Acceptor *acceptorp);
- virtual void concurrency (JAWS_Concurrency_Base *concp);
-
-private:
- int ratio_;
- JAWS_Concurrency_Base *concurrency_;
- JAWS_IO_Handler_Factory *ioh_factory_;
- JAWS_IO_Acceptor *acceptor_;
- JAWS_IO *io_;
-};
-
-#endif /* !defined (JAWS_POLICY_H) */
diff --git a/apps/JAWS2/JAWS/Reaper.cpp b/apps/JAWS2/JAWS/Reaper.cpp
deleted file mode 100644
index 6d1d5845cba..00000000000
--- a/apps/JAWS2/JAWS/Reaper.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// $Id$
-
-#include "JAWS/Reaper.h"
-#include "JAWS/Concurrency.h"
-#include "JAWS/IO_Acceptor.h"
-
-ACE_RCSID(JAWS, Reaper, "$Id$")
-
-JAWS_Reaper::JAWS_Reaper (JAWS_Concurrency_Base *concurrency)
- : concurrency_ (concurrency),
- waiting_ (0)
-{
-}
-
-JAWS_Reaper::~JAWS_Reaper (void)
-{
-}
-
-int
-JAWS_Reaper::open (void *)
-{
- if (this->waiting_ == 0)
- {
- ACE_Guard<ACE_SYNCH_MUTEX> g (this->lock_);
- if (this->waiting_ == 0)
- {
- if (this->activate () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "JAWS_Reaper::activate"),
- -1);
- this->waiting_ = 1;
- }
- }
- return 0;
-}
-
-int
-JAWS_Reaper::svc (void)
-{
- ACE_TRACE ("JAWS_Reaper::svc");
- int result = this->concurrency_->thr_mgr ()->wait ();
- JAWS_IO_Synch_Acceptor_Singleton::instance ()->close ();
- JAWS_IO_Asynch_Acceptor_Singleton::instance ()->close ();
- ACE_DEBUG ((LM_DEBUG, "(%t) Leaving REAPER\n"));
- return result;
-}
diff --git a/apps/JAWS2/JAWS/Reaper.h b/apps/JAWS2/JAWS/Reaper.h
deleted file mode 100644
index 78177f37e85..00000000000
--- a/apps/JAWS2/JAWS/Reaper.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_REAPER_H
-#define JAWS_REAPER_H
-
-#include "ace/Singleton.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Task.h"
-#include "ace/Synch_Traits.h"
-
-#include "JAWS/Export.h"
-
-// A reaper class to reap the threads.
-
-class JAWS_Concurrency_Base;
-
-class JAWS_Export JAWS_Reaper : public ACE_Task<ACE_SYNCH>
-{
- // = TITLE
- // Reap threads for the concurrency strategies
- //
- // = DESCRIPTION
- // The JAWS_Reaper uses the default Thread Manager (while each
- // concurrency strategy uses their own). The idea is that the
- // reaper will spawn a thread to reap the threads of a concurrency
- // strategy. This allows the main thread to reap the threads of
- // the reaper before exiting.
-
-public:
- JAWS_Reaper (JAWS_Concurrency_Base *concurrency);
- virtual ~JAWS_Reaper (void);
-
- virtual int open (void * = 0);
- virtual int svc (void);
-
-private:
- JAWS_Concurrency_Base *concurrency_;
- int waiting_;
- ACE_SYNCH_MUTEX lock_;
-
-};
-
-#endif /* JAWS_REAPER_H */
diff --git a/apps/JAWS2/JAWS/Server.cpp b/apps/JAWS2/JAWS/Server.cpp
deleted file mode 100644
index 4fbec0cd0f7..00000000000
--- a/apps/JAWS2/JAWS/Server.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-// $Id$
-
-#include "ace/config-lite.h"
-#include "ace/OS_NS_string.h"
-#include "ace/Get_Opt.h"
-
-#if (ACE_NTRACE != 1)
-#include "ace/Trace.h"
-#endif /* (ACE_NTRACE != 1) */
-
-#include "JAWS/Server.h"
-#include "JAWS/Data_Block.h"
-#include "JAWS/Concurrency.h"
-#include "JAWS/IO.h"
-#include "JAWS/IO_Handler.h"
-#include "JAWS/IO_Acceptor.h"
-#include "JAWS/Pipeline_Tasks.h"
-
-ACE_RCSID(JAWS, Server, "$Id$")
-
-JAWS_Server::JAWS_Server (void)
- : port_ (5432),
- concurrency_ (0),
- dispatch_ (0),
- nthreads_ (5),
- maxthreads_ (20),
- flags_ (THR_NEW_LWP)
-{
-}
-
-JAWS_Server::JAWS_Server (int argc, char *argv[])
- : ratio_ (1),
- port_ (5432),
- concurrency_ (0),
- dispatch_ (0),
- nthreads_ (5),
- maxthreads_ (20),
- flags_ (THR_NEW_LWP)
-{
- this->init (argc, argv);
-}
-
-void
-JAWS_Server::init (int argc, char *argv[])
-{
- this->parse_args (argc, argv);
-
- this->policy_.ratio (this->ratio_);
-
- if (this->concurrency_ == 1)
- {
- JAWS_Thread_Per_Singleton::instance ()->make (this->flags_,
- this->maxthreads_);
- this->policy_.concurrency (JAWS_Thread_Per_Singleton::instance ());
- }
- else
- {
- JAWS_Thread_Pool_Singleton::instance ()->make (this->flags_,
- this->nthreads_,
- this->maxthreads_);
- this->policy_.concurrency (JAWS_Thread_Pool_Singleton::instance ());
- }
-
-#if !(defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS))
- this->dispatch_ = 0;
-#endif /* !defined (ACE_WIN32) */
-
- if (this->dispatch_ == 1)
- {
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
- this->policy_.io (JAWS_Asynch_IO_Singleton::instance ());
- this->policy_.ioh_factory
- (JAWS_Asynch_IO_Handler_Factory_Singleton::instance ());
- this->policy_.acceptor (JAWS_IO_Asynch_Acceptor_Singleton::instance ());
-#endif /* defined (ACE_WIN32) */
- }
- else
- {
- this->policy_.io (JAWS_Synch_IO_Singleton::instance ());
- this->policy_.ioh_factory
- (JAWS_Synch_IO_Handler_Factory_Singleton::instance ());
- this->policy_.acceptor (JAWS_IO_Synch_Acceptor_Singleton::instance ());
- }
-
- ACE_INET_Addr inet_addr (this->port_);
- this->policy_.acceptor ()->open (inet_addr);
-}
-
-int
-JAWS_Server::open (JAWS_Pipeline_Handler *protocol,
- JAWS_Dispatch_Policy *policy)
-{
- if (policy == 0)
- policy = &this->policy_;
-
- JAWS_Data_Block *db = new JAWS_Data_Block;
- if (db == 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- "(%t) JAWS_Server::open, could not create Data_Block\n"));
- return -1;
- }
-
- // initialize data block
-
- db->task (JAWS_Pipeline_Accept_Task_Singleton::instance ());
- db->policy (policy);
- db->io_handler (0);
-
- db->task ()->next (protocol);
-
- // prime the acceptor if appropriate
- if (this->dispatch_ == 1)
- {
-#if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)
-
- int n = this->nthreads_;
- if (this->concurrency_ == 1)
- n = 1;
-
- for (int i = 0; i < n * this->ratio_ - n; i++)
- db->task ()->put (db);
-
-#endif /* defined (ACE_WIN32) */
- }
-
- // The message block should contain an INET_Addr, and call the
- // io->accept (INET_Addr) method!
-
- policy->concurrency ()->put (db);
-
- ACE_Thread_Manager::instance ()->wait ();
-
- db->release ();
-
- return 0;
-}
-
-void
-JAWS_Server::parse_args (int argc, char *argv[])
-{
- int c;
- int t = 0;
-
- ACE_Get_Opt getopt (argc, argv, "t" "p:c:d:n:m:f:r:");
- while ((c = getopt ()) != -1)
- switch (c)
- {
- case 't':
- t = !t;
- break;
- case 'p':
- this->port_ = ACE_OS::atoi (getopt.opt_arg ());
- break;
- case 'c':
- if (ACE_OS::strcmp (getopt.opt_arg (), "PER_REQUEST") == 0)
- this->concurrency_ = 1;
- else this->concurrency_ = 0;
- break;
- case 'd':
- if (ACE_OS::strcmp (getopt.opt_arg (), "ASYNCH") == 0)
- this->dispatch_ = 1;
- else this->dispatch_ = 0;
- break;
- case 'n':
- this->nthreads_ = ACE_OS::atoi (getopt.opt_arg ());
- break;
- case 'm':
- this->maxthreads_ = ACE_OS::atoi (getopt.opt_arg ());
- break;
- case 'f':
- if (ACE_OS::strcmp (getopt.opt_arg (), "THR_BOUND") == 0)
- this->flags_ |= THR_BOUND;
- else if (ACE_OS::strcmp (getopt.opt_arg (), "THR_DAEMON") == 0)
- this->flags_ |= THR_DAEMON;
- else if (ACE_OS::strcmp (getopt.opt_arg (), "THR_DETACHED") == 0)
- this->flags_ |= THR_DETACHED;
- break;
- case 'r':
- this->ratio_ = ACE_OS::atoi (getopt.opt_arg ());
- break;
- }
-
-#if (ACE_NTRACE != 1)
- if (t)
- ACE_Trace::start_tracing ();
- else
- ACE_Trace::stop_tracing ();
-#endif /* ACE_NTRACE != 1*/
-
- if (this->port_ == 0) this->port_ = 5432;
- if (this->nthreads_ == 0) this->nthreads_ = 5;
- if (this->maxthreads_ == 0) this->maxthreads_ = 20;
-}
diff --git a/apps/JAWS2/JAWS/Server.h b/apps/JAWS2/JAWS/Server.h
deleted file mode 100644
index 0cac8f17ae0..00000000000
--- a/apps/JAWS2/JAWS/Server.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_SERVER_H
-#define JAWS_SERVER_H
-
-#include "JAWS/Export.h"
-#include "JAWS/Data_Block.h"
-#include "JAWS/Policy.h"
-
-class JAWS_IO_Handler_Factory;
-
-class JAWS_Export JAWS_Server
-{
-public:
- JAWS_Server (void);
- JAWS_Server (int argc, char *argv[]);
-
- void init (int argc, char *argv[]);
- int open (JAWS_Pipeline_Handler *ph, JAWS_Dispatch_Policy *dp = 0);
-
-private:
- void parse_args (int argc, char *argv[]);
- // Parse arguments
-
-private:
- int ratio_; // ratio of asynch ops to threads
- int port_; // port to listen on
- int concurrency_; // 0 => pool, 1 => per request
- int dispatch_; // 0 => synch, 1 => asynch
- int nthreads_; // number of threads
- int maxthreads_; // maximum number of threads
- long flags_; // thread creation flags
-
- JAWS_Default_Dispatch_Policy policy_;
-};
-
-
-#endif /* !defined (JAWS_SERVER_H) */
diff --git a/apps/JAWS2/JAWS/Waiter.cpp b/apps/JAWS2/JAWS/Waiter.cpp
deleted file mode 100644
index e636ebb61ab..00000000000
--- a/apps/JAWS2/JAWS/Waiter.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// $Id$
-
-#include "ace/Proactor.h"
-
-#include "JAWS/Waiter.h"
-#include "JAWS/IO_Handler.h"
-
-ACE_RCSID(JAWS, Waiter, "$Id$")
-
-JAWS_Waiter::JAWS_Waiter (void)
- : iter_ (*this)
-{
-}
-
-JAWS_Waiter::~JAWS_Waiter (void)
-{
-}
-
-JAWS_Waiter_Base_Iterator &
-JAWS_Waiter::iter (void)
-{
- return this->iter_;
-}
-
-int
-JAWS_Waiter::index (void)
-{
-#if 0
- // A future version of ACE will support this.
- ACE_Thread_ID tid = ACE_OS::thr_self ();
-#else
- // Do it this way for now
- ACE_thread_t thr_name;
- thr_name = ACE_OS::thr_self ();
-
- JAWS_Thread_ID tid (thr_name);
-#endif /* 0 */
-
- return JAWS_Waiter_Base::index (tid);
-}
-
-JAWS_IO_Handler *
-JAWS_Waiter::wait_for_completion (int i)
-{
- JAWS_IO_Handler *ioh;
- JAWS_IO_Handler **iohptr;
-
- iohptr = (i >= 0) ? this->find_by_index (i) : this->find_by_index (this->index ());
-
- while (*iohptr == 0)
- if (ACE_Proactor::instance ()->handle_events () == -1)
- {
- ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_Waiter::wait_for_completion"));
- return 0;
- }
-
- ioh = *iohptr;
- *iohptr = 0;
-
- ioh->lock ();
- ioh->release ();
- return ioh;
-}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class JAWS_Assoc_Array<JAWS_Thread_ID, JAWS_IO_Handler *>;
-template class JAWS_Assoc_Array_Iterator<JAWS_Thread_ID, JAWS_IO_Handler *>;
-template class ACE_Singleton<JAWS_Waiter, ACE_SYNCH_MUTEX>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate JAWS_Assoc_Array<JAWS_Thread_ID, JAWS_IO_Handler *>
-#pragma instantiate JAWS_Assoc_Array_Iterator<JAWS_Thread_ID, JAWS_IO_Handler *>
-#pragme instantiate ACE_Singleton<JAWS_Waiter, ACE_SYNCH_MUTEX>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/apps/JAWS2/JAWS/Waiter.h b/apps/JAWS2/JAWS/Waiter.h
deleted file mode 100644
index ed0bce47cc1..00000000000
--- a/apps/JAWS2/JAWS/Waiter.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- c++ -*- */
-// $Id$
-
-#ifndef JAWS_WAITER_H
-#define JAWS_WAITER_H
-
-#include "ace/Singleton.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/Synch_Traits.h"
-#include "JAWS/Assoc_Array.h"
-#include "JAWS/Export.h"
-
-class JAWS_IO_Handler;
-
-typedef ACE_thread_t JAWS_Thread_ID;
-
-typedef JAWS_Assoc_Array<JAWS_Thread_ID, JAWS_IO_Handler *> JAWS_Waiter_Base;
-typedef JAWS_Assoc_Array_Iterator<JAWS_Thread_ID, JAWS_IO_Handler *>
- JAWS_Waiter_Base_Iterator;
-
-class JAWS_Export JAWS_Waiter : public JAWS_Waiter_Base
-{
-public:
- JAWS_Waiter (void);
- ~JAWS_Waiter (void);
-
- JAWS_Waiter_Base_Iterator &iter (void);
- // Returns an iterator to the headers container.
-
- int index (void);
- // Returns the index into the table associated with calling thread.
-
- JAWS_IO_Handler * wait_for_completion (int i = -1);
- // The entry point for this class, handles outstanding asynchronous
- // events. Can optionally accept a parameter that points to which
- // table entry to return.
-
-private:
- JAWS_Waiter_Base_Iterator iter_;
-
-};
-
-typedef ACE_Singleton<JAWS_Waiter, ACE_SYNCH_MUTEX> JAWS_Waiter_Singleton;
-
-#endif /* JAWS_WAITER_H */
diff --git a/apps/JAWS2/JAWS/jaws2.mpc b/apps/JAWS2/JAWS/jaws2.mpc
deleted file mode 100644
index a7d5754b11a..00000000000
--- a/apps/JAWS2/JAWS/jaws2.mpc
+++ /dev/null
@@ -1,47 +0,0 @@
-// -*- MPC -*-
-// $Id$
-
-project(JAWS2) : acelib {
- sharedname = JAWS2
- dynamicflags = JAWS_BUILD_DLL
- avoids += uses_wchar ace_for_tao
- includes += ..
- Source_Files {
- Assoc_Array.cpp
- Cache_Manager.cpp
- Cache_Object.cpp
- Concurrency.cpp
- Data_Block.cpp
- FILE.cpp
- Filecache.cpp
- Headers.cpp
- IO.cpp
- IO_Acceptor.cpp
- IO_Handler.cpp
- Parse_Headers.cpp
- Pipeline.cpp
- Pipeline_Tasks.cpp
- Policy.cpp
- Reaper.cpp
- Server.cpp
- Waiter.cpp
- }
-
-
- Template_Files{
- Cache_Hash_T.cpp
- Cache_Heap_T.cpp
- Cache_List_T.cpp
- Pipeline_Handler_T.cpp
- Hash_Bucket_T.cpp
- Cache_Manager_T.cpp
- }
-
- Header_Files{
- *.h
- }
-
- Inline_Files{
- }
-}
-