Administrator
2023-04-19 40ec16bbb7c9d23df625aa31ae42ac36e901749d
提交 | 用户 | 时间
58d006 1 package com.mandi.fendan.util;
A 2
3 public class Runtest implements Runnable{
4     
5     @Override
6     public void run() {
7         
8 //        System.err.println(Thread.currentThread().getName());
9 //        synchronized (new Object()) {
10             String str=DBchecksingleton.setDbc(Thread.currentThread().getName(), false);
11             if(str.equals(Thread.currentThread().getName())){
12                 System.err.println("A:::::"+str+"::::时间:::"+System.nanoTime());
13                 String crd=DBchecksingleton.setDbc(Thread.currentThread().getName(), true);
14                 System.err.println(str+"B:::::"+crd+"::::时间:::"+System.nanoTime());
15             }else{
16                 String rrr=DBchecksingleton.setDbc(Thread.currentThread().getName(), true);
17                 if(rrr==null){
18                     System.err.println("C:::::"+Thread.currentThread().getName()+"::::时间:::"+System.nanoTime());
19                 }else{
20                     System.err.println(rrr+"::::D:::::"+Thread.currentThread().getName()+"::::时间:::"+System.nanoTime());
21                 }
22 //                 System.err.println("ddd:::::"+str);
23 //                 System.err.println("fff:::::"+rrr);
24             }
25 //        }
26         //新建对象Lockerp放当前erp数据库有没有修改操作
27             // lockerp是一个map  key放入dbsign:放入Connection
28         //所有的修改erp操作都事先需要判断一下当前值Lockerp能否找到
29         //放入Lockerp当前操作erp的值
30         //调用同步线程Runerp:不知道有多个请求的时候在线程后面排队的时间会不会太长
31             //同步线程传入参数Connection
32             //如果Connection相等 休眠
33             //如果Connection不相等  而且
34         //Runerp操作:
35         //Runerp返回结果
36         
37     }
38     
39     public static void main(String[] args){
40         Runtest t=new Runtest();
41         for (int i = 1; i < 110; i++) {
42             new Thread(t,"name:"+i).start();
43         }
44     }
45 }