use of org.h2.message.Trace in project h2database by h2database.
the class TestValueMemory method test.
@Override
public void test() throws SQLException {
testCompare();
for (int i = 0; i < Value.TYPE_COUNT; i++) {
if (i == 23) {
// experiment
continue;
}
Value v = create(i);
String s = "type: " + v.getType() + " calculated: " + v.getMemory() + " real: " + MemoryFootprint.getObjectSize(v) + " " + v.getClass().getName() + ": " + v.toString();
trace(s);
}
for (int i = 0; i < Value.TYPE_COUNT; i++) {
if (i == 23) {
// experiment
continue;
}
Value v = create(i);
if (v == ValueNull.INSTANCE && i == Value.GEOMETRY) {
// jts not in the classpath, OK
continue;
}
assertEquals(i, v.getType());
testType(i);
}
}
use of org.h2.message.Trace in project main by JohnPeng739.
the class H2ServerFactory method initPgServer.
/**
* 初始化PG服务器
*/
private void initPgServer() {
boolean enable = env.getProperty("h2.pg.enable", Boolean.class, false);
if (enable) {
int port = env.getProperty("h2.pg.port", Integer.class, 5435);
String baseDir = env.getProperty("h2.pg.baseDir", String.class, "~/h2db");
boolean daemon = env.getProperty("h2.pg.daemon", Boolean.class, true);
boolean trace = env.getProperty("h2.pg.trace", Boolean.class, true);
List<String> args = new ArrayList<>();
args.add("-pgPort");
args.add(String.valueOf(port));
args.add("-baseDir");
args.add(baseDir);
if (daemon) {
args.add("-pgDaemon");
}
if (trace) {
args.add("-trace");
}
try {
Server server = Server.createPgServer(args.toArray(new String[0]));
server.start();
if (logger.isDebugEnabled()) {
logger.debug(String.format("Start H2 pg Server success, conf: %s.", StringUtils.merge(args, " ")));
}
this.pgServer = server;
} catch (SQLException ex) {
if (logger.isErrorEnabled()) {
logger.error(String.format("Create H2 pg server fail, conf: %s.", StringUtils.merge(args, " ")));
}
}
}
}
use of org.h2.message.Trace in project main by JohnPeng739.
the class H2ServerFactory method initTcpServer.
/**
* 初始化TCP服务器
*/
private void initTcpServer() {
boolean enable = env.getProperty("h2.tcp.enable", Boolean.class, false);
if (enable) {
int port = env.getProperty("h2.tcp.port", Integer.class, 9092);
String baseDir = env.getProperty("h2.tcp.baseDir", String.class, "~/h2db");
boolean daemon = env.getProperty("h2.tcp.daemon", Boolean.class, true);
boolean trace = env.getProperty("h2.tcp.trace", Boolean.class, true);
List<String> args = new ArrayList<>();
args.add("-tcpPort");
args.add(String.valueOf(port));
// args.add(baseDir);
if (daemon) {
args.add("-tcpDaemon");
}
if (trace) {
args.add("-trace");
}
try {
Server server = Server.createTcpServer(args.toArray(new String[0]));
server.start();
if (logger.isDebugEnabled()) {
logger.debug(String.format("Start H2 TCP Server success, conf: %s.", StringUtils.merge(args, " ")));
}
this.tcpServer = server;
} catch (SQLException ex) {
if (logger.isErrorEnabled()) {
logger.error(String.format("Create H2 TCP server fail, conf: %s.", StringUtils.merge(args, " ")));
}
}
}
}
Aggregations