
java
WangGaozhuo
这个作者很懒,什么都没留下…
展开
-
mySql主从复制实操步骤
1.配置主库:my.ini[mysqld]log-bin=catic_logserver-id=31412.配置从库my.ini[mysqld]server-id=31423.在主库上执行CREATE USER 'repl'@'%' IDENTIFIED BY '123456';GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';//mys...原创 2020-04-29 19:40:47 · 315 阅读 · 0 评论 -
Java中Volatile关键字
Volatile原理 Java语言提供了一种稍弱的同步机制,即volatile变量,用来确保将变量的更新操作通知到其他线程。当把变量声明为volatile类型后,编译器与运行时都会注意到这个变量是共享的,因此不会将该变量上的操作与其他内存操作一起重排序。volatile变量不会被缓存在寄存器或者对其他处理器不可见的地方,因此在读取volatile类型的变量时总会返回最新写入的值。...原创 2019-08-06 09:50:37 · 156 阅读 · 0 评论 -
error: Exited sync due to fetch errors
$ repo sync -j8同步code到一半的时候出现了error: Exited sync due to fetch errors$repo sync -f -j8 //加-f问题解决。转载 2018-12-04 10:44:08 · 10172 阅读 · 0 评论 -
springboot 启用事务不生效
1.mysql表必须支持事务 修改表引擎方法 alter table table_name engine=innodb;2.springboot启用事务@SpringBootApplication@EnableTransactionManagement//启用事务public class CofferApplication { public static void ...原创 2018-10-10 10:46:58 · 2854 阅读 · 1 评论 -
单点登录解决方案
原创 2018-07-19 09:38:09 · 257 阅读 · 0 评论 -
JNI 开发步骤
1.编写native 方法2.javah 命令,生成.h 文件 “java_类的全名_方法名” 或者自己手写3.复制.h 头文件到cpp 工程4.复制jni.h 和jni_md.h5.实现.h 头文件中的声明函数6.生成一个dll 动态库7.在java中加载动态库8.触发native函数...原创 2018-04-21 17:08:55 · 331 阅读 · 0 评论 -
netty 例子
客户端:public class TimeClient {public void connect(int port, String host){EventLoopGroup group = new NioEventLoopGroup();Bootstrap b = new Bootstrap();b.group(group).channel(NioSocketChannel.class...原创 2016-03-21 18:54:20 · 505 阅读 · 0 评论 -
线程池例子
public class TestThread {public static void main(String[] args) throws InterruptedException, ExecutionException {ExecutorService service = Executors.newSingleThreadExecutor();Future原创 2015-07-17 16:08:38 · 369 阅读 · 0 评论 -
在一串字符中匹配出4个连续的数字
String str = "【中兴视通】cool170:您的注asdfjaskljhklasdjakl;qweopgm55555fgsdfg,emklemklwe册验证码为9526,请于2分钟内正确输入验证码。";Pattern pattern = Pattern.compile("(?Matcher matcher = pattern.matcher(str);if(matcher.原创 2015-11-18 16:49:32 · 5675 阅读 · 0 评论 -
git用法
git config --global user.name "wanggaozhuo" git config --global user.email "wanggaozhuo@yeah.net" git init //初始化仓库 git add readme.txt//添加文件到git git status git diff git log git reset --ha原创 2015-11-20 09:17:20 · 306 阅读 · 0 评论 -
单例
public static EventBus getDefault() { if (defaultInstance == null) { synchronized (EventBus.class) { if (defaultInstance == null) { defaultI原创 2015-10-27 17:16:18 · 286 阅读 · 0 评论