use of com.codahale.metrics.MetricRegistry in project cxf by apache.
the class Client method main.
public static void main(String[] args) throws Exception {
if (args.length == 0) {
args = new String[] { SOAPService.WSDL_LOCATION.toExternalForm() };
}
URL wsdlURL;
File wsdlFile = new File(args[0]);
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
Map<String, Object> properties = new HashMap<>();
properties.put("bus.jmx.usePlatformMBeanServer", Boolean.TRUE);
properties.put("bus.jmx.enabled", Boolean.TRUE);
properties.put("bus.jmx.createMBServerConnectorFactory", Boolean.FALSE);
Bus b = new CXFBusFactory().createBus(null, properties);
MetricRegistry registry = new MetricRegistry();
CodahaleMetricsProvider.setupJMXReporter(b, registry);
b.setExtension(registry, MetricRegistry.class);
SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
List<Client> c = new ArrayList<>();
Client client;
client = new Client("Tom", ss);
new Thread(client).start();
c.add(client);
client = new Client("Rob", ss);
new Thread(client).start();
c.add(client);
client = new Client("Vince", ss);
new Thread(client).start();
c.add(client);
client = new Client("Malcolm", ss);
new Thread(client).start();
c.add(client);
client = new Client("Jonas", ss);
new Thread(client).start();
c.add(client);
System.out.println("Sleeping on main thread for 60 seconds");
Thread.sleep(60000);
for (Client c2 : c) {
c2.stop();
}
Thread.sleep(2000);
Thread.sleep(1000000);
// System.exit(0);
}
use of com.codahale.metrics.MetricRegistry in project cxf by apache.
the class ServerMisc method run.
protected void run() {
Factory factory = new PerRequestFactory(DocLitWrappedCodeFirstServiceImpl.class);
factory = new PooledFactory(factory, 4);
JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
JaxWsServerFactoryBean factoryBean;
Map<String, Object> properties = new HashMap<>();
properties.put("bus.jmx.usePlatformMBeanServer", Boolean.TRUE);
properties.put("bus.jmx.enabled", Boolean.TRUE);
Bus b = new CXFBusFactory().createBus(null, properties);
setBus(b);
MetricRegistry registry = new MetricRegistry();
CodahaleMetricsProvider.setupJMXReporter(b, registry);
b.setExtension(registry, MetricRegistry.class);
factoryBean = new JaxWsServerFactoryBean();
factoryBean.setBus(b);
factoryBean.setAddress(DOCLIT_CODEFIRST_URL);
factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
factoryBean.setInvoker(invoker);
servers.add(factoryBean.create());
factoryBean = new JaxWsServerFactoryBean();
factoryBean.setBus(b);
factoryBean.setAddress(DOCLIT_CODEFIRST_URL_XMLBINDING);
factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
factoryBean.setInvoker(invoker);
factoryBean.setBindingId("http://cxf.apache.org/bindings/xformat");
factoryBean.setWsdlURL("cxf6866.wsdl");
servers.add(factoryBean.create());
factoryBean = new JaxWsServerFactoryBean();
factoryBean.setAddress(DOCLIT_CODEFIRST_SETTINGS_URL);
factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
factoryBean.setInvoker(invoker);
factoryBean.getServiceFactory().setAnonymousWrapperTypes(true);
factoryBean.getServiceFactory().getServiceConfigurations().add(0, new AbstractServiceConfiguration() {
public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
return Boolean.TRUE;
}
public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
return Long.valueOf(1L);
}
});
servers.add(factoryBean.create());
// Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
// endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4));
Object implementor7 = new DocLitBareCodeFirstServiceImpl();
EndpointImpl ep = (EndpointImpl) Endpoint.publish(DOCLITBARE_CODEFIRST_URL, implementor7);
ep.getServer().getEndpoint().getInInterceptors().add(new SAAJInInterceptor());
endpoints.add(ep);
Object implementor6 = new InterfaceInheritTestImpl();
endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_BASE_URL, implementor6));
Object implementor1 = new AnonymousComplexTypeImpl();
String address = "http://localhost:" + PORT + "/anonymous_complex_typeSOAP";
endpoints.add(Endpoint.publish(address, implementor1));
Object implementor2 = new JaxbElementTestImpl();
address = "http://localhost:" + PORT + "/jaxb_element_test";
endpoints.add(Endpoint.publish(address, implementor2));
Object implementor3 = new OrderedParamHolderImpl();
address = "http://localhost:" + PORT + "/ordered_param_holder/";
endpoints.add(Endpoint.publish(address, implementor3));
// Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
// endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4));
Object implementor5 = new RpcLitCodeFirstServiceImpl();
endpoints.add(Endpoint.publish(RPCLIT_CODEFIRST_URL, implementor5));
endpoints.add(Endpoint.publish("http://localhost:" + PORT + "/InheritContext/InheritPort", new InheritImpl()));
endpoints.add(Endpoint.publish(CXF_5064_URL, new SOAPHeaderServiceImpl()));
}
use of com.codahale.metrics.MetricRegistry in project grakn by graknlabs.
the class GraknEngineServerFactory method createGraknEngineServer.
/**
* Create a {@link GraknEngineServer} configured for Grakn Core. Grakn Queue (which is needed for post-processing and distributed locks) is implemented with Redis as the backend store
*
* @return a {@link GraknEngineServer} instance configured for Grakn Core
*/
public static GraknEngineServer createGraknEngineServer() {
// grakn engine configuration
EngineID engineId = EngineID.me();
GraknConfig config = GraknConfig.create();
GraknEngineStatus status = new GraknEngineStatus();
MetricRegistry metricRegistry = new MetricRegistry();
// redis
RedisWrapper redisWrapper = RedisWrapper.create(config);
QueueSanityCheck queueSanityCheck = new RedisSanityCheck(redisWrapper);
// distributed locks
LockProvider lockProvider = new JedisLockProvider(redisWrapper.getJedisPool());
SystemKeyspaceSession systemKeyspaceSession = new GraknSystemKeyspaceSession(config);
GraknKeyspaceStore graknKeyspaceStore = GraknKeyspaceStoreImpl.create(systemKeyspaceSession);
// tx-factory
EngineGraknTxFactory engineGraknTxFactory = EngineGraknTxFactory.create(lockProvider, config, graknKeyspaceStore);
// post-processing
IndexStorage indexStorage = RedisIndexStorage.create(redisWrapper.getJedisPool(), metricRegistry);
CountStorage countStorage = RedisCountStorage.create(redisWrapper.getJedisPool(), metricRegistry);
IndexPostProcessor indexPostProcessor = IndexPostProcessor.create(lockProvider, indexStorage);
CountPostProcessor countPostProcessor = CountPostProcessor.create(config, engineGraknTxFactory, lockProvider, metricRegistry, countStorage);
PostProcessor postProcessor = PostProcessor.create(indexPostProcessor, countPostProcessor);
// http services: spark, http controller, and gRPC server
Service sparkHttp = Service.ignite();
Collection<HttpController> httpControllers = Collections.emptyList();
GrpcServer grpcServer = configureGrpcServer(config, engineGraknTxFactory, postProcessor);
return createGraknEngineServer(engineId, config, status, sparkHttp, httpControllers, grpcServer, engineGraknTxFactory, metricRegistry, queueSanityCheck, lockProvider, postProcessor, graknKeyspaceStore);
}
use of com.codahale.metrics.MetricRegistry in project oap by oaplatform.
the class InfluxDBReporterTest method beforeMethod.
@BeforeMethod
@Override
public void beforeMethod() throws Exception {
super.beforeMethod();
influxDB = new MockInfluxDB();
registry = new MetricRegistry();
DateTimeUtils.setCurrentMillisFixed(1454055727921L);
}
use of com.codahale.metrics.MetricRegistry in project engineblock by engineblock.
the class Scenario method init.
private void init() {
MetricRegistry metricRegistry = ActivityMetrics.getMetricRegistry();
scriptEngine = engineManager.getEngineByName("nashorn");
scriptEnv = new ScenarioContext(scenarioController);
scriptEngine.setContext(scriptEnv);
scenarioController = new ScenarioController();
progressIndicator = new ProgressIndicator(scenarioController, progressInterval);
scriptEngine.put("scenario", scenarioController);
scriptEngine.put("activities", new ScenarioBindings(scenarioController));
scriptEngine.put("metrics", new MetricRegistryBindings(metricRegistry));
for (ScriptingPluginInfo extensionDescriptor : SandboxExtensionFinder.findAll()) {
if (!extensionDescriptor.isAutoLoading()) {
logger.info("Not loading " + extensionDescriptor + ", autoloading is false");
continue;
}
org.slf4j.Logger extensionLogger = LoggerFactory.getLogger("extensions." + extensionDescriptor.getBaseVariableName());
Object extensionObject = extensionDescriptor.getExtensionObject(extensionLogger, metricRegistry, scriptEnv);
logger.debug("Adding extension object: name=" + extensionDescriptor.getBaseVariableName() + " class=" + extensionObject.getClass().getSimpleName());
scriptEngine.put(extensionDescriptor.getBaseVariableName(), extensionObject);
}
}
Aggregations