diff options
author | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-10 23:19:27 +0000 |
---|---|---|
committer | kirthika <kirthika@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-06-10 23:19:27 +0000 |
commit | ca6fd5ce694fe083c66bfa733f3b4d89f9e84ceb (patch) | |
tree | ebb71f3ca35665444fa323f568b088656b671e6c /ace/Cleanup_Strategies_T.cpp | |
parent | 84232d6e0f6902dbe2eb9c21093215182e94c2d9 (diff) | |
download | ATCD-ca6fd5ce694fe083c66bfa733f3b4d89f9e84ceb.tar.gz |
Handler_Cleanup_Strategy added.
Diffstat (limited to 'ace/Cleanup_Strategies_T.cpp')
-rw-r--r-- | ace/Cleanup_Strategies_T.cpp | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/ace/Cleanup_Strategies_T.cpp b/ace/Cleanup_Strategies_T.cpp index 4afa343e84a..b1d45ecc116 100644 --- a/ace/Cleanup_Strategies_T.cpp +++ b/ace/Cleanup_Strategies_T.cpp @@ -12,32 +12,32 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined (ACE_LACKS_INLINE_FUNCTIONS) -#include "ace/Cached_Connect_Strategy_T.i" +#include "ace/Cleanup_Strategies_T.i" #endif /* ACE_LACKS_INLINE_FUNCTIONS */ ACE_RCSID(ace, Cleanup_Strategies_T, "$Id$") -template <class CONTAINER> -ACE_Cleanup_Strategy<CONTAINER>::~ACE_Cleanup_Strategy (void) +template <class KEY, class VALUE, class CONTAINER> +ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>::~ACE_Cleanup_Strategy (void) { } //////////////////////////////////////////////////////////////////////////// -template <class CONTAINER> int -ACE_Default_Cleanup_Strategy<CONTAINER>::cleanup (CONTAINER &container, - KEY *key, - VALUE *value) +template <class KEY, class VALUE, class CONTAINER> int +ACE_Default_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, + KEY *key, + VALUE *value) { return container.unbind (*key); } //////////////////////////////////////////////////////////////////////////// -template <class CONTAINER> int -ACE_Svc_Cleanup_Strategy<CONTAINER>::cleanup (CONTAINER &container, - KEY *key, - VALUE *value) +template <class KEY, class VALUE, class CONTAINER> int +ACE_Svc_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, + KEY *key, + VALUE *value) { (value->first ())->recycler (0, 0); @@ -50,11 +50,35 @@ ACE_Svc_Cleanup_Strategy<CONTAINER>::cleanup (CONTAINER &container, } ///////////////////////////////////////////////////////////////////////////// +template <class KEY, class VALUE, class CONTAINER> int +ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, + KEY *key, + VALUE *value) +{ + // Remove the item from cache only if the handler isnt in use. + if ((*value)->active () == 0) + { + ACE_DEBUG ((LM_DEBUG, "handle %d\n", + (*value)->get_handle ())); + (*value)->close (); + + ACE_DEBUG ((LM_DEBUG, "LRU: before unbind: current_size %d\n", container.current_size ())); + + if (container.unbind (*key) == -1) + return -1; -template <class CONTAINER> int -ACE_Null_Cleanup_Strategy<CONTAINER>::cleanup (CONTAINER &container, - KEY *key, - VALUE *value) + ACE_DEBUG ((LM_DEBUG, "LRU:after unbind: current_size %d\n", container.current_size ())); + } + + return 0; + +} + +//////////////////////////////////////////////////////////////////////////// +template <class KEY, class VALUE, class CONTAINER> int +ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, + KEY *key, + VALUE *value) { return 0; } |