
com.github.dennisit.vplus.tutorial.VPlusStrap Maven / Gradle / Ivy
The newest version!
/*--------------------------------------------------------------------------
* Copyright (c) 2010-2020, Elon.su All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the elon developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Elon.su, you can also mail [email protected]
*--------------------------------------------------------------------------
*/
package com.github.dennisit.vplus.tutorial;
import com.github.dennisit.vplus.core.bean.VdbBean;
import com.github.dennisit.vplus.core.enums.DbType;
import com.github.dennisit.vplus.data.metric.JMetricContext;
import com.github.dennisit.vplus.data.metric.config.JMetricConfig;
import com.github.dennisit.vplus.data.metric.metric.JMetricClient;
import com.github.dennisit.vplus.data.metric.pipeline.SystemPipeline;
import com.github.dennisit.vplus.html.vstrap.VplusHtmlBootstrap;
import com.github.dennisit.vplus.mvc.vstrap.VplusMvcBootstrap;
import org.springframework.web.client.RestTemplate;
/**
* Created by Elon.su on 17/3/7.
*/
public class VPlusStrap {
public static void main(String[] args) {
VdbBean vdbBean = new VdbBean();
vdbBean.setDbType(DbType.MYSQL);
vdbBean.setDriverClassName("com.mysql.jdbc.Driver");
vdbBean.setUsername("root");
vdbBean.setPassword("123");
vdbBean.setUrl("jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8");
VplusMvcBootstrap.dbBorn(vdbBean, "com.wuyu.platform.module.wuyu", "vplus-tutorial/src/main/java");
//VplusHtmlBootstrap.anoBorn("com.wuyu.platform.module.wuyu.entity", "vplus-tutorial/src/main/gen");
}
public static void metric() throws Exception {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
for(int i=0; i<1000; i++){
JMetricClient.add("key1", 32423);
JMetricClient.add("key1", 3231);
JMetricClient.add("key1", 3234);
JMetricClient.add("key2", 111);
JMetricClient.add("key2", 114);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
thread.start();
JMetricContext context = new JMetricContext();
context.configure(new JMetricConfig(true, 0L, 1L));
context.addPipeline(new SystemPipeline());
context.initialized();
Thread.sleep(5000);
context.destroyed();
thread.stop();
System.exit(-1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy