00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00039
00040
00041
00042
00043
00044
00045 class COH_EXPORT BundlingNamedCache
00046 : public class_spec<BundlingNamedCache,
00047 extends<WrapperNamedCache> >
00048 {
00049 friend class factory<BundlingNamedCache>;
00050
00051
00052
00053 public:
00054 typedef this_spec::Handle Handle;
00055 typedef this_spec::View View;
00056 typedef this_spec::Holder Holder;
00057
00058
00059
00060 protected:
00061
00062
00063
00064
00065
00066
00067 BundlingNamedCache(NamedCache::Handle hCache);
00068
00069 private:
00070
00071
00072
00073 BundlingNamedCache(const BundlingNamedCache&);
00074
00075
00076
00077 public:
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 virtual AbstractBundler::Handle ensureGetBundler(int32_t cBundleThreshold);
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 virtual AbstractBundler::Handle ensurePutBundler(int32_t cBundleThreshold);
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109 virtual AbstractBundler::Handle ensureRemoveBundler(int32_t cBundleThreshold);
00110
00111
00112
00113 public:
00114
00115
00116
00117
00118
00119 virtual AbstractBundler::Handle getGetBundler();
00120
00121
00122
00123
00124
00125
00126 virtual AbstractBundler::Handle getPutBundler();
00127
00128
00129
00130
00131
00132
00133 virtual AbstractBundler::Handle getRemoveBundler();
00134
00135
00136
00137 public:
00138 using WrapperNamedCache::get;
00139 using WrapperNamedCache::getAll;
00140 using WrapperNamedCache::put;
00141
00142
00143
00144
00145 virtual Object::Holder get(Object::View vKey);
00146
00147
00148
00149
00150 virtual Map::View getAll(Collection::View vColKeys);
00151
00152
00153
00154
00155
00156
00157 virtual Object::Holder put(Object::View vKey, Object::Holder ohValue);
00158
00159
00160
00161
00162 virtual void putAll(Map::View vMap);
00163
00164
00165
00166
00167
00168
00169 virtual Object::Holder remove(Object::View vKey);
00170
00171
00172
00173
00174
00175
00176 virtual void release();
00177
00178
00179
00180
00181 virtual void destroy();
00182
00183
00184
00185 public:
00186 class COH_EXPORT GetBundler
00187 : public class_spec<GetBundler,
00188 extends<AbstractKeyBundler> >
00189 {
00190 friend class factory<GetBundler>;
00191
00192
00193
00194 protected:
00195
00196
00197
00198
00199 GetBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00200
00201
00202
00203 protected:
00204
00205
00206
00207
00208
00209
00210
00211
00212 virtual Map::View bundle(Collection::View vColKeys);
00213
00214
00215
00216
00217
00218
00219 virtual Object::Holder unbundle(Object::View vKey) const;
00220
00221
00222
00223
00224
00225
00226 virtual Object::Holder unbundle(Object::View vKey);
00227
00228
00229
00230 public:
00231
00232
00233
00234
00235
00236 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00237
00238
00239
00240
00241
00242
00243 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00244
00245
00246
00247 private:
00248
00249
00250
00251 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00252 };
00253
00254 class COH_EXPORT PutBundler
00255 : public class_spec<PutBundler,
00256 extends<AbstractEntryBundler> >
00257 {
00258 friend class factory<PutBundler>;
00259
00260
00261
00262 protected:
00263
00264
00265
00266
00267 PutBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00268
00269
00270
00271 protected:
00272
00273
00274
00275
00276
00277 virtual void bundle(Map::View vMap);
00278
00279
00280
00281 public:
00282
00283
00284
00285
00286
00287 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00288
00289
00290
00291
00292
00293
00294 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00295
00296
00297
00298 private:
00299
00300
00301
00302 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00303 };
00304
00305 class COH_EXPORT RemoveBundler
00306 : public class_spec<RemoveBundler,
00307 extends<AbstractKeyBundler> >
00308 {
00309 friend class factory<RemoveBundler>;
00310
00311
00312
00313 protected:
00314
00315
00316
00317
00318 RemoveBundler(BundlingNamedCache::Handle hBundlingNamedCache);
00319
00320
00321
00322 protected:
00323
00324
00325
00326
00327
00328
00329 virtual Map::View bundle(Collection::View vColKeys);
00330
00331
00332
00333
00334
00335
00336 virtual Object::Holder unbundle(Object::View vKey);
00337
00338
00339
00340 public:
00341
00342
00343
00344
00345
00346 virtual BundlingNamedCache::Handle getBundlingNamedCache();
00347
00348
00349
00350
00351
00352
00353 virtual BundlingNamedCache::View getBundlingNamedCache() const;
00354
00355
00356
00357 private:
00358
00359
00360
00361 FinalHandle<BundlingNamedCache> f_hBundlingNamedCache;
00362 };
00363
00364
00365
00366 private:
00367
00368
00369
00370 MemberHandle<GetBundler> m_hGetBundler;
00371
00372
00373
00374
00375 MemberHandle<PutBundler> m_hPutBundler;
00376
00377
00378
00379
00380 MemberHandle<RemoveBundler> m_hRemoveBundler;
00381 };
00382
00383 COH_CLOSE_NAMESPACE3
00384
00385 #endif // COH_BUNDLING_NAMED_CACHE_HPP