ReentrantLock的常用方法,lock、tryLock和unlock。 截图主要分析部分的源码如下: public class ReentrantLock implements Lock, java.io.Serializable { private static final long se ...
分类:
其他好文 时间:
2019-02-16 13:54:19
阅读次数:
148
/** * 属性工具类 * @author admin * 参考:https://www.cnblogs.com/doudouxiaoye/p/5693454.html */ public class PropertiesUtil { private static Properties pro=nu ...
分类:
其他好文 时间:
2019-02-16 12:10:43
阅读次数:
153
public class RotateTextView extends AppCompatTextView { private static final int DEFAULT_DEGREES = 0; private int mDegrees; public RotateTextView(Cont... ...
分类:
移动开发 时间:
2019-02-15 14:02:48
阅读次数:
220
发送post请求,通过回调获取相应参数;在发送的url中添加参数,通过回调,获取其相应的参数值: eg: 1、快递100发送post请求,进行订阅: public class ExpressRegisterServiceImpl { // 回调接口的地址 private static final S ...
分类:
Web程序 时间:
2019-02-12 00:12:35
阅读次数:
852
/** * 将集合中的内容按时间排序 * @param list */ private static void ListSort(List<BossMsgInfo> list) { Collections.sort(list, new Comparator<BossMsgInfo>() { publ ...
分类:
编程语言 时间:
2019-02-11 17:06:40
阅读次数:
207
1.单例模式: 程序开发的时候,有些对象只能有一个.有实例,且只有一个,比如工具类. 修改构造方法为私有的. 饿汉模式: 线程安全 创建一个实例 Private Static 实例; 提供一个静态方法,这样就可以访问到了. 懒汉模式: 线程不安全 创建一个实例 Private Static 实例,设... ...
分类:
编程语言 时间:
2019-02-09 19:25:55
阅读次数:
181
class Sign_verifySign { #region prepare string to sign. //example format: a=123&b=xxx&c (with sort) private static string encrypt(T body) { var mType ... ...
public class DBCPUtil { private static DataSource ds = null; static { Properties prop = new Properties(); //根据DBCPUtil的classes的路径,加载配置文件 try { prop.lo ...
分类:
其他好文 时间:
2019-02-05 19:43:16
阅读次数:
175
1 private static final int maxDiv10 = Integer.MAX_VALUE / 10; 2 3 public int atoi(String str) { 4 int i = 0; 5 int n = str.length(); 6 // 首先忽略字符串前面的空格... ...
分类:
其他好文 时间:
2019-02-02 19:10:33
阅读次数:
182
1 互斥锁lock(基于Monitor实现) 定义: private static readonly object Lock = new object(); 使用: lock (Lock) { //todo } 作用:将会锁住代码块的内容,并阻止其他线程进入该代码块,直到该代码块运行完成,释放该锁。 ...