javax.crypto.Cipher 每次都要实例化,大量的实例化导致 Cipher 实例化失败. 解决办法:将已经实例化的Cipher对象,放在hashmap中,每次实例化的时候从MAP 获取,不存在的时候再进行实例化,问题解决 // 如果密钥不足16位,那么就补足. 这个if 中的内容很重要 int base = 16; if (keyBytes.length % base != 0) { int groups = keyBytes.length / base + (keyBytes.le
java异常介绍 异常时相对于return的一种退出机制,可以由系统触发,也可由程序通过throw语句触发,异常可以通过try/catch语句进行捕获并处理,如果没有捕获,则会导致程序退出并输出异常栈信息,异常有不同的类型,所有异常类都有一个共同的父类Throwable,下面我们先从Throwable开始介绍. Throwable Throwable是所有异常类的父类,有四个构造方法 public Throwable(Throwable cause) public Throwable(Strin
ThreadLocal全面解析 学习目标 了解ThreadLocal的介绍 掌握ThreadLocal的运用场景 了解ThreadLocal的内部结构 了解ThreadLocal的核心方法源码 了解ThreadLocalMap的源码 1. ThreadLocal介绍 1.1 官方介绍 /** * This class provides thread-local variables. These variables differ from * their normal counterparts i
一.事务的概念 事务指逻辑上的一组操作,组成这组操作的各个单元,要不全部成功,要不全部不成功. 例如:A——B转帐,对应于如下两条sql语句 update from account set money=money+100 where name='B'; update from account set money=money-100 where name='A'; 二.MySQL数据库中操作事务命令 1.编写测试SQL脚本,如下: /*创建账户表*/ create table account(
一.事务的概念 事务指逻辑上的一组操作,组成这组操作的各个单元,要不全部成功,要不全部不成功. 例如:A——B转帐,对应于如下两条sql语句 update from account set money=money+100 where name='B'; update from account set money=money-100 where name='A'; 二.MySQL数据库中操作事务命令 1.编写测试SQL脚本,如下: 1 /*创建账户表*/ 2 create table acco