maven dubbo

来源:互联网 发布:chinanet登陆软件 编辑:程序博客网 时间:2024/06/11 01:29

好用的maven工具intelligent java (IntelliJ IDEA 15.0)网上有破解方法,用程序生成破解码

注意官方的dubbox底下很多的文件夹都是有用的,要一起编译。

简介参考http://www.cnblogs.com/yjmyzz/p/dubbox-demo.html 要不我一会把这篇转载过来。

<pre name="code" class="java">private int initialSize = 10;private int minIdle = 10;private int maxActive = 100;private long maxWait = DruidDataSource.DEFAULT_MAX_WAIT;// 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒private long timeBetweenEvictionRunsMillis = DruidDataSource.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS;// 配置连接在池中最小生存的时间private long minEvictableIdleTimeMillis = DruidDataSource.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS;// 配置发生错误时多久重连private long timeBetweenConnectErrorMillis = DruidDataSource.DEFAULT_TIME_BETWEEN_CONNECT_ERROR_MILLIS;private String validationQuery = "select 1";private boolean testWhileIdle = true;private boolean testOnBorrow = false;private boolean testOnReturn = false;// 是否打开连接泄露自动检测private boolean removeAbandoned = false;// 连接长时间没有使用,被认为发生泄露时长private long removeAbandonedTimeoutMillis = 300 * 1000;// 发生泄露时是否需要输出 log,建议在开启连接泄露检测时开启,方便排错private boolean logAbandoned = false;

public String hello(String name) { if(init==false){// dp= new DruidPlugin("jdbc:mysql://*****/ocr?characterEncoding=utf8",// "ocr", "*****","com.mysql.jdbc.Driver", "stat");// dp.setMaxActive(10);// dp.setMaxPoolPreparedStatementPerConnectionSize(10); arp= new ActiveRecordPlugin(new IDataSourceProvider() {@Overridepublic DataSource getDataSource() {DruidDataSource ds = new DruidDataSource();ds.setUrl(url);ds.setUsername(username);ds.setPassword(password);if (driverClass != null)ds.setDriverClassName(driverClass);ds.setInitialSize(initialSize);ds.setMinIdle(5);ds.setMaxActive(maxActive);ds.setMaxWait(maxWait);ds.setTimeBetweenConnectErrorMillis(timeBetweenConnectErrorMillis);ds.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);ds.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);ds.setValidationQuery(validationQuery);ds.setTestWhileIdle(testWhileIdle);ds.setTestOnBorrow(testOnBorrow);ds.setTestOnReturn(testOnReturn);ds.setRemoveAbandoned(removeAbandoned);ds.setRemoveAbandonedTimeoutMillis(removeAbandonedTimeoutMillis);ds.setLogAbandoned(logAbandoned);//只要maxPoolPreparedStatementPerConnectionSize>0,poolPreparedStatements就会被自动设定为true,参照druid的源码ds.setMaxPoolPreparedStatementPerConnectionSize(10);// if (StrKit.notBlank(filters))// try {ds.setFilters(filters);} catch (SQLException e) {throw new RuntimeException(e);}// addFilterList(ds);return ds;}});// arp.addMapping("ocr_user","user_id", User.class); // 与web环境唯一的不同是要手动调用一次相关插件的start()方法// dp.start(); arp.start(); init=true; } // 通过上面简单的几行代码,即可立即开始使用 //new Blog().set("title", "title").set("content", "cxt text").save(); //User.dao.findById(1);// User user = User.dao.findById (1);// String session = user.getStr("session_key"); Date date=Db.queryDate("select now()");Record session = Db.findFirst("select session_key from ocr_user where user_id = 3");//String s="aa"; return "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"+date+"hello " + name+" "+session.getStr("session_key"); }

上面代码可以在dubbo中用于jfinal


0 0
原创粉丝点击