From: <tho...@us...> - 2011-03-02 19:15:30
|
Revision: 4262 http://bigdata.svn.sourceforge.net/bigdata/?rev=4262&view=rev Author: thompsonbry Date: 2011-03-02 19:15:21 +0000 (Wed, 02 Mar 2011) Log Message: ----------- Some optimizations of heap churn (the bop deep copy semantics are now shallow copy semantics, which is sufficient to maintain their immutable contract). Created a canonicalizing factory and applied it to the BigdataValueFactoryImpl, which is already shared for a given namespace. I am still looking at how to apply this to the LexiconRelation to increase sharing of the term cache. Added private loggers for the NanoHTTP class hierarchy. Added test w/o shared variables to TestPipelineJoin. Interned various strings which are used as annotation names. Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpBase.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/Constant.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IConstraint.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/PipelineOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/aggregate/AggregateBase.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/Predicate.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/SampleIndex.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/ConditionalRoutingOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/CopyOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/constraint/INConstraint.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/AbstractSubqueryOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/QueryEngine.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/join/PipelineJoin.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/PartitionedJoinGroup.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/rto/JoinGraph.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/mutation/InsertOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/ComparatorOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/DistinctBindingSetOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/GroupByOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/SliceOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/SortOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/IndexMetadata.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/counters/httpd/CounterSetHTTPD.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/counters/httpd/CounterSetHTTPDServer.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/util/httpd/AbstractHTTPD.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/util/httpd/NanoHTTPD.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/engine/PipelineDelayOp.java branches/QUADS_QUERY_BRANCH/bigdata/src/test/com/bigdata/bop/join/TestPipelineJoin.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/bop/rdf/aggregate/GROUP_CONCAT.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/bop/rdf/join/DataSetJoin.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/CompareBOp.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/IsInlineBOp.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/MathBOp.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/internal/constraints/RangeBOp.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/model/BigdataValueFactoryImpl.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/spo/SPOPredicate.java branches/QUADS_QUERY_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/store/AbstractTripleStore.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataEvaluationStrategyImpl3.java branches/QUADS_QUERY_BRANCH/bigdata-sails/src/java/com/bigdata/rdf/sail/bench/NanoSparqlServer.java Added Paths: ----------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/util/CanonicalFactory.java Property Changed: ---------------- branches/QUADS_QUERY_BRANCH/bigdata-perf/ Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -226,10 +226,13 @@ // * @return <code>true</code> if all arguments and annotations are the same. // */ // boolean sameData(final BOp o); - - /** - * Interface declaring well known annotations. - */ + + /** + * Interface declaring well known annotations. + * <p> + * Note: Annotation names should be {@link String#intern() interned} in + * order to avoid having duplicate values for those strings on the heap. + */ public interface Annotations { /** @@ -238,7 +241,7 @@ * identifier for the {@link BOp} within the context of its owning * query. */ - String BOP_ID = BOp.class.getName() + ".bopId"; + String BOP_ID = (BOp.class.getName() + ".bopId").intern(); /** * The timeout for the operator evaluation (milliseconds). @@ -253,7 +256,7 @@ * be interpreted with respect to the time when the query began to * execute. */ - String TIMEOUT = BOp.class.getName() + ".timeout"; + String TIMEOUT = (BOp.class.getName() + ".timeout").intern(); /** * The default timeout for operator evaluation. @@ -266,7 +269,7 @@ * * @see BOpEvaluationContext */ - String EVALUATION_CONTEXT = BOp.class.getName() + ".evaluationContext"; + String EVALUATION_CONTEXT = (BOp.class.getName() + ".evaluationContext").intern(); BOpEvaluationContext DEFAULT_EVALUATION_CONTEXT = BOpEvaluationContext.ANY; @@ -280,7 +283,7 @@ * * @see BOp#isController() */ - String CONTROLLER = BOp.class.getName()+".controller"; + String CONTROLLER = (BOp.class.getName()+".controller").intern(); boolean DEFAULT_CONTROLLER = false; Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpBase.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpBase.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/BOpBase.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -85,30 +85,30 @@ * not. A "copy on write" map might be better. */ static protected final transient Map<String,Object> NOANNS = Collections.emptyMap(); - - /** - * The argument values - <strong>direct access to this field is - * discouraged</strong> - the field is protected to support - * <em>mutation</em> APIs and should not be relied on for other purposes. - * <p> - * Note: This field is reported out as a {@link List} so we can make it - * thread safe and, if desired, immutable. However, it is internally a - * simple array and exposed to subclasses so they can implement mutation - * operations which return deep copies in which the argument values have - * been modified. - * <p> - * If we allow mutation of the arguments then caching of the arguments (or - * annotations) by classes such as {@link EQ} will cause {@link #clone()} to - * fail because (a) it will do a field-by-field copy on the concrete - * implementation class; and (b) it will not consistently update the cached - * references. In order to "fix" this problem, any classes which cache - * arguments or annotations would have to explicitly overrides - * {@link #clone()} in order to set those fields based on the arguments on - * the cloned {@link BOpBase} class. - * <p> - * Note: This must be at least "effectively" final per the effectively - * immutable contract for {@link BOp}s. - */ + + /** + * The argument values - <strong>direct access to this field is + * discouraged</strong> - the field is protected to support + * <em>mutation</em> APIs and should not be relied on for other purposes. + * <p> + * Note: This field is reported out as a {@link List} so we can make it + * thread safe and, if desired, immutable. However, it is internally a + * simple array. Subclasses can implement mutation operations which return + * deep copies in which the argument values have been modified using + * {@link #_set(int, BOp)}. + * <p> + * If we allowed mutation of the arguments (outside of the object creation + * pattern) then caching of the arguments (or annotations) by classes such + * as {@link EQ} will cause {@link #clone()} to fail because (a) it will do + * a field-by-field copy on the concrete implementation class; and (b) it + * will not consistently update the cached references. In order to "fix" + * this problem, any classes which cache arguments or annotations would have + * to explicitly overrides {@link #clone()} in order to set those fields + * based on the arguments on the cloned {@link BOpBase} class. + * <p> + * Note: This must be at least "effectively" final per the effectively + * immutable contract for {@link BOp}s. + */ private final BOp[] args; /** @@ -118,7 +118,14 @@ * immutable contract for {@link BOp}s. */ private final Map<String,Object> annotations; - + + /** + * The default initial capacity used for an empty annotation map -- empty + * maps use the minimum initial capacity to avoid waste since we create a + * large number of {@link BOp}s during query evaluation. + */ + static private transient final int DEFAULT_INITIAL_CAPACITY = 2; + /** * Check the operator argument. * @@ -199,7 +206,12 @@ // deep copy the annotations. // annotations = deepCopy(op.annotations); // Note: only shallow copy is required to achieve immutable semantics! - args = Arrays.copyOf(op.args, op.args.length); + if (op.args == NOARGS || op.args.length == 0) { + // fast path for zero arity operators. + args = NOARGS; + } else { + args = Arrays.copyOf(op.args, op.args.length); + } annotations = new LinkedHashMap<String, Object>(op.annotations); } @@ -232,12 +244,57 @@ checkArgs(args); this.args = args; - - this.annotations = (annotations == null ? new LinkedHashMap<String, Object>() - : annotations); - + + this.annotations = (annotations == null ? new LinkedHashMap<String, Object>( + DEFAULT_INITIAL_CAPACITY) + : annotations); + } + /* + * Note: This will not work since the keys provide the strong references to + * the values.... For this purpose we need to use a ConcurrentHashMap with + * an access policy which did not rely on weak references to clear its + * entries. + */ +// static private Map<String, Object> internMap(final Map<String, Object> anns) { +// final int initialCapacity = (int) (anns.size() / .75f/* loadFactor */) + 1; +// final Map<String, Object> t = new LinkedHashMap<String, Object>( +// initialCapacity); +// for(Map.Entry<String,Object> e : t.entrySet()) { +// final String k = intern(e.getKey()); +// t.put(k, e.getValue()); +// } +// return t; +// } +// +// /** +// * Intern the string within a canonicalizing hash map using weak values. +// * @param s +// * @return +// */ +// static private String intern(final String s) { +// +// final String t = termCache.putIfAbsent(s, s); +// +// if (t != null) +// return t; +// +// return s; +// +// } +// +// /** +// * A canonicalizing hash map using weak values. Entries will be cleared from +// * the map once their values are no longer referenced. +// * ConcurrentWeakValueCacheWithBatchedUpdates +// */ +// static private transient final ConcurrentWeakValueCacheWithBatchedUpdates<String,String> termCache = new ConcurrentWeakValueCacheWithBatchedUpdates<String,String>(// +// 1000, // queueCapacity +// .75f, // loadFactor (.75 is the default) +// 16 // concurrency level (16 is the default) +// ); + final public Map<String, Object> annotations() { return Collections.unmodifiableMap(annotations); @@ -375,10 +432,10 @@ * before returning control to the caller. This would result in less * heap churn. */ - static protected BOp[] deepCopy(final BOp[] a) { - if (a == NOARGS) { - // fast path for zero arity operators. - return a; + static protected BOp[] deepCopy(final BOp[] a) { + if (a == NOARGS || a.length == 0) { + // fast path for zero arity operators. + return NOARGS; } final BOp[] t = new BOp[a.length]; for (int i = 0; i < a.length; i++) { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/Constant.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/Constant.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/Constant.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -44,7 +44,7 @@ * The {@link IVariable} which is bound to that constant value * (optional). */ - String VAR = Constant.class.getName() + ".var"; + String VAR = (Constant.class.getName() + ".var").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IConstraint.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IConstraint.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IConstraint.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -52,4 +52,9 @@ */ public boolean accept(IBindingSet bindingSet); + /** + * A zero length empty {@link IConstraint} array. + */ + public IConstraint[] EMPTY = new IConstraint[0]; + } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/IPredicate.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -84,7 +84,7 @@ * @see https://sourceforge.net/apps/trac/bigdata/ticket/180 (Migrate * the RDFS inference and truth maintenance logic to BOPs) */ - String RELATION_NAME = IPredicate.class.getName() + ".relationName"; + String RELATION_NAME = (IPredicate.class.getName() + ".relationName").intern(); // /** // * The {@link IKeyOrder} which will be used to read on the relation. @@ -99,7 +99,7 @@ /** * <code>true</code> iff the predicate has SPARQL optional semantics. */ - String OPTIONAL = IPredicate.class.getName() + ".optional"; + String OPTIONAL = (IPredicate.class.getName() + ".optional").intern(); // /** // * Constraints on the elements read from the relation. @@ -139,7 +139,7 @@ * * @see IRangeQuery#rangeIterator(byte[], byte[], int, int, IFilter) */ - String INDEX_LOCAL_FILTER = IPredicate.class.getName() + ".indexLocalFilter"; + String INDEX_LOCAL_FILTER = (IPredicate.class.getName() + ".indexLocalFilter").intern(); /** * An optional {@link BOpFilterBase} to be applied to the elements of @@ -156,7 +156,7 @@ * one another. You can chain {@link FilterBase} filters together as * well. */ - String ACCESS_PATH_FILTER = IPredicate.class.getName() + ".accessPathFilter"; + String ACCESS_PATH_FILTER = (IPredicate.class.getName() + ".accessPathFilter").intern(); /** * Access path expander pattern. This allows you to wrap or replace the @@ -185,13 +185,13 @@ * * @see IAccessPathExpander */ - String ACCESS_PATH_EXPANDER = IPredicate.class.getName() + ".accessPathExpander"; + String ACCESS_PATH_EXPANDER = (IPredicate.class.getName() + ".accessPathExpander").intern(); /** * The partition identifier -or- <code>-1</code> if the predicate does * not address a specific shard. */ - String PARTITION_ID = IPredicate.class.getName() + ".partitionId"; + String PARTITION_ID = (IPredicate.class.getName() + ".partitionId").intern(); int DEFAULT_PARTITION_ID = -1; @@ -233,7 +233,7 @@ * * @see BOpEvaluationContext */ - String REMOTE_ACCESS_PATH = IPredicate.class.getName() + ".remoteAccessPath"; + String REMOTE_ACCESS_PATH = (IPredicate.class.getName() + ".remoteAccessPath").intern(); boolean DEFAULT_REMOTE_ACCESS_PATH = true; @@ -245,8 +245,8 @@ * * @see #DEFAULT_FULLY_BUFFERED_READ_THRESHOLD */ - String FULLY_BUFFERED_READ_THRESHOLD = IPredicate.class.getName() - + ".fullyBufferedReadThreshold"; + String FULLY_BUFFERED_READ_THRESHOLD = (IPredicate.class.getName() + + ".fullyBufferedReadThreshold").intern(); /** * Default for {@link #FULLY_BUFFERED_READ_THRESHOLD}. @@ -277,7 +277,7 @@ * * @see #DEFAULT_FLAGS */ - String FLAGS = IPredicate.class.getName() + ".flags"; + String FLAGS = (IPredicate.class.getName() + ".flags").intern(); /** * The default flags will visit the keys and values of the non-deleted @@ -302,7 +302,7 @@ * * @see #TIMESTAMP */ - String MUTATION = IPredicate.class.getName() + ".mutation"; + String MUTATION = (IPredicate.class.getName() + ".mutation").intern(); boolean DEFAULT_MUTATION = false; @@ -312,7 +312,7 @@ * * @see #MUTATION */ - String TIMESTAMP = IPredicate.class.getName() + ".timestamp"; + String TIMESTAMP = (IPredicate.class.getName() + ".timestamp").intern(); // /** // * An optional {@link IConstraint}[] which places restrictions on the Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/PipelineOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/PipelineOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/PipelineOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -71,7 +71,7 @@ * the ancestor in the operator tree which serves as the default sink * for binding sets (optional, default is the parent). */ - String SINK_REF = PipelineOp.class.getName() + ".sinkRef"; + String SINK_REF = (PipelineOp.class.getName() + ".sinkRef").intern(); /** * The value of the annotation is the {@link BOp.Annotations#BOP_ID} of @@ -80,8 +80,8 @@ * * @see #ALT_SINK_GROUP */ - String ALT_SINK_REF = PipelineOp.class.getName() - + ".altSinkRef"; + String ALT_SINK_REF = (PipelineOp.class.getName() + ".altSinkRef") + .intern(); /** * The value reported by {@link PipelineOp#isSharedState()} (default @@ -96,7 +96,8 @@ * When <code>true</code>, the {@link QueryEngine} will impose the * necessary constraints when the operator is evaluated. */ - String SHARED_STATE = PipelineOp.class.getName() + ".sharedState"; + String SHARED_STATE = (PipelineOp.class.getName() + ".sharedState") + .intern(); boolean DEFAULT_SHARED_STATE = false; @@ -116,7 +117,7 @@ * have less effect and performance tends to be best around a modest * value (10) for those annotations. */ - String MAX_PARALLEL = PipelineOp.class.getName() + ".maxParallel"; + String MAX_PARALLEL = (PipelineOp.class.getName() + ".maxParallel").intern(); /** * @see #MAX_PARALLEL @@ -136,8 +137,8 @@ * data to be assigned to an evaluation task is governed by * {@link #MAX_MEMORY} instead. */ - String MAX_MESSAGES_PER_TASK = PipelineOp.class.getName() - + ".maxMessagesPerTask"; + String MAX_MESSAGES_PER_TASK = (PipelineOp.class.getName() + + ".maxMessagesPerTask").intern(); /** * @see #MAX_MESSAGES_PER_TASK @@ -151,8 +152,8 @@ * amount of data which can be buffered on the JVM heap during pipelined * query evaluation. */ - String PIPELINE_QUEUE_CAPACITY = PipelineOp.class.getName() - + ".pipelineQueueCapacity"; + String PIPELINE_QUEUE_CAPACITY = (PipelineOp.class.getName() + + ".pipelineQueueCapacity").intern(); /** * @see #PIPELINE_QUEUE_CAPACITY @@ -165,7 +166,7 @@ * "blocked" evaluation depending on how it buffers its data for * evaluation. */ - String PIPELINED = PipelineOp.class.getName() + ".pipelined"; + String PIPELINED = (PipelineOp.class.getName() + ".pipelined").intern(); /** * @see #PIPELINED @@ -201,7 +202,7 @@ * semantics. Such operators MUST throw an exception if the value of * this annotation could result in multiple evaluation passes. */ - String MAX_MEMORY = PipelineOp.class.getName() + ".maxMemory"; + String MAX_MEMORY = (PipelineOp.class.getName() + ".maxMemory").intern(); /** * @see #MAX_MEMORY Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/aggregate/AggregateBase.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/aggregate/AggregateBase.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/aggregate/AggregateBase.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -103,14 +103,14 @@ * The aggregate function identifier ({@link FunctionCode#COUNT}, * {@link FunctionCode#SUM}, etc). */ - String FUNCTION_CODE = AggregateBase.class.getName() + ".functionCode"; + String FUNCTION_CODE = (AggregateBase.class.getName() + ".functionCode").intern(); /** * Optional boolean property indicates whether the aggregate applies to * the distinct within group solutions (default * {@value #DEFAULT_DISTINCT}). */ - String DISTINCT = AggregateBase.class.getName() + ".distinct"; + String DISTINCT = (AggregateBase.class.getName() + ".distinct").intern(); boolean DEFAULT_DISTINCT = false; Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/Predicate.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/Predicate.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/Predicate.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -35,7 +35,6 @@ import com.bigdata.bop.Constant; import com.bigdata.bop.IBindingSet; import com.bigdata.bop.IConstant; -import com.bigdata.bop.IConstraint; import com.bigdata.bop.IElement; import com.bigdata.bop.IPredicate; import com.bigdata.bop.IVariable; Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/SampleIndex.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/SampleIndex.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/ap/SampleIndex.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -117,7 +117,7 @@ /** * The sample limit (default {@value #DEFAULT_LIMIT}). */ - String LIMIT = SampleIndex.class.getName() + ".limit"; + String LIMIT = (SampleIndex.class.getName() + ".limit").intern(); int DEFAULT_LIMIT = 100; @@ -126,7 +126,7 @@ * (default {@value #DEFAULT_SEED}). A non-zero value may be used to * create a repeatable sample. */ - String SEED = SampleIndex.class.getName() + ".seed"; + String SEED = (SampleIndex.class.getName() + ".seed").intern(); long DEFAULT_SEED = 0L; @@ -134,12 +134,12 @@ * The {@link IPredicate} describing the access path to be sampled * (required). */ - String PREDICATE = SampleIndex.class.getName() + ".predicate"; + String PREDICATE = (SampleIndex.class.getName() + ".predicate").intern(); /** * The type of sample to take (default {@value #DEFAULT_SAMPLE_TYPE)}. */ - String SAMPLE_TYPE = SampleIndex.class.getName() + ".sampleType"; + String SAMPLE_TYPE = (SampleIndex.class.getName() + ".sampleType").intern(); String DEFAULT_SAMPLE_TYPE = SampleType.RANDOM.name(); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/ConditionalRoutingOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/ConditionalRoutingOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/ConditionalRoutingOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -69,7 +69,7 @@ * When the condition is not satisfied, the binding set is routed to the * alternative sink. */ - String CONDITION = ConditionalRoutingOp.class.getName() + ".condition"; + String CONDITION = (ConditionalRoutingOp.class.getName() + ".condition").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/CopyOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/CopyOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/bset/CopyOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -68,13 +68,13 @@ * An optional {@link IConstraint}[] which places restrictions on the * legal patterns in the variable bindings. */ - String CONSTRAINTS = CopyOp.class.getName() + ".constraints"; + String CONSTRAINTS = (CopyOp.class.getName() + ".constraints").intern(); /** * An optional {@link IBindingSet}[] to be used <strong>instead</strong> * of the default source. */ - String BINDING_SETS = CopyOp.class.getName() + ".bindingSets"; + String BINDING_SETS = (CopyOp.class.getName() + ".bindingSets").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/constraint/INConstraint.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/constraint/INConstraint.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/constraint/INConstraint.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -59,7 +59,7 @@ /** * The variable against which the constraint is applied. */ - String VARIABLE = INConstraint.class.getName() + ".variable"; + String VARIABLE = (INConstraint.class.getName() + ".variable").intern(); /** * The set of allowed values for that variable. @@ -67,7 +67,7 @@ * @todo allow large sets to be specified by reference to a resource * which is then materialized on demand during evaluation. */ - String SET = INConstraint.class.getName() + ".set"; + String SET = (INConstraint.class.getName() + ".set").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/AbstractSubqueryOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/AbstractSubqueryOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/AbstractSubqueryOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -90,20 +90,21 @@ public interface Annotations extends PipelineOp.Annotations { - /** - * The ordered {@link BOp}[] of subqueries to be evaluated for each - * binding set presented (required). - */ - String SUBQUERIES = SubqueryOp.class.getName() + ".subqueries"; + /** + * The ordered {@link BOp}[] of subqueries to be evaluated for each + * binding set presented (required). + */ + String SUBQUERIES = (AbstractSubqueryOp.class.getName() + ".subqueries") + .intern(); - /** - * The maximum parallelism with which the subqueries will be evaluated - * (default is unlimited). - */ - String MAX_PARALLEL_SUBQUERIES = AbstractSubqueryOp.class.getName() - + ".maxParallelSubqueries"; + /** + * The maximum parallelism with which the subqueries will be evaluated + * (default is unlimited). + */ + String MAX_PARALLEL_SUBQUERIES = (AbstractSubqueryOp.class.getName() + ".maxParallelSubqueries") + .intern(); - int DEFAULT_MAX_PARALLEL_SUBQUERIES = Integer.MAX_VALUE; + int DEFAULT_MAX_PARALLEL_SUBQUERIES = Integer.MAX_VALUE; } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/controller/SubqueryOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -74,14 +74,14 @@ * {@link SubqueryOp} (required). This should be a * {@link PipelineOp}. */ - String SUBQUERY = SubqueryOp.class.getName() + ".subquery"; + String SUBQUERY = (SubqueryOp.class.getName() + ".subquery").intern(); /** * When <code>true</code> the subquery has optional semantics (if the * subquery fails, the original binding set will be passed along to the * downstream sink anyway) (default {@value #DEFAULT_OPTIONAL}). */ - String OPTIONAL = SubqueryOp.class.getName() + ".optional"; + String OPTIONAL = (SubqueryOp.class.getName() + ".optional").intern(); boolean DEFAULT_OPTIONAL = false; Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/QueryEngine.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/QueryEngine.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/QueryEngine.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -228,8 +228,8 @@ * {@link QueryEngine#newRunningQuery(QueryEngine, UUID, boolean, IQueryClient, PipelineOp)} * in which case they might not support this option. */ - String RUNNING_QUERY_CLASS = QueryEngine.class.getName() - + ".runningQueryClass"; + String RUNNING_QUERY_CLASS = (QueryEngine.class.getName() + + ".runningQueryClass").intern(); // String DEFAULT_RUNNING_QUERY_CLASS = StandaloneChainedRunningQuery.class.getName(); String DEFAULT_RUNNING_QUERY_CLASS = ChunkedRunningQuery.class.getName(); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/join/PipelineJoin.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/join/PipelineJoin.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/join/PipelineJoin.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -121,14 +121,14 @@ * The {@link IPredicate} which is used to generate the * {@link IAccessPath}s during the join. */ - String PREDICATE = PipelineJoin.class.getName() + ".predicate"; + String PREDICATE = (PipelineJoin.class.getName() + ".predicate").intern(); /** * An optional {@link IVariable}[] identifying the variables to be * retained in the {@link IBindingSet}s written out by the operator. All * variables are retained unless this annotation is specified. */ - String SELECT = PipelineJoin.class.getName() + ".select"; + String SELECT = (PipelineJoin.class.getName() + ".select").intern(); // /** // * Marks the join as "optional" in the SPARQL sense. Binding sets which @@ -149,7 +149,7 @@ * An {@link IConstraint}[] which places restrictions on the legal * patterns in the variable bindings (optional). */ - String CONSTRAINTS = PipelineJoin.class.getName() + ".constraints"; + String CONSTRAINTS = (PipelineJoin.class.getName() + ".constraints").intern(); /** * The maximum parallelism with which the pipeline will consume the @@ -175,7 +175,7 @@ * this option might well go away which would allow us to simplify * the PipelineJoin implementation. */ - String MAX_PARALLEL_CHUNKS = PipelineJoin.class.getName() + ".maxParallelChunks"; + String MAX_PARALLEL_CHUNKS = (PipelineJoin.class.getName() + ".maxParallelChunks").intern(); int DEFAULT_MAX_PARALLEL_CHUNKS = 0; @@ -195,8 +195,8 @@ * * @todo unit tests when (en|dis)abled. */ - String COALESCE_DUPLICATE_ACCESS_PATHS = PipelineJoin.class.getName() - + ".coalesceDuplicateAccessPaths"; + String COALESCE_DUPLICATE_ACCESS_PATHS = (PipelineJoin.class.getName() + + ".coalesceDuplicateAccessPaths").intern(); boolean DEFAULT_COALESCE_DUPLICATE_ACCESS_PATHS = true; @@ -206,7 +206,7 @@ * * @todo Unit tests for this feature (it is used by the JoinGraph). */ - String LIMIT = PipelineJoin.class.getName() + ".limit"; + String LIMIT = (PipelineJoin.class.getName() + ".limit").intern(); long DEFAULT_LIMIT = Long.MAX_VALUE; Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/PartitionedJoinGroup.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/PartitionedJoinGroup.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/PartitionedJoinGroup.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -801,7 +801,7 @@ if (constraints == null) { // replace with an empty array. - constraints = new IConstraint[0]; + constraints = IConstraint.EMPTY; } /* Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/rto/JoinGraph.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/rto/JoinGraph.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/joinGraph/rto/JoinGraph.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -83,25 +83,25 @@ /** * The variables which are projected out of the join graph. */ - String SELECTED = JoinGraph.class.getName() + ".selected"; + String SELECTED = (JoinGraph.class.getName() + ".selected").intern(); /** * The vertices of the join graph, expressed an an {@link IPredicate}[] * (required). */ - String VERTICES = JoinGraph.class.getName() + ".vertices"; + String VERTICES = (JoinGraph.class.getName() + ".vertices").intern(); /** * The constraints on the join graph, expressed an an * {@link IConstraint}[] (optional, defaults to no constraints). */ - String CONSTRAINTS = JoinGraph.class.getName() + ".constraints"; + String CONSTRAINTS = (JoinGraph.class.getName() + ".constraints").intern(); /** * The initial limit for cutoff sampling (default * {@value #DEFAULT_LIMIT}). */ - String LIMIT = JoinGraph.class.getName() + ".limit"; + String LIMIT = (JoinGraph.class.getName() + ".limit").intern(); int DEFAULT_LIMIT = 100; @@ -110,7 +110,7 @@ * cardinality will be used to generate the initial join paths (default * {@value #DEFAULT_NEDGES}). This must be a positive integer. */ - String NEDGES = JoinGraph.class.getName() + ".nedges"; + String NEDGES = (JoinGraph.class.getName() + ".nedges").intern(); int DEFAULT_NEDGES = 2; @@ -119,7 +119,7 @@ * * @see SampleIndex.SampleType */ - String SAMPLE_TYPE = JoinGraph.class.getName() + ".sampleType"; + String SAMPLE_TYPE = (JoinGraph.class.getName() + ".sampleType").intern(); String DEFAULT_SAMPLE_TYPE = SampleType.RANDOM.name(); Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/mutation/InsertOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/mutation/InsertOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/mutation/InsertOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -78,17 +78,17 @@ * @see IPredicate#asBound(IBindingSet) * @see IRelation#newElement(java.util.List, IBindingSet) */ - String SELECTED = InsertOp.class.getName() + ".selected"; + String SELECTED = (InsertOp.class.getName() + ".selected").intern(); /** * The namespace of the relation to which the index belongs. */ - String RELATION = InsertOp.class.getName() + ".relation"; + String RELATION = (InsertOp.class.getName() + ".relation").intern(); /** * The {@link IKeyOrder} for the index. */ - String KEY_ORDER = InsertOp.class.getName() + ".keyOrder"; + String KEY_ORDER = (InsertOp.class.getName() + ".keyOrder").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/ComparatorOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/ComparatorOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/ComparatorOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -55,7 +55,7 @@ * will be imposed and the order (ascending or descending) for each * variable. */ - String ORDER = ComparatorOp.class.getName() + ".order"; + String ORDER = (ComparatorOp.class.getName() + ".order").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/DistinctBindingSetOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/DistinctBindingSetOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/DistinctBindingSetOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -51,7 +51,7 @@ * Binding sets with distinct values for the specified variables will be * passed on. */ - String VARIABLES = DistinctBindingSetOp.class.getName() + ".variables"; + String VARIABLES = (DistinctBindingSetOp.class.getName() + ".variables").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/GroupByOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/GroupByOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/GroupByOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -59,7 +59,7 @@ * {@link #GROUP_BY} declaration as simple {@link IVariable} s; or (b) * be declared by {@link #COMPUTE}. */ - String SELECT = GroupByOp.class.getName() + ".select"; + String SELECT = (GroupByOp.class.getName() + ".select").intern(); // /** // * The ordered set of {@link IValueExpression}s which are to be @@ -90,7 +90,7 @@ * the aggregation groups (required). Variables references will be * resolved against the incoming solutions. */ - String GROUP_BY = GroupByOp.class.getName() + ".groupBy"; + String GROUP_BY = (GroupByOp.class.getName() + ".groupBy").intern(); /** * An {@link IConstraint}[] applied to the aggregated solutions @@ -99,7 +99,7 @@ * TODO Should be the BEV of an {@link IValueExpression}, which might or * might not be an {@link IConstraint}. */ - String HAVING = GroupByOp.class.getName() + ".having"; + String HAVING = (GroupByOp.class.getName() + ".having").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/SliceOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/SliceOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/SliceOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -88,7 +88,7 @@ /** * The first solution to be returned to the caller (origin ZERO). */ - String OFFSET = SliceOp.class.getName() + ".offset"; + String OFFSET = (SliceOp.class.getName() + ".offset").intern(); long DEFAULT_OFFSET = 0L; @@ -96,7 +96,7 @@ * The maximum #of solutions to be returned to the caller (default is * all). */ - String LIMIT = SliceOp.class.getName() + ".limit"; + String LIMIT = (SliceOp.class.getName() + ".limit").intern(); /** * A value of {@link Long#MAX_VALUE} is used to indicate that there is Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/SortOp.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/SortOp.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/solutions/SortOp.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -55,7 +55,7 @@ * * @see ComparatorOp */ - String COMPARATOR = MemorySortOp.class.getName() + ".comparator"; + String COMPARATOR = (MemorySortOp.class.getName() + ".comparator").intern(); } Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/IndexMetadata.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/IndexMetadata.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/btree/IndexMetadata.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -316,9 +316,9 @@ * * @see #DEFAULT_BLOOM_FILTER */ - String BLOOM_FILTER = com.bigdata.btree.BTree.class.getPackage() + String BLOOM_FILTER = (com.bigdata.btree.BTree.class.getPackage() .getName() - + ".bloomFilter"; + + ".bloomFilter").intern(); String DEFAULT_BLOOM_FILTER = "false"; @@ -379,9 +379,9 @@ * application is performing sustained writes on the index (hundreds of * thousands to millions of records). */ - String WRITE_RETENTION_QUEUE_CAPACITY = com.bigdata.btree.AbstractBTree.class + String WRITE_RETENTION_QUEUE_CAPACITY = (com.bigdata.btree.AbstractBTree.class .getPackage().getName() - + ".writeRetentionQueue.capacity"; + + ".writeRetentionQueue.capacity").intern(); /** * The #of entries on the write retention queue that will be scanned for @@ -392,9 +392,9 @@ * incremental writes occur iff the {@link AbstractNode#referenceCount} * is zero and the node or leaf is dirty. */ - String WRITE_RETENTION_QUEUE_SCAN = com.bigdata.btree.AbstractBTree.class + String WRITE_RETENTION_QUEUE_SCAN = (com.bigdata.btree.AbstractBTree.class .getPackage().getName() - + ".writeRetentionQueue.scan"; + + ".writeRetentionQueue.scan").intern(); String DEFAULT_WRITE_RETENTION_QUEUE_CAPACITY = "500";// was 500 @@ -408,17 +408,17 @@ * * FIXME {@link KeyBuilder} configuration support is not finished. */ - String KEY_BUILDER_FACTORY = com.bigdata.btree.AbstractBTree.class + String KEY_BUILDER_FACTORY = (com.bigdata.btree.AbstractBTree.class .getPackage().getName() - + "keyBuilderFactory"; + + "keyBuilderFactory").intern(); /** * Override the {@link IRabaCoder} used for the keys in the nodes of a * B+Tree (the default is a {@link FrontCodedRabaCoder} instance). */ - String NODE_KEYS_CODER = com.bigdata.btree.AbstractBTree.class + String NODE_KEYS_CODER = (com.bigdata.btree.AbstractBTree.class .getPackage().getName() - + "nodeKeysCoder"; + + "nodeKeysCoder").intern(); /** * Override the {@link IRabaCoder} used for the keys of leaves in @@ -426,9 +426,9 @@ * * @see DefaultTupleSerializer#setLeafKeysCoder(IRabaCoder) */ - String LEAF_KEYS_CODER = com.bigdata.btree.AbstractBTree.class + String LEAF_KEYS_CODER = (com.bigdata.btree.AbstractBTree.class .getPackage().getName() - + ".leafKeysCoder"; + + ".leafKeysCoder").intern(); /** * Override the {@link IRabaCoder} used for the values of leaves in @@ -436,9 +436,9 @@ * * @see DefaultTupleSerializer#setLeafValuesCoder(IRabaCoder) */ - String LEAF_VALUES_CODER = com.bigdata.btree.AbstractBTree.class + String LEAF_VALUES_CODER = (com.bigdata.btree.AbstractBTree.class .getPackage().getName() - + ".leafValuesCoder"; + + ".leafValuesCoder").intern(); // /** // * Option determines whether or not per-child locks are used by @@ -492,7 +492,7 @@ * also need to override the {@link Checkpoint} class - for * example the {@link MetadataIndex} does this. */ - String BTREE_CLASS_NAME = BTree.class.getName()+".className"; + String BTREE_CLASS_NAME = (BTree.class.getName()+".className").intern(); /** * The name of an optional property whose value specifies the branching @@ -501,7 +501,7 @@ * @see #DEFAULT_BTREE_BRANCHING_FACTOR * @see #INDEX_SEGMENT_BRANCHING_FACTOR */ - String BTREE_BRANCHING_FACTOR = BTree.class.getName()+".branchingFactor"; + String BTREE_BRANCHING_FACTOR = (BTree.class.getName()+".branchingFactor").intern(); /** * The default branching factor for a mutable {@link BTree}. @@ -595,8 +595,8 @@ * * FIXME Record level compression support is not finished. */ - String BTREE_RECORD_COMPRESSOR_FACTORY = BTree.class.getName() - + ".recordCompressorFactory"; + String BTREE_RECORD_COMPRESSOR_FACTORY = (BTree.class.getName() + + ".recordCompressorFactory").intern(); /** * @@ -614,9 +614,9 @@ * The name of the property whose value specifies the branching factory * for an immutable {@link IndexSegment}. */ - String INDEX_SEGMENT_BRANCHING_FACTOR = IndexSegment.class + String INDEX_SEGMENT_BRANCHING_FACTOR = (IndexSegment.class .getName() - + ".branchingFactor"; + + ".branchingFactor").intern(); /** * The default branching factor for an {@link IndexSegment}. @@ -646,8 +646,8 @@ * @todo should be on by default? (but verify that the unit tests do * not run out of memory when it is enabled by default). */ - String INDEX_SEGMENT_BUFFER_NODES = IndexSegment.class.getName() - + ".bufferNodes"; + String INDEX_SEGMENT_BUFFER_NODES = (IndexSegment.class.getName() + + ".bufferNodes").intern(); /** * @see #INDEX_SEGMENT_BUFFER_NODES @@ -711,8 +711,8 @@ * * FIXME Record level compression support is not finished. */ - String INDEX_SEGMENT_RECORD_COMPRESSOR_FACTORY = IndexSegment.class.getName() - + ".recordCompressorFactory"; + String INDEX_SEGMENT_RECORD_COMPRESSOR_FACTORY = (IndexSegment.class.getName() + + ".recordCompressorFactory").intern(); /** * @@ -796,9 +796,9 @@ * {@link AbstractSubtask} sink handling writes for the associated index * partition. */ - String MASTER_QUEUE_CAPACITY = AsynchronousIndexWriteConfiguration.class + String MASTER_QUEUE_CAPACITY = (AsynchronousIndexWriteConfiguration.class .getName() - + ".masterQueueCapacity"; + + ".masterQueueCapacity").intern(); String DEFAULT_MASTER_QUEUE_CAPACITY = "5000"; @@ -806,9 +806,9 @@ * The desired size of the chunks that the master will draw from its * queue. */ - String MASTER_CHUNK_SIZE = AsynchronousIndexWriteConfiguration.class + String MASTER_CHUNK_SIZE = (AsynchronousIndexWriteConfiguration.class .getName() - + ".masterChunkSize"; + + ".masterChunkSize").intern(); String DEFAULT_MASTER_CHUNK_SIZE = "10000"; @@ -816,9 +816,9 @@ * The time in nanoseconds that the master will combine smaller chunks * so that it can satisfy the desired <i>masterChunkSize</i>. */ - String MASTER_CHUNK_TIMEOUT_NANOS = AsynchronousIndexWriteConfiguration.class + String MASTER_CHUNK_TIMEOUT_NANOS = (AsynchronousIndexWriteConfiguration.class .getName() - + ".masterChunkTimeoutNanos"; + + ".masterChunkTimeoutNanos").intern(); String DEFAULT_MASTER_CHUNK_TIMEOUT_NANOS = "" + TimeUnit.MILLISECONDS.toNanos(50); @@ -830,9 +830,9 @@ * the sink remains responsible rather than blocking inside of the * {@link IAsynchronousIterator} for long periods of time. */ - String SINK_POLL_TIMEOUT_NANOS = AsynchronousIndexWriteConfiguration.class + String SINK_POLL_TIMEOUT_NANOS = (AsynchronousIndexWriteConfiguration.class .getName() - + ".sinkPollTimeoutNanos"; + + ".sinkPollTimeoutNanos").intern(); String DEFAULT_SINK_POLL_TIMEOUT_NANOS = "" + TimeUnit.MILLISECONDS.toNanos(50); @@ -840,9 +840,9 @@ /** * The capacity of the internal queue for the per-sink output buffer. */ - String SINK_QUEUE_CAPACITY = AsynchronousIndexWriteConfiguration.class + String SINK_QUEUE_CAPACITY = (AsynchronousIndexWriteConfiguration.class .getName() - + ".sinkQueueCapacity"; + + ".sinkQueueCapacity").intern(); String DEFAULT_SINK_QUEUE_CAPACITY = "5000"; @@ -850,9 +850,9 @@ * The desired size of the chunks written that will be written by the * {@link AbstractSubtask sink}. */ - String SINK_CHUNK_SIZE = AsynchronousIndexWriteConfiguration.class + String SINK_CHUNK_SIZE = (AsynchronousIndexWriteConfiguration.class .getName() - + ".sinkChunkSize"; + + ".sinkChunkSize").intern(); String DEFAULT_SINK_CHUNK_SIZE = "10000"; @@ -865,9 +865,9 @@ * the index partition. This makes it much easier to adjust the * performance since you simply adjust the {@link #SINK_CHUNK_SIZE}. */ - String SINK_CHUNK_TIMEOUT_NANOS = AsynchronousIndexWriteConfiguration.class + String SINK_CHUNK_TIMEOUT_NANOS = (AsynchronousIndexWriteConfiguration.class .getName() - + ".sinkChunkTimeoutNanos"; + + ".sinkChunkTimeoutNanos").intern(); String DEFAULT_SINK_CHUNK_TIMEOUT_NANOS = "" + Long.MAX_VALUE; @@ -890,9 +890,9 @@ * sink is writing. */ // GTE chunkTimeout - String SINK_IDLE_TIMEOUT_NANOS = AsynchronousIndexWriteConfiguration.class + String SINK_IDLE_TIMEOUT_NANOS = (AsynchronousIndexWriteConfiguration.class .getName() - + ".sinkIdleTimeoutNanos"; + + ".sinkIdleTimeoutNanos").intern(); String DEFAULT_SINK_IDLE_TIMEOUT_NANOS = "" + Long.MAX_VALUE; @@ -916,9 +916,9 @@ * * @see OverflowManager.Options#SCATTER_SPLIT_ENABLED */ - String SCATTER_SPLIT_ENABLED = ScatterSplitConfiguration.class + String SCATTER_SPLIT_ENABLED = (ScatterSplitConfiguration.class .getName() - + ".enabled"; + + ".enabled").intern(); String DEFAULT_SCATTER_SPLIT_ENABLED = "true"; @@ -935,9 +935,9 @@ * performed. The allowable range is therefore constrained to * <code>(0.1 : 1.0)</code>. */ - String SCATTER_SPLIT_PERCENT_OF_SPLIT_THRESHOLD = ScatterSplitConfiguration.class + String SCATTER_SPLIT_PERCENT_OF_SPLIT_THRESHOLD = (ScatterSplitConfiguration.class .getName() - + ".percentOfSplitThreshold"; + + ".percentOfSplitThreshold").intern(); String DEFAULT_SCATTER_SPLIT_PERCENT_OF_SPLIT_THRESHOLD = ".25"; @@ -946,9 +946,9 @@ * to use all discovered data services (default * {@value #DEFAULT_SCATTER_SPLIT_DATA_SERVICE_COUNT}). */ - String SCATTER_SPLIT_DATA_SERVICE_COUNT = ScatterSplitConfiguration.class + String SCATTER_SPLIT_DATA_SERVICE_COUNT = (ScatterSplitConfiguration.class .getName() - + ".dataServiceCount"; + + ".dataServiceCount").intern(); String DEFAULT_SCATTER_SPLIT_DATA_SERVICE_COUNT = "0"; @@ -980,9 +980,9 @@ * asynchronous index writes in order to obtain high throughput with * sustained index writes. */ - String SCATTER_SPLIT_INDEX_PARTITION_COUNT = ScatterSplitConfiguration.class + String SCATTER_SPLIT_INDEX_PARTITION_COUNT = (ScatterSplitConfiguration.class .getName() - + ".indexPartitionCount"; + + ".indexPartitionCount").intern(); String DEFAULT_SCATTER_SPLIT_INDEX_PARTITION_COUNT = "0"; Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/counters/httpd/CounterSetHTTPD.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/counters/httpd/CounterSetHTTPD.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/counters/httpd/CounterSetHTTPD.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -12,6 +12,8 @@ import java.util.Properties; import java.util.Vector; +import org.apache.log4j.Logger; + import com.bigdata.counters.CounterSet; import com.bigdata.counters.query.CounterSetSelector; import com.bigdata.counters.query.ICounterSelector; @@ -30,6 +32,8 @@ */ public class CounterSetHTTPD extends AbstractHTTPD { + static private final Logger log = Logger.getLogger(CounterSetHTTPD.class); + /** * The {@link CounterSet} exposed by this service. */ Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/counters/httpd/CounterSetHTTPDServer.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/counters/httpd/CounterSetHTTPDServer.java 2011-03-01 01:05:33 UTC (rev 4261) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/counters/httpd/CounterSetHTTPDServer.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -140,7 +140,7 @@ Logger.getLogger(XHTMLRenderer.class).setLevel(level); // set logging level on the service. - NanoHTTPD.log.setLevel(level); + Logger.getLogger(NanoHTTPD.class).setLevel(level); } else if (arg.equals("-events")) { Added: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/util/CanonicalFactory.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/util/CanonicalFactory.java (rev 0) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/util/CanonicalFactory.java 2011-03-02 19:15:21 UTC (rev 4262) @@ -0,0 +1,128 @@ +package com.bigdata.util; + +import com.bigdata.cache.ConcurrentWeakValueCache; + +/** + * A pattern for a canonicalizing factory based on a map with weak values. + * + * @param <KEY> + * @param <VAL> + * @param <STATE> + * + * @author thompsonbry + */ +abstract public class CanonicalFactory<KEY, VAL, STATE> { + + /** + * Canonicalizing mapping. + */ +// private WeakValueCache<KEY, VAL> cache; + private ConcurrentWeakValueCache<KEY,VAL> cache; + + /** + * + * @param queueCapacity + * The capacity of the backing hard reference queue. This places + * a lower bound on the #of instances which will be retained by + * the factory. + */ + public CanonicalFactory(final int queueCapacity) { + +// cache = new WeakValueCache<KEY, VAL>(new LRUCache<KEY, VAL>(queueCapacity)); + cache = new ConcurrentWeakValueCache<KEY, VAL>(queueCapacity); + + } + + /** + * Canonical factory pattern. + * + * @param key + * The key. + * @param state + * Additional state from the caller which will be passed through + * to {@link #newInstance(Object, Object)} when creating a new + * instance (optional). + * + * @return The instance paired with that key. + * + * @throws IllegalArgumentException + * if the key is <code>null</code>. + */ + public VAL getInstance(final KEY key, final STATE state) { + + if (key == null) + throw new IllegalArgumentException(); + + // check first w/o lock. + VAL val = cache.get(key); + + if (val != null) { + /* + * Fast code path if entry exists for that key. This amortizes the + * lock costs by relying on the striped locks of the CHM to provide + * less lock contention. + */ + return val; + } + + // obtain lock + synchronized (cache) { + + // check with lock held + val = cache.get(key); + + if (val == null) { + + // create an instance + val = newInstance(key,state); + + // pair that instance with the key in the map. +// cache.put(key, val, true/* dirty */); + cache.put(key, val); + + } + + return val; + + } + + } + + /** + * Remove an entry from the cache. + * <p> + * Note: It is sometimes necessary to clear a cache entry. For example, if a + * pers... [truncated message content] |