statistics processor further work
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Thu, 10 Mar 2011 14:43:26 +0000 (14:43 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Thu, 10 Mar 2011 14:43:26 +0000 (14:43 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3818 e3abac25-378b-4346-85de-24260fe3988d

26 files changed:
ExecutionStatistic/log/log.ctrl
ExecutionStatistic/log/log1.dat
ExecutionStatistic/log/logmirror.ctrl
ExecutionStatistic/seg0/c101.dat
ExecutionStatistic/seg0/c111.dat
ExecutionStatistic/seg0/c121.dat
ExecutionStatistic/seg0/c130.dat
ExecutionStatistic/seg0/c141.dat
ExecutionStatistic/seg0/c20.dat
ExecutionStatistic/seg0/c31.dat
ExecutionStatistic/seg0/c41.dat
ExecutionStatistic/seg0/c470.dat [new file with mode: 0644]
ExecutionStatistic/seg0/c481.dat [new file with mode: 0644]
ExecutionStatistic/seg0/c51.dat
ExecutionStatistic/seg0/c60.dat
ExecutionStatistic/seg0/c71.dat
ExecutionStatistic/seg0/c81.dat
ExecutionStatistic/seg0/c90.dat
ExecutionStatistic/seg0/ca1.dat
ExecutionStatistic/seg0/cb1.dat
ExecutionStatistic/seg0/cf0.dat
ExecutionStatistic/service.properties [new file with mode: 0644]
webservices/compbio/ws/execstat/ExecutionStatCollector.java
webservices/compbio/ws/execstat/StatDB.java [new file with mode: 0644]
webservices/compbio/ws/execstat/StatProcessor.java
webservices/compbio/ws/execstat/StatWriter.java [deleted file]

index 8fcdcc8..65a47ac 100644 (file)
Binary files a/ExecutionStatistic/log/log.ctrl and b/ExecutionStatistic/log/log.ctrl differ
index 596c3ec..fcb2616 100644 (file)
Binary files a/ExecutionStatistic/log/log1.dat and b/ExecutionStatistic/log/log1.dat differ
index 8fcdcc8..65a47ac 100644 (file)
Binary files a/ExecutionStatistic/log/logmirror.ctrl and b/ExecutionStatistic/log/logmirror.ctrl differ
index d8e6a8b..5c46cc6 100644 (file)
Binary files a/ExecutionStatistic/seg0/c101.dat and b/ExecutionStatistic/seg0/c101.dat differ
index b046864..7af9ca7 100644 (file)
Binary files a/ExecutionStatistic/seg0/c111.dat and b/ExecutionStatistic/seg0/c111.dat differ
index dbfded6..d93c0aa 100644 (file)
Binary files a/ExecutionStatistic/seg0/c121.dat and b/ExecutionStatistic/seg0/c121.dat differ
index e06e9ec..7911c66 100644 (file)
Binary files a/ExecutionStatistic/seg0/c130.dat and b/ExecutionStatistic/seg0/c130.dat differ
index 428b101..fb62699 100644 (file)
Binary files a/ExecutionStatistic/seg0/c141.dat and b/ExecutionStatistic/seg0/c141.dat differ
index 57f18e8..554c52d 100644 (file)
Binary files a/ExecutionStatistic/seg0/c20.dat and b/ExecutionStatistic/seg0/c20.dat differ
index 3e7eab8..7311a9e 100644 (file)
Binary files a/ExecutionStatistic/seg0/c31.dat and b/ExecutionStatistic/seg0/c31.dat differ
index 78127c2..9bc7f11 100644 (file)
Binary files a/ExecutionStatistic/seg0/c41.dat and b/ExecutionStatistic/seg0/c41.dat differ
diff --git a/ExecutionStatistic/seg0/c470.dat b/ExecutionStatistic/seg0/c470.dat
new file mode 100644 (file)
index 0000000..d3f4f68
Binary files /dev/null and b/ExecutionStatistic/seg0/c470.dat differ
diff --git a/ExecutionStatistic/seg0/c481.dat b/ExecutionStatistic/seg0/c481.dat
new file mode 100644 (file)
index 0000000..805cd49
Binary files /dev/null and b/ExecutionStatistic/seg0/c481.dat differ
index db67c98..e53479c 100644 (file)
Binary files a/ExecutionStatistic/seg0/c51.dat and b/ExecutionStatistic/seg0/c51.dat differ
index 542e21c..2a44ef5 100644 (file)
Binary files a/ExecutionStatistic/seg0/c60.dat and b/ExecutionStatistic/seg0/c60.dat differ
index 5e7d85c..30e364f 100644 (file)
Binary files a/ExecutionStatistic/seg0/c71.dat and b/ExecutionStatistic/seg0/c71.dat differ
index ed09765..0e56d11 100644 (file)
Binary files a/ExecutionStatistic/seg0/c81.dat and b/ExecutionStatistic/seg0/c81.dat differ
index 80251eb..a174a91 100644 (file)
Binary files a/ExecutionStatistic/seg0/c90.dat and b/ExecutionStatistic/seg0/c90.dat differ
index 318f909..5bb75b8 100644 (file)
Binary files a/ExecutionStatistic/seg0/ca1.dat and b/ExecutionStatistic/seg0/ca1.dat differ
index d1b3dbb..c988f78 100644 (file)
Binary files a/ExecutionStatistic/seg0/cb1.dat and b/ExecutionStatistic/seg0/cb1.dat differ
index 1c00d1d..0adbb10 100644 (file)
Binary files a/ExecutionStatistic/seg0/cf0.dat and b/ExecutionStatistic/seg0/cf0.dat differ
diff --git a/ExecutionStatistic/service.properties b/ExecutionStatistic/service.properties
new file mode 100644 (file)
index 0000000..ecb3e8b
--- /dev/null
@@ -0,0 +1,22 @@
+#D:\workspace\JABA2\ExecutionStatistic\r
+# ********************************************************************\r
+# ***                Please do NOT edit this file.                 ***\r
+# *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. ***\r
+# ********************************************************************\r
+#Wed Mar 09 18:04:00 GMT 2011\r
+SysschemasIndex2Identifier=225\r
+SyscolumnsIdentifier=144\r
+SysconglomeratesIndex1Identifier=49\r
+SysconglomeratesIdentifier=32\r
+SyscolumnsIndex2Identifier=177\r
+SysschemasIndex1Identifier=209\r
+SysconglomeratesIndex3Identifier=81\r
+SystablesIndex2Identifier=129\r
+SyscolumnsIndex1Identifier=161\r
+derby.serviceProtocol=org.apache.derby.database.Database\r
+SysschemasIdentifier=192\r
+derby.storage.propertiesId=16\r
+SysconglomeratesIndex2Identifier=65\r
+derby.serviceLocale=en_GB\r
+SystablesIdentifier=96\r
+SystablesIndex1Identifier=113\r
index 74218ce..945076e 100644 (file)
@@ -4,9 +4,11 @@ import java.io.File;
 import java.io.FileFilter;\r
 import java.io.FileWriter;\r
 import java.io.IOException;\r
+import java.sql.SQLException;\r
 import java.text.SimpleDateFormat;\r
 import java.util.ArrayList;\r
 import java.util.HashMap;\r
+import java.util.HashSet;\r
 import java.util.List;\r
 import java.util.Map;\r
 \r
@@ -85,8 +87,9 @@ public class ExecutionStatCollector {
         * \r
         * @param args\r
         * @throws IOException\r
+        * @throws SQLException\r
         */\r
-       public static void main(String[] args) throws IOException {\r
+       public static void main(String[] args) throws IOException, SQLException {\r
 \r
                // updateTime(new File(\r
                // "D:\\workspace\\JABA2\\jobsout\\AACon#170462904473672\\STARTED"));\r
@@ -94,7 +97,7 @@ public class ExecutionStatCollector {
                String workDir = PropertyHelperManager.getLocalPath()\r
                                + getLocalJobDir().trim();\r
                System.out.println(workDir);\r
-               File[] files = FileUtil.getFiles("H:/www-jws2/job_dir/jobsout",\r
+               File[] files = FileUtil.getFiles("H:/www-jws2/job_dir/local_jobsout",\r
                                directories);\r
                List<StatProcessor.JobStat> stats = new ArrayList<StatProcessor.JobStat>();\r
                for (File file : files) {\r
@@ -108,6 +111,9 @@ public class ExecutionStatCollector {
                System.out.println("!!!!!!!!!!!!!!!!!!");\r
                System.out.println();\r
                System.out.println(sp.getSingleWSStat(Services.TcoffeeWS).reportStat());\r
+\r
+               StatDB.insertData(new HashSet<StatProcessor.JobStat>(sp\r
+                               .getSingleWSStat(Services.TcoffeeWS).stats));\r
        }\r
 \r
        static FileFilter directories = new FileFilter() {\r
@@ -157,6 +163,20 @@ public class ExecutionStatCollector {
                        return starttime;\r
                }\r
 \r
+               String getClusterJobID() {\r
+                       String clustjobId = "";\r
+                       File jobid = files.get("JOBID");\r
+                       try {\r
+                               if (jobid != null) {\r
+                                       clustjobId = FileUtil.readFileToString(jobid);\r
+                               }\r
+                       } catch (IOException ioe) {\r
+                               ioe.printStackTrace();\r
+                               // TODO LOG\r
+                       }\r
+                       return clustjobId.trim();\r
+               }\r
+\r
                long getFinishedTime() {\r
                        long ftime = UNDEFINED;\r
                        File finished = files.get(JobStatus.FINISHED.toString());\r
@@ -219,9 +239,10 @@ public class ExecutionStatCollector {
                }\r
 \r
                StatProcessor.JobStat getJobStat() {\r
-                       return new StatProcessor.JobStat(getService(), jobdir.getName(),\r
-                                       getStartTime(), getFinishedTime(), getInputSize(),\r
-                                       getResultSize(), isCollected(), isCancelled());\r
+                       return new StatProcessor.JobStat(getService(), getClusterJobID(),\r
+                                       jobdir.getName(), getStartTime(), getFinishedTime(),\r
+                                       getInputSize(), getResultSize(), isCollected(),\r
+                                       isCancelled());\r
                }\r
 \r
                @Override\r
diff --git a/webservices/compbio/ws/execstat/StatDB.java b/webservices/compbio/ws/execstat/StatDB.java
new file mode 100644 (file)
index 0000000..2c66ea0
--- /dev/null
@@ -0,0 +1,183 @@
+package compbio.ws.execstat;\r
+\r
+import java.sql.Connection;\r
+import java.sql.DriverManager;\r
+import java.sql.PreparedStatement;\r
+import java.sql.ResultSet;\r
+import java.sql.SQLException;\r
+import java.sql.Statement;\r
+import java.sql.Timestamp;\r
+import java.util.ArrayList;\r
+import java.util.Date;\r
+import java.util.List;\r
+import java.util.Set;\r
+\r
+import compbio.ws.client.Services;\r
+import compbio.ws.execstat.StatProcessor.JobStat;\r
+\r
+public class StatDB {\r
+\r
+       /* the default framework is embedded */\r
+       // private final String framework = "embedded";\r
+       private static final String driver = "org.apache.derby.jdbc.EmbeddedDriver";\r
+       private static final String protocol = "jdbc:derby:";\r
+       private static final String statDBName = "ExecutionStatistic";\r
+\r
+       private static Connection getDBConnection() throws SQLException {\r
+               // TODO\r
+               System.setProperty("derby.system.home", ".");\r
+               Connection conn = DriverManager.getConnection(protocol + statDBName\r
+                               + ";create=true");\r
+\r
+               // We want to control transactions manually. Autocommit is on by\r
+               // default in JDBC.\r
+               // conn.setAutoCommit(false);\r
+               return conn;\r
+       }\r
+\r
+       // ServiceName,jobname,start,finish,inputSize,resultSize,isCancelled,isCollected\r
+       /**\r
+        * \r
+        * rs.getBoolean(i) will return true for any non-zero value and false for 0\r
+        * on SMALLINT data column.\r
+        * \r
+        * @throws SQLException\r
+        */\r
+       private static void createStatTable() throws SQLException {\r
+               Connection conn = getDBConnection();\r
+               /*\r
+                * Creating a statement object that we can use for running various SQL\r
+                * statements commands against the database.\r
+                */\r
+               Statement s = conn.createStatement();\r
+               String create = "create table exec_stat("\r
+                               + "number INT GENERATED ALWAYS AS IDENTITY,"\r
+                               + "service_name VARCHAR(15) NOT NULL, "\r
+                               + "cluster_job_id VARCHAR(30), "\r
+                               + "job_id VARCHAR(35) NOT NULL PRIMARY KEY, "\r
+                               + "start TIMESTAMP," + "finish TIMESTAMP,"\r
+                               + "inputsize BIGINT," + "resultsize BIGINT,"\r
+                               + "isCancelled SMALLINT NOT NULL,"\r
+                               + "isCollected SMALLINT NOT NULL, "\r
+                               + "isClusterJob SMALLINT NOT NULL)";\r
+               // We create a table...\r
+               System.out.println(create);\r
+               s.execute(create);\r
+               s.close();\r
+               conn.close();\r
+       }\r
+\r
+       static void insertData(Set<JobStat> jobstatus) throws SQLException {\r
+               System.out.println("Inserting " + jobstatus.size());\r
+               Connection conn = getDBConnection();\r
+               conn.setAutoCommit(false);\r
+               String insert = "insert into exec_stat (service_name, cluster_job_id, job_id, start, finish, "\r
+                               + "inputsize, resultsize, isCancelled, isCollected, isClusterJob) "\r
+                               + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";\r
+               PreparedStatement pstm = conn.prepareStatement(insert);\r
+               for (JobStat js : jobstatus) {\r
+                       pstm.setString(1, js.webService.toString());\r
+                       pstm.setString(2, js.clusterJobId);\r
+                       pstm.setString(3, js.jobname);\r
+                       pstm.setTimestamp(4, new Timestamp(js.start));\r
+                       pstm.setTimestamp(5, new Timestamp(js.finish));\r
+                       pstm.setLong(6, js.inputSize);\r
+                       pstm.setLong(7, js.resultSize);\r
+                       pstm.setBoolean(8, js.isCancelled);\r
+                       pstm.setBoolean(9, js.isCollected);\r
+                       pstm.setBoolean(10, js.isClusterJob());\r
+                       pstm.executeUpdate();\r
+               }\r
+               conn.commit();\r
+               pstm.close();\r
+               conn.close();\r
+       }\r
+\r
+       static List<JobStat> readData(Timestamp from, Timestamp to,\r
+                       Services wservice, Boolean clusterOnly) throws SQLException {\r
+               Connection conn = getDBConnection();\r
+               String query = "select service_name, cluster_job_id, job_id, start, finish, inputsize, "\r
+                               + "resultsize, isCancelled, isCollected from exec_stat where start BETWEEN ? and ? ";\r
+\r
+               if (wservice != null) {\r
+                       query += " and service_name=? ";\r
+               }\r
+\r
+               if (clusterOnly != null) {\r
+                       if (clusterOnly) {\r
+                               query += " and isClusterJob!=0 ";\r
+                       } else {\r
+                               query += " and isClusterJob=0 ";\r
+                       }\r
+               }\r
+\r
+               PreparedStatement pstm = conn.prepareStatement(query);\r
+               pstm.setTimestamp(1, from);\r
+               pstm.setTimestamp(2, to);\r
+               if (wservice != null) {\r
+                       pstm.setString(3, wservice.toString());\r
+               }\r
+               pstm.execute();\r
+               List<JobStat> stats = new ArrayList<StatProcessor.JobStat>();\r
+               ResultSet rs = pstm.getResultSet();\r
+               while (rs.next()) {\r
+                       stats.add(new JobStat(Services.getService(rs.getString(1)), rs\r
+                                       .getString(2), rs.getString(3), rs.getTimestamp(4)\r
+                                       .getTime(), rs.getTimestamp(5).getTime(), rs.getLong(6), rs\r
+                                       .getLong(7), rs.getBoolean(8), rs.getBoolean(9)));\r
+               }\r
+               rs.close();\r
+               pstm.close();\r
+               conn.close();\r
+               return stats;\r
+       }\r
+\r
+       static void removeRecordedJobs(Set<String> fsJobs) throws SQLException {\r
+               Connection conn = getDBConnection();\r
+               String query = "select job_id from exec_stat";\r
+\r
+               Statement st = conn.createStatement();\r
+               ResultSet result = st.executeQuery(query);\r
+\r
+               while (result.next()) {\r
+                       String recordedJob = result.getString(1);\r
+                       if (fsJobs.contains(recordedJob)) {\r
+                               fsJobs.remove(recordedJob);\r
+                       }\r
+               }\r
+               result.close();\r
+               conn.close();\r
+       }\r
+\r
+       void shutdownDBServer() {\r
+               // ## DATABASE SHUTDOWN SECTION ##\r
+               /***\r
+                * In embedded mode, an application should shut down Derby. Shutdown\r
+                * throws the XJ015 exception to confirm success.\r
+                ***/\r
+               boolean gotSQLExc = false;\r
+               try {\r
+                       DriverManager.getConnection("jdbc:derby:;shutdown=true");\r
+               } catch (SQLException se) {\r
+                       if (se.getSQLState().equals("XJ015")) {\r
+                               gotSQLExc = true;\r
+                       }\r
+               }\r
+               if (!gotSQLExc) {\r
+                       System.out.println("Database did not shut down normally");\r
+               } else {\r
+                       System.out.println("Database shut down normally");\r
+               }\r
+       }\r
+       public static void main(String[] args) throws SQLException {\r
+               // createStatTable();\r
+               // insertData(null);\r
+\r
+               Date from = new Date();\r
+               from.setMonth(1);\r
+               System.out.println(new StatProcessor(readData(\r
+                               new Timestamp(from.getTime()),\r
+                               new Timestamp(new Date().getTime()), null, null)).reportStat());\r
+\r
+       }\r
+}\r
index 0697eb8..16b3234 100644 (file)
@@ -6,6 +6,7 @@ import java.util.Comparator;
 import java.util.Date;\r
 import java.util.List;\r
 \r
+import compbio.engine.client.ConfExecutable;\r
 import compbio.ws.client.Services;\r
 \r
 public class StatProcessor {\r
@@ -16,6 +17,14 @@ public class StatProcessor {
                this.stats = stats;\r
        }\r
 \r
+       /*\r
+        * TODO List<JobStat> getNewStat() throws SQLException { Set<String> jobids\r
+        * = new HashSet<String>(); for(JobStat js: stats) { jobids.add(js.jobname);\r
+        * } StatDB.removeRecordedJobs(jobids); List<String> newjobs = new\r
+        * HashSet<String>(); for(String jobid: jobids) { if(newjobs.co)\r
+        * jobids.add(js.jobname); } }\r
+        */\r
+\r
        List<JobStat> getAbandonedJobs() {\r
                List<JobStat> abJobs = new ArrayList<StatProcessor.JobStat>();\r
                for (JobStat js : stats) {\r
@@ -96,10 +105,18 @@ public class StatProcessor {
                report += "Cancelled Jobs: " + getCancelledJobs().size() + "\n";\r
                report += "Total Runtime (s): " + getTotalRuntime() + "\n";\r
                report += "Unsuccessful Jobs: " + getUnsuccessfulJobs().size() + "\n";\r
-               report += "10 longest jobs: \n\n" + sortByRuntime().subList(0, 9)\r
-                               + "\n";\r
-               report += "10 biggest jobs: \n\n" + sortByResultSize().subList(0, 9)\r
-                               + "\n";\r
+               if (sortByRuntime().size() > 10) {\r
+                       report += "10 longest jobs: \n\n" + sortByRuntime().subList(0, 9)\r
+                                       + "\n";\r
+               } else {\r
+                       report += "longest jobs: \n\n" + sortByRuntime() + "\n";\r
+               }\r
+               if (sortByResultSize().size() > 10)\r
+                       report += "10 biggest jobs: \n\n"\r
+                                       + sortByResultSize().subList(0, 9) + "\n";\r
+               else {\r
+                       report += "biggest jobs: \n\n" + sortByResultSize() + "\n";\r
+               }\r
                return report;\r
        }\r
 \r
@@ -127,6 +144,7 @@ public class StatProcessor {
                };\r
 \r
                Services webService;\r
+               String clusterJobId;\r
                String jobname;\r
                long start;\r
                long finish;\r
@@ -135,11 +153,12 @@ public class StatProcessor {
                boolean isCollected;\r
                boolean isCancelled;\r
 \r
-               JobStat(Services webService, String jobname, long start, long finish,\r
-                               long inputSize, long resultSize, boolean isCollected,\r
-                               boolean isCancelled) {\r
+               JobStat(Services webService, String clusterJobId, String jobname,\r
+                               long start, long finish, long inputSize, long resultSize,\r
+                               boolean isCollected, boolean isCancelled) {\r
                        super();\r
                        this.webService = webService;\r
+                       this.clusterJobId = clusterJobId;\r
                        this.jobname = jobname;\r
                        this.start = start;\r
                        this.finish = finish;\r
@@ -149,6 +168,10 @@ public class StatProcessor {
                        this.isCancelled = isCancelled;\r
                }\r
 \r
+               public boolean isClusterJob() {\r
+                       return jobname.startsWith(ConfExecutable.CLUSTER_TASK_ID_PREFIX);\r
+               }\r
+\r
                @Override\r
                public int hashCode() {\r
                        final int prime = 31;\r
@@ -221,7 +244,9 @@ public class StatProcessor {
                        }\r
                        report += "Input size " + inputSize + "\n";\r
                        report += "Result size " + resultSize + "\n";\r
+                       report += "ClusterJobID " + clusterJobId + "\n";\r
                        report += "Collected? " + isCollected + "\n";\r
+                       report += "Cancelled? " + isCancelled + "\n";\r
                        return report;\r
                }\r
 \r
@@ -251,7 +276,9 @@ public class StatProcessor {
                        }\r
                        report += inputSize + "\t";\r
                        report += resultSize + "\t";\r
+                       report += clusterJobId + "\t";\r
                        report += isCollected + "\t";\r
+                       report += isCancelled + "\t";\r
                        return report;\r
                }\r
 \r
diff --git a/webservices/compbio/ws/execstat/StatWriter.java b/webservices/compbio/ws/execstat/StatWriter.java
deleted file mode 100644 (file)
index d1b461e..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-package compbio.ws.execstat;\r
-\r
-import java.sql.Connection;\r
-import java.sql.DriverManager;\r
-import java.sql.PreparedStatement;\r
-import java.sql.SQLException;\r
-import java.sql.Statement;\r
-import java.sql.Timestamp;\r
-\r
-import compbio.ws.execstat.StatProcessor.JobStat;\r
-\r
-public class StatWriter {\r
-\r
-       /* the default framework is embedded */\r
-       // private final String framework = "embedded";\r
-       private static final String driver = "org.apache.derby.jdbc.EmbeddedDriver";\r
-       private static final String protocol = "jdbc:derby:";\r
-       private static final String statDBName = "ExecutionStatistic";\r
-\r
-       static Connection getDBConnection() throws SQLException {\r
-               // TODO\r
-               System.setProperty("derby.system.home", ".");\r
-\r
-               Connection conn = DriverManager.getConnection(protocol + statDBName\r
-                               + ";create=true");\r
-\r
-               // We want to control transactions manually. Autocommit is on by\r
-               // default in JDBC.\r
-               conn.setAutoCommit(true);\r
-               return conn;\r
-       }\r
-\r
-       // ServiceName,jobname,start,finish,inputSize,resultSize,isCancelled,isCollected\r
-       static void createStatTable() throws SQLException {\r
-               Connection conn = getDBConnection();\r
-               /*\r
-                * Creating a statement object that we can use for running various SQL\r
-                * statements commands against the database.\r
-                */\r
-               Statement s = conn.createStatement();\r
-               String create = "create table exec_stat("\r
-                               + "number INT GENERATED ALWAYS AS IDENTITY,"\r
-                               + "service_name VARCHAR(15) NOT NULL, "\r
-                               + "job_id VARCHAR(35) NOT NULL PRIMARY KEY, "\r
-                               + "start TIMESTAMP," + "finish TIMESTAMP,"\r
-                               + "inputsize BIGINT," + "resultsize BIGINT,"\r
-                               + "isCancelled SMALLINT NOT NULL,"\r
-                               + "isCollected SMALLINT NOT NULL)";\r
-               // We create a table...\r
-               System.out.println(create);\r
-               s.execute(create);\r
-               s.close();\r
-               conn.close();\r
-       }\r
-\r
-       static void insertData(JobStat jobstatus) throws SQLException {\r
-               Connection conn = getDBConnection();\r
-               String insert = "insert into exec_stat (service_name, job_id, start, finish, "\r
-                               + "inputsize, resultsize, isCancelled, isCollected) "\r
-                               + "VALUES (?, ?, ?, ?, ?, ?, ?, ? )";\r
-               PreparedStatement pstm = conn.prepareStatement(insert);\r
-\r
-               pstm.setString(1, "webservice");\r
-               pstm.setString(2, "@Clustal#980273495452357");\r
-               pstm.setTimestamp(3, new Timestamp(190385934834l));\r
-               pstm.setTimestamp(4, new Timestamp(190332423423l));\r
-               pstm.setLong(5, 1232);\r
-               pstm.setLong(6, 1432422);\r
-               pstm.setShort(7, (short) 1);\r
-               pstm.setShort(8, (short) 0);\r
-               pstm.executeUpdate();\r
-               pstm.close();\r
-               conn.close();\r
-       }\r
-\r
-       void shutdownDBServer() {\r
-               // ## DATABASE SHUTDOWN SECTION ##\r
-               /***\r
-                * In embedded mode, an application should shut down Derby. Shutdown\r
-                * throws the XJ015 exception to confirm success.\r
-                ***/\r
-               boolean gotSQLExc = false;\r
-               try {\r
-                       DriverManager.getConnection("jdbc:derby:;shutdown=true");\r
-               } catch (SQLException se) {\r
-                       if (se.getSQLState().equals("XJ015")) {\r
-                               gotSQLExc = true;\r
-                       }\r
-               }\r
-               if (!gotSQLExc) {\r
-                       System.out.println("Database did not shut down normally");\r
-               } else {\r
-                       System.out.println("Database shut down normally");\r
-               }\r
-       }\r
-       public static void main(String[] args) throws SQLException {\r
-               // createStatTable();\r
-               insertData(null);\r
-       }\r
-}\r