1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.hadoop.hbase.hbql.executor;
22
23 import org.apache.expreval.expr.ArgumentListTypeSignature;
24 import org.apache.expreval.expr.ExpressionProperty;
25 import org.apache.expreval.expr.PropertyType;
26 import org.apache.expreval.expr.node.BooleanValue;
27 import org.apache.expreval.expr.node.GenericValue;
28 import org.apache.expreval.expr.node.IntegerValue;
29 import org.apache.expreval.expr.node.LongValue;
30
31 public class ExecutorProperty extends ExpressionProperty {
32
33 public static enum Type implements PropertyType {
34
35 MAX_EXECUTOR_POOL_SIZE(new ArgumentListTypeSignature(IntegerValue.class)),
36 MIN_THREAD_COUNT(new ArgumentListTypeSignature(IntegerValue.class)),
37 MAX_THREAD_COUNT(new ArgumentListTypeSignature(IntegerValue.class)),
38 KEEP_ALIVE_SECS(new ArgumentListTypeSignature(LongValue.class)),
39 THREADS_READ_RESULTS(new ArgumentListTypeSignature(BooleanValue.class)),
40 COMPLETION_QUEUE_SIZE(new ArgumentListTypeSignature(IntegerValue.class));
41
42 private final ArgumentListTypeSignature typeSignature;
43 private final String description;
44
45 Type(final ArgumentListTypeSignature typeSignature) {
46 this.typeSignature = typeSignature;
47 this.description = this.name();
48 }
49
50 public ArgumentListTypeSignature getTypeSignature() {
51 return this.typeSignature;
52 }
53
54 public String getDescription() {
55 return this.description;
56 }
57 }
58
59 public ExecutorProperty(final String text, final GenericValue arg0) {
60 super(ExecutorProperty.Type.valueOf(text.toUpperCase()), arg0);
61 }
62
63 public Type getEnumType() {
64 return (Type)this.getPropertyType();
65 }
66
67 public String asString() {
68 return this.getPropertyType().getDescription() + ": " + this.getGenericValue(0).asString();
69 }
70 }