Search in sources :

Example 1 with SamplingNodeExtension

use of com.hazelcast.test.compatibility.SamplingNodeExtension in project hazelcast by hazelcast.

the class MockNodeContext method constructSamplingNodeExtension.

/**
 * @return {@code NodeExtension} suitable for sampling serialized objects in OSS or EE environment
 */
@SuppressWarnings("unchecked")
private static NodeExtension constructSamplingNodeExtension(Node node) {
    if (BuildInfoProvider.getBuildInfo().isEnterprise()) {
        try {
            Class<? extends NodeExtension> klass = (Class<? extends NodeExtension>) Class.forName("com.hazelcast.test.compatibility.SamplingEnterpriseNodeExtension");
            Constructor<? extends NodeExtension> constructor = klass.getConstructor(Node.class);
            return constructor.newInstance(node);
        } catch (Exception e) {
            throw rethrow(e);
        }
    } else {
        NodeExtension wrapped = NodeExtensionFactory.create(node, DefaultNodeContext.EXTENSION_PRIORITY_LIST);
        return new SamplingNodeExtension(wrapped);
    }
}
Also used : NodeExtension(com.hazelcast.instance.impl.NodeExtension) SamplingNodeExtension(com.hazelcast.test.compatibility.SamplingNodeExtension) SamplingNodeExtension(com.hazelcast.test.compatibility.SamplingNodeExtension)

Aggregations

NodeExtension (com.hazelcast.instance.impl.NodeExtension)1 SamplingNodeExtension (com.hazelcast.test.compatibility.SamplingNodeExtension)1