Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.4.0)

E90870-01

coherence/net/cache/BundlingNamedCache.hpp

00001 /*
00002 * BundlingNamedCache.hpp
00003 *
00004 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_BUNDLING_NAMED_CACHE_HPP
00017 #define COH_BUNDLING_NAMED_CACHE_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/net/NamedCache.hpp"
00022 #include "coherence/net/cache/AbstractBundler.hpp"
00023 #include "coherence/net/cache/AbstractEntryBundler.hpp"
00024 #include "coherence/net/cache/AbstractKeyBundler.hpp"
00025 #include "coherence/net/cache/WrapperNamedCache.hpp"
00026 #include "coherence/util/Collection.hpp"
00027 #include "coherence/util/Collections.hpp"
00028 #include "coherence/util/Map.hpp"
00029 
00030 COH_OPEN_NAMESPACE3(coherence,net,cache)
00031 
00032 using coherence::net::NamedCache;
00033 using coherence::util::Collection;
00034 using coherence::util::Collections;
00035 using coherence::util::Map;
00036 
00037 /**
00038  * Bundling NamedCache implementation.
00039  *
00040  * @see AbstractBundler
00041  * @author gg 2007.02.13
00042  * @author lh 2012.06.05
00043  * @since Coherence 12.1.2
00044  */
00045 class COH_EXPORT BundlingNamedCache
00046     : public class_spec<BundlingNamedCache,
00047         extends<WrapperNamedCache> >
00048     {
00049     friend class factory<BundlingNamedCache>;
00050 
00051     // ----- handle definitions (needed for nested classes) -----------------
00052 
00053     public:
00054         typedef this_spec::Handle Handle;
00055         typedef this_spec::View   View;
00056         typedef this_spec::Holder Holder;
00057 
00058     // ----- constructors ---------------------------------------------------
00059 
00060     protected:
00061         /**
00062          * Construct a BundlingNamedCache based on the specified NamedCache.
00063          *
00064          * @param hCache  the NamedCache that will be wrapped by this 
00065          *                BundlingNamedCache
00066          */
00067         BundlingNamedCache(NamedCache::Handle hCache);
00068 
00069     private:
00070         /**
00071          * Blocked copy constructor.
00072          */
00073         BundlingNamedCache(const BundlingNamedCache&);
00074 
00075     // ----- initiators ------------------------------------------------------
00076 
00077     public:
00078         /**
00079          * Configure the bundler for the "get" operations. If the bundler does
00080          * not exist and bundling is enabled, it will be instantiated.
00081          *
00082          * @param cBundleThreshold  the bundle size threshold; pass zero to
00083          *                          disable "get" operation bundling
00084          *
00085          * @return the "get" bundler or NULL if bundling is disabled
00086          */
00087         virtual AbstractBundler::Handle ensureGetBundler(int32_t cBundleThreshold);
00088 
00089         /**
00090          * Configure the bundler for the "put" operations. If the bundler does
00091          * not exist and bundling is enabled, it will be instantiated.
00092          *
00093          * @param cBundleThreshold  the bundle size threshold; pass zero to
00094          *                          disable "put" operation bundling
00095          *
00096          * @return the "put" bundler or NULL if bundling is disabled
00097          */
00098         virtual AbstractBundler::Handle ensurePutBundler(int32_t cBundleThreshold);
00099 
00100         /**
00101          * Configure the bundler for the "remove" operations. If the bundler
00102          * does not exist and bundling is enabled, it will be instantiated.
00103          *
00104          * @param cBundleThreshold  the bundle size threshold; pass zero to
00105          *                          disable "remove" operation bundling
00106          *
00107          * @return the "remove" bundler or NULL if bundling is disabled
00108          */
00109         virtual AbstractBundler::Handle ensureRemoveBundler(int32_t cBundleThreshold);
00110 
00111     // ----- accessors -------------------------------------------------------
00112 
00113     public:
00114         /**
00115          * Obtain the bundler for the "get" operations.
00116          *
00117          * @return the "get" bundler
00118          */
00119         virtual AbstractBundler::Handle getGetBundler();
00120 
00121         /**
00122          * Obtain the bundler for the "put" operations.
00123          *
00124          * @return the "put" bundler
00125          */
00126         virtual AbstractBundler::Handle getPutBundler();
00127 
00128         /**
00129          * Obtain the bundler for the "remove" operations.
00130          *
00131          * @return the "remove" bundler
00132          */
00133         virtual AbstractBundler::Handle getRemoveBundler();
00134         
00135     // ----- various bundleable NamedCache methods ---------------------------
00136 
00137     public:
00138         using WrapperNamedCache::get;
00139         using WrapperNamedCache::getAll;
00140         using WrapperNamedCache::put;
00141 
00142         /**
00143          * {@inheritDoc}
00144          */
00145         virtual Object::Holder get(Object::View vKey);
00146 
00147         /**
00148          * {@inheritDoc}
00149          */
00150         virtual Map::View getAll(Collection::View vColKeys);
00151 
00152         /**
00153          * {@inheritDoc}
00154          *
00155          * <b>Note:</b> this method always returns NULL.
00156          */
00157         virtual Object::Holder put(Object::View vKey, Object::Holder ohValue);
00158 
00159         /**
00160          * {@inheritDoc}
00161          */
00162         virtual void putAll(Map::View vMap);
00163 
00164         /**
00165          * {@inheritDoc}
00166          *
00167          * <b>Note:</b> this method always returns NULL.
00168          */
00169         virtual Object::Holder remove(Object::View vKey);
00170         using Map::remove;
00171 
00172     // ----- NamedCache interface --------------------------------------------
00173 
00174         /**
00175          * {@inheritDoc}
00176          */
00177         virtual void release();
00178 
00179         /**
00180          * {@inheritDoc}
00181          */
00182         virtual void destroy();
00183 
00184     // ----- inner classes ---------------------------------------------------
00185 
00186     public:
00187         class COH_EXPORT GetBundler
00188             : public class_spec<GetBundler,
00189                 extends<AbstractKeyBundler> >
00190             {
00191             friend class factory<GetBundler>;
00192             
00193             // ----- constructors ---------------------------------------
00194 
00195             protected:
00196                 /**
00197                  * @param hBundlingNamedCache  the BundlingNamedCache this 
00198                  *                             bundler is associated with
00199                  */
00200                 GetBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00201 
00202             // ----- bundle operations --------------------------------------
00203 
00204             protected:
00205                 /**
00206                  * A pass through the underlying "getAll" operation.
00207                  *
00208                  * @param vColKeys  a collection of keys for the "getAll"
00209                  *                  operation
00210                  *
00211                  * @return the results.
00212                  */
00213                 virtual Map::View bundle(Collection::View vColKeys);
00214 
00215                 /**
00216                  * A pass through the underlying "get" operation.
00217                  *
00218                  * @param vKey  the entry key
00219                  */
00220                 virtual Object::Holder unbundle(Object::View vKey) const;
00221 
00222                 /**
00223                  * A pass through the underlying "get" operation.
00224                  *
00225                  * @param vKey  the entry key
00226                  */
00227                 virtual Object::Holder unbundle(Object::View vKey);
00228 
00229             // ----- accessors ------------------------------------------
00230 
00231             public:
00232                 /**
00233                  * Obtain the BundlingNamedCache for this bundler.
00234                  *
00235                  * @return the BundlingNamedCache
00236                  */
00237                 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00238 
00239                 /**
00240                  * Obtain the BundlingNamedCache for this bundler.
00241                  *
00242                  * @return the BundlingNamedCache
00243                  */
00244                 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00245 
00246             // ----- data fields ----------------------------------------
00247 
00248             private:
00249                 /**
00250                  * The BundlingNamedCache for this bundler.
00251                  */
00252                 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00253             };
00254 
00255         class COH_EXPORT PutBundler
00256             : public class_spec<PutBundler,
00257                 extends<AbstractEntryBundler> >
00258             {
00259             friend class factory<PutBundler>;
00260 
00261             // ----- constructors ---------------------------------------
00262 
00263             protected:
00264                 /**
00265                  * @param hBundlingNamedCache  the BundlingNamedCache this 
00266                  *                             bundler is associated with
00267                  */
00268                 PutBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00269 
00270             // ----- bundle operations ----------------------------------
00271 
00272             protected:
00273                 /**
00274                  * A pass through the underlying "putAll" operation.
00275                  *
00276                  * @param vMap  the collection of entries
00277                  */
00278                 virtual void bundle(Map::View vMap);
00279 
00280             // ----- accessors ------------------------------------------
00281 
00282             public:
00283                 /**
00284                  * Obtain the BundlingNamedCache for this bundler.
00285                  *
00286                  * @return the BundlingNamedCache
00287                  */
00288                 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00289 
00290                 /**
00291                  * Obtain the BundlingNamedCache for this bundler.
00292                  *
00293                  * @return the BundlingNamedCache
00294                  */
00295                 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00296 
00297             // ----- data fields ----------------------------------------
00298 
00299             private:
00300                 /**
00301                  * The BundlingNamedCache for this bundler.
00302                  */
00303                 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00304             };
00305 
00306         class COH_EXPORT RemoveBundler
00307             : public class_spec<RemoveBundler,
00308                 extends<AbstractKeyBundler> >
00309             {
00310             friend class factory<RemoveBundler>;
00311 
00312             // ----- constructors ---------------------------------------
00313 
00314             protected:
00315                 /**
00316                  * @param hBundlingNamedCache  the BundlingNamedCache this 
00317                  *                             bundler is associated with
00318                  */
00319                 RemoveBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00320 
00321             // ----- bundle operations ----------------------------------
00322 
00323             protected:
00324                 /**
00325                  * A pass through the underlying keySet()->removeAll() operation.
00326                  *
00327                  * @param vColKeys  the collection of keys to perform the
00328                  *                  bundled operation for
00329                  */
00330                 virtual Map::View bundle(Collection::View vColKeys);
00331 
00332                 /**
00333                  * A pass through the underlying "remove" operation.
00334                  *
00335                  * @param vKey  the entry key
00336                  */
00337                 virtual Object::Holder unbundle(Object::View vKey);
00338 
00339             // ----- accessors ------------------------------------------
00340 
00341             public:
00342                 /**
00343                  * Obtain the BundlingNamedCache for this bundler.
00344                  *
00345                  * @return the BundlingNamedCache
00346                  */
00347                 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00348 
00349                 /**
00350                  * Obtain the BundlingNamedCache for this bundler.
00351                  *
00352                  * @return the BundlingNamedCache
00353                  */
00354                 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00355 
00356             // ----- data fields ----------------------------------------
00357 
00358             private:
00359                 /**
00360                  * The BundlingNamedCache for this bundler.
00361                  */
00362                 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00363             };
00364 
00365     // ----- data fields -----------------------------------------------------
00366 
00367     private:
00368         /**
00369          * The bundler for get() operations.
00370          */
00371         MemberHandle<GetBundler> m_hGetBundler;
00372 
00373         /**
00374          * The bundler for put() operations.
00375          */
00376         MemberHandle<PutBundler> m_hPutBundler;
00377 
00378         /**
00379          * The bundler for remove() operations.
00380          */
00381         MemberHandle<RemoveBundler> m_hRemoveBundler;
00382     };
00383     
00384 COH_CLOSE_NAMESPACE3
00385 
00386 #endif // COH_BUNDLING_NAMED_CACHE_HPP
Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.