Github user cestella commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/345#discussion_r86785336
--- Diff:
metron-analytics/metron-profiler-client/src/main/java/org/apache/metron/profiler/client/stellar/GetProfile.java
---
@@ -132,35 +144,33 @@
private static final Logger LOG =
LoggerFactory.getLogger(GetProfile.class);
- /**
- * A client that can retrieve profile values.
- */
+
+ // Global configuration from client context, used to help create
profiler client.
+ private Map<String, Object> global;
+
+ // Cached client that can retrieve profile values.
private ProfilerClient client;
+ // Cached value of config override map used to construct the previously
cached client.
+ private Map cachedConfigOverrideMap = null;
+
/**
* Initialization.
*/
@Override
public void initialize(Context context) {
-
// ensure the required capabilities are defined
Context.Capabilities[] required = { GLOBAL_CONFIG };
validateCapabilities(context, required);
- Map<String, Object> global = (Map<String, Object>)
context.getCapability(GLOBAL_CONFIG).get();
-
- // create the profiler client
- RowKeyBuilder rowKeyBuilder = getRowKeyBuilder(global);
- ColumnBuilder columnBuilder = getColumnBuilder(global);
- HTableInterface table = getTable(global);
- client = new HBaseProfilerClient(table, rowKeyBuilder, columnBuilder);
+ global = (Map<String, Object>)
context.getCapability(GLOBAL_CONFIG).get();
--- End diff --
If the global config changes, you probably want to pick that up
post-initialization. I would calling
`context.getCapability(GLOBAL_CONFIG).get()` from the apply rather than caching
a copy.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---