OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 142 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 142 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 26... Line 26...
26
import org.openconcerto.sql.model.SQLSystem;
26
import org.openconcerto.sql.model.SQLSystem;
27
import org.openconcerto.sql.model.SQLTable;
27
import org.openconcerto.sql.model.SQLTable;
28
import org.openconcerto.sql.model.graph.TablesMap;
28
import org.openconcerto.sql.model.graph.TablesMap;
29
import org.openconcerto.sql.utils.CSVHandler;
29
import org.openconcerto.sql.utils.CSVHandler;
30
import org.openconcerto.sql.utils.ChangeTable;
30
import org.openconcerto.sql.utils.ChangeTable;
-
 
31
import org.openconcerto.sql.utils.ChangeTable.FCSpec;
31
import org.openconcerto.sql.utils.SQLCreateMoveableTable;
32
import org.openconcerto.sql.utils.SQLCreateMoveableTable;
32
import org.openconcerto.sql.utils.SQLCreateRoot;
33
import org.openconcerto.sql.utils.SQLCreateRoot;
33
import org.openconcerto.sql.utils.SQLCreateTableBase;
34
import org.openconcerto.sql.utils.SQLCreateTableBase;
34
import org.openconcerto.sql.utils.SQLUtils;
35
import org.openconcerto.sql.utils.SQLUtils;
35
import org.openconcerto.sql.utils.ChangeTable.FCSpec;
-
 
36
import org.openconcerto.utils.FileUtils;
36
import org.openconcerto.utils.FileUtils;
37
import org.openconcerto.utils.RTInterruptedException;
37
import org.openconcerto.utils.RTInterruptedException;
38
import org.openconcerto.utils.ThreadFactory;
38
import org.openconcerto.utils.ThreadFactory;
39
import org.openconcerto.utils.cc.IClosure;
39
import org.openconcerto.utils.cc.IClosure;
40
 
40
 
Line 44... Line 44...
44
import java.sql.SQLException;
44
import java.sql.SQLException;
45
import java.util.ArrayList;
45
import java.util.ArrayList;
46
import java.util.HashMap;
46
import java.util.HashMap;
47
import java.util.List;
47
import java.util.List;
48
import java.util.Map;
48
import java.util.Map;
49
import java.util.Set;
-
 
50
import java.util.Map.Entry;
49
import java.util.Map.Entry;
-
 
50
import java.util.Set;
51
import java.util.concurrent.Callable;
51
import java.util.concurrent.Callable;
52
import java.util.concurrent.CancellationException;
52
import java.util.concurrent.CancellationException;
53
import java.util.concurrent.ExecutionException;
53
import java.util.concurrent.ExecutionException;
54
import java.util.concurrent.Executors;
54
import java.util.concurrent.Executors;
55
import java.util.concurrent.Future;
55
import java.util.concurrent.Future;
56
import java.util.concurrent.ScheduledExecutorService;
56
import java.util.concurrent.ScheduledExecutorService;
57
import java.util.concurrent.ScheduledFuture;
57
import java.util.concurrent.ScheduledFuture;
58
import java.util.concurrent.TimeUnit;
58
import java.util.concurrent.TimeUnit;
59
import java.util.concurrent.atomic.AtomicInteger;
59
import java.util.concurrent.atomic.AtomicInteger;
60
 
60
 
-
 
61
import org.apache.commons.dbutils.ResultSetHandler;
-
 
62
 
61
import net.jcip.annotations.GuardedBy;
63
import net.jcip.annotations.GuardedBy;
62
import net.jcip.annotations.ThreadSafe;
64
import net.jcip.annotations.ThreadSafe;
63
 
65
 
64
import org.apache.commons.dbutils.ResultSetHandler;
-
 
65
 
-
 
66
/**
66
/**
67
 * Allow to replicate some tables in memory.
67
 * Allow to replicate some tables in memory.
68
 * 
68
 * 
69
 * @author Sylvain
69
 * @author Sylvain
70
 */
70
 */
Line 102... Line 102...
102
                throw new IllegalStateException();
102
                throw new IllegalStateException();
103
        } else {
103
        } else {
104
            this.singleRootName = null;
104
            this.singleRootName = null;
105
        }
105
        }
106
        // private in-memory database
106
        // private in-memory database
107
        this.slave = new SQLServer(SQLSystem.H2, "mem", null, null, null, new IClosure<DBSystemRoot>() {
107
        this.slave = new SQLServer(SQLSystem.H2, SQLSystem.H2_IN_MEMORY, null, null, null, new IClosure<DBSystemRoot>() {
108
            @Override
108
            @Override
109
            public void executeChecked(DBSystemRoot input) {
109
            public void executeChecked(DBSystemRoot input) {
110
                input.setRootsToMap(tables.keySet());
110
                input.setRootsToMap(tables.keySet());
111
                // don't waste time on cache for transient data
111
                // don't waste time on cache for transient data
112
                input.initUseCache(false);
112
                input.initUseCache(false);