Package org.h2.util

Examples of org.h2.util.Task.execute()


            Task t = new Task() {
                public void call() throws Exception {
                    Server.startWebServer(conn);
                }
            };
            t.execute();
            for (int i = 0; lastUrl == oldUrl; i++) {
                if (i > 100) {
                    throw new Exception("Browser not started");
                }
                Thread.sleep(100);
View Full Code Here


                } finally {
                    toolOut.close();
                }
            }
        };
        task.execute();
        InputStreamReader reader = new InputStreamReader(testIn);
        lineReader = new LineNumberReader(reader);
        read("");
        read("Welcome to H2 Shell");
        read("Exit with");
View Full Code Here

                }
            }
        };
//System.out.println("insert hello");
        stat.execute("insert into test values(0, 'Hello')");
        t.execute();
        Thread.sleep(500);
//System.out.println("insert hello commit");
        committed.set(true);
        conn.commit();
        t.get();
View Full Code Here

            public void call() throws SQLException {
                stat2.execute("update test set name = 'Hallo'");
            }
        };
        stat.execute("update test set name = 'Hi'");
        t.execute();
        Thread.sleep(500);
        conn.commit();
        t.get();
        ResultSet rs;
        rs = stat.executeQuery("select name from test");
View Full Code Here

                    man.setMaxConnections(1);
                    man.setMaxConnections(2);
                }
            }
        };
        t.execute();
        long time = System.currentTimeMillis();
        try {
            // connection 2 (of 1 or 2) may fail
            man.getConnection();
            // connection 3 (of 1 or 2) must fail
View Full Code Here

            public void call() throws Exception {
                Thread.sleep(300);
                stat2.execute("update test2 set id = 4");
            }
        };
        task.execute();
        Thread.sleep(100);
        try {
            stat.execute("update test2 set id = 3");
            task.get();
        } catch (SQLException e) {
View Full Code Here

                stat.execute("update test set id2=999 where id=500");
                conn.close();
                importFinished[0] = true;
            }
        };
        importUpdate.execute();

        Task select = new Task() {
            public void call() throws Exception {
                Connection conn = DriverManager.getConnection(url);
                Statement stat = conn.createStatement();
View Full Code Here

                assertEquals(999, rs.getInt(1));
                rs.close();
                conn.close();
            }
        };
        select.execute();
        importUpdate.get();
        select.get();
        deleteDb("fileLockSerialized");
    }
View Full Code Here

        task = new Task() {
            public void call() throws SQLException {
                stat.execute("script simple drop to '"+dir+"/backup2.sql'");
            }
        };
        task.execute();
        Thread.sleep(200);
        stat.cancel();
        SQLException e = (SQLException) task.getException();
        assertTrue(e != null);
        assertEquals(ErrorCode.STATEMENT_WAS_CANCELED, e.getErrorCode());
View Full Code Here

        task = new Task() {
            public void call() throws SQLException {
                stat.execute("runscript from '"+dir+"/backup.sql'");
            }
        };
        task.execute();
        Thread.sleep(100);
        stat.cancel();
        e = (SQLException) task.getException();
        assertEquals(ErrorCode.STATEMENT_WAS_CANCELED, e.getErrorCode());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.