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

E90870-01

coherence/util/filter/PriorityFilter.hpp

00001 /*
00002 * PriorityFilter.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_PRIORITY_FILTER_HPP
00017 #define COH_PRIORITY_FILTER_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/io/pof/PofReader.hpp"
00022 #include "coherence/io/pof/PofWriter.hpp"
00023 #include "coherence/net/AbstractPriorityTask.hpp"
00024 #include "coherence/util/filter/EntryFilter.hpp"
00025 #include "coherence/util/filter/IndexAwareFilter.hpp"
00026 
00027 COH_OPEN_NAMESPACE3(coherence,util,filter)
00028 
00029 using coherence::io::pof::PofReader;
00030 using coherence::io::pof::PofWriter;
00031 using coherence::net::AbstractPriorityTask;
00032 
00033 
00034 /**
00035 * PriorityFilter is used to explicitly control the scheduling priority and
00036 * timeouts for execution of filter-based methods.
00037 * <p/>
00038 * For example, let's assume that there is a cache that belongs to a partitioned
00039 * cache service configured with a <i>request-timeout</i> and <i>task-timeout</i>
00040 * of 5 seconds.
00041 * Also assume that we are willing to wait longer for a particular rarely
00042 * executed parallel query that does not employ any indexes. Then we could
00043 * override the default timeout values by using the PriorityFilter as follows:
00044 * <pre>
00045 *   EqualsFilter::Handle   hFilterStandard = LikeFilter::create("getComments", "%fail%");
00046 *   PriorityFilter::Handle hFilterPriority = PriorityFilter::create(hFilterStandard);
00047 *   hFilterPriority->setExecutionTimeoutMillis(PriorityTask::timeout_none);
00048 *   hFilterPriority->setRequestTimeoutMillis(PriorityTask::timeout_none);
00049 *   Set::View vSetEntries = hCache->entrySet(hFilterPriority);
00050 * </pre>
00051 * <p/>
00052 * This is an advanced feature which should be used judiciously.
00053 *
00054 * @author djl  2008.03.02
00055 */
00056 class COH_EXPORT PriorityFilter
00057     : public class_spec<PriorityFilter,
00058         extends<AbstractPriorityTask>,
00059         implements<IndexAwareFilter> >
00060     {
00061     friend class factory<PriorityFilter>;
00062 
00063     // ----- constructors ---------------------------------------------------
00064 
00065     protected:
00066         /**
00067         * Default constructor (necessary for the PortableObject interface).
00068         */
00069         PriorityFilter();
00070 
00071         /**
00072         * Construct a PriorityFilter.
00073         *
00074         * @param vFilter  the filter wrapped by this PriorityFilter
00075         */
00076         PriorityFilter(IndexAwareFilter::View vFilter);
00077 
00078 
00079     // ----- EntryFilter interface ------------------------------------------
00080 
00081     public:
00082         /**
00083         * {@inheritDoc}
00084         */
00085         virtual bool evaluateEntry(Map::Entry::View vEntry) const;
00086 
00087 
00088     // ----- Filter interface -----------------------------------------------
00089 
00090     public:
00091         /**
00092         * {@inheritDoc}
00093         */
00094         virtual bool evaluate(Object::View v) const;
00095 
00096 
00097     // ----- IndexAwareFilter interface -------------------------------------
00098 
00099     public:
00100         /**
00101         * {@inheritDoc}
00102         */
00103         virtual size32_t calculateEffectiveness(Map::View vMapIndexes,
00104                 Set::View vSetKeys) const;
00105 
00106         /**
00107         * {@inheritDoc}
00108         */
00109         virtual Filter::View applyIndex(Map::View vMapIndexes,
00110                 Set::Handle hSetKeys) const;
00111 
00112 
00113     // ----- PortableObject interface ---------------------------------------
00114 
00115      public:
00116         /**
00117         * {@inheritDoc}
00118         */
00119         virtual void readExternal(PofReader::Handle hIn);
00120 
00121         /**
00122         * {@inheritDoc}
00123         */
00124         virtual void writeExternal(PofWriter::Handle hOut) const;
00125 
00126 
00127     // ----- Object interface -----------------------------------------------
00128 
00129     public:
00130         /**
00131         * {@inheritDoc}
00132         */
00133         virtual TypedHandle<const String> toString() const;
00134 
00135 
00136     // ----- data member accessors ------------------------------------------
00137 
00138     public:
00139         /**
00140         * Obtain the underlying filter.
00141         *
00142         * @return the filter wrapped by this PriorityFilter
00143         */
00144         virtual IndexAwareFilter::View getFilter() const;
00145 
00146 
00147     // ----- data members ---------------------------------------------------
00148 
00149     protected:
00150         /**
00151         * The wrapped filter.
00152         */
00153         FinalView<IndexAwareFilter> f_vFilter;
00154     };
00155 
00156 COH_CLOSE_NAMESPACE3
00157 
00158 #endif //COH_PRIORITY_FILTER_HPP
Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.