554325746@qq.com
2019-08-07 2539f53391765abb74b6fe63f46e5a2c701e950f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.basic.security.manager.impl.erlang;
 
import com.ericsson.otp.erlang.OtpConnection;
 
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
 
public class ErBaseManger {
 
    public static OtpConnection otpConnection;
 
    public static ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor
            (1, 2, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(50),
                    //2.加上调用线程任务本身去run
                    new ThreadPoolExecutor.CallerRunsPolicy()
            );
 
    /**
     *  数据的同步
     * @param sql1
     * @return
     */
    public static boolean executeSqlInCluster(String sql1) {
//        if (1 == 1){
//            return true;
//        }
        threadPoolExecutor.execute(new Runnable() {
            public void run() {
                SqliteManager.executeInCache(ErlangConnection.getLocalConnection(), sql1);
            }
        });
        return true;
    }
 
}