Subversion Repositories XServices

Rev

Rev 201 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 201 Rev 203
Line 49... Line 49...
49
 
49
 
50
        /**
50
        /**
51
         * Move event table data to snapshot
51
         * Move event table data to snapshot
Line -... Line 52...
-
 
52
         */
52
         */
53
 
53
 
54
 
54
        Connection con = null;
55
        try(          Connection  con = pool.getConnection();
55
        Connection fcon = null;
-
 
-
 
56
                      Connection fcon = fpool.getConnection();
56
        try {
57
        ) {
57
            con = pool.getConnection();
58
 
58
            con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
59
            con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
59
            con.setAutoCommit(false);
60
            con.setAutoCommit(false);
60
            Statement stmt = con.createStatement();
61
            Statement stmt = con.createStatement();
61
            PreparedStatement moveprep= con.prepareStatement(moveSQL);
62
            PreparedStatement moveprep= con.prepareStatement(moveSQL);
62
            moveprep.setLong(1, run_key);
63
            moveprep.setLong(1, run_key);
63
            moveprep.execute();
64
            moveprep.execute();
Line 64... Line -...
64
            stmt.execute(deleteTable);
-
 
-
 
65
            stmt.execute(deleteTable);
65
            con.commit(); //all events moved from tbl_events to tbl_events_snap at this point
66
            con.commit(); //all events moved from tbl_events to tbl_events_snap at this point
Line 66... Line 67...
66
 
67
 
Line 67... Line 68...
67
 
68
 
Line 81... Line 82...
81
                String event_type = rs.getString(4);
82
                String event_type = rs.getString(4);
82
                String obj_type = rs.getString(5);
83
                String obj_type = rs.getString(5);
83
                long event_ts = rs.getLong(6);
84
                long event_ts = rs.getLong(6);
84
                boolean bretry = false;
85
                boolean bretry = false;
Line 85... Line 86...
85
 
86
 
-
 
87
                //SimpleSoap ss = new SimpleSoap( url, id, IOUtils.toString(c.getAsciiStream()c.getCharacterStream()));
86
                SimpleSoap ss = new SimpleSoap( url, id, IOUtils.toString(c.getCharacterStream()));
88
                SimpleSoap ss = new SimpleSoap(url, id, c.getSubString(1L, (int) c.length()));
87
                int retry = 0;
89
                int retry = 0;
88
                Reader response = null;
90
                Reader response = null;
89
                String rsp = "";
91
                String rsp = "";
90
                boolean succeeded = false;
92
                boolean succeeded = false;
Line 150... Line 152...
150
            log.error("Exception in SQL execution: {}", e.getMessage());
152
            log.error("Exception in SQL execution: {}", e.getMessage());
151
            throw new JobExecutionException(e);
153
            throw new JobExecutionException(e);
152
        } catch (IOException e) {
154
        } catch (IOException e) {
153
            log.error("Exception in SQL execution: {}", e.getMessage());
155
            log.error("Exception in SQL execution: {}", e.getMessage());
154
            throw new RuntimeException(e);
156
            throw new RuntimeException(e);
155
        } finally {
-
 
156
            try {
-
 
157
                if(fcon!=null) fcon.close();
-
 
158
                if(con!=null)  con.close();
-
 
159
            } catch (SQLException e) {
-
 
160
                    log.error("Error closing the database connections: {}", e.getMessage());
-
 
161
                    throw new RuntimeException(e);
-
 
162
            }
-
 
163
        }
157
        }
164
    }
158
    }
Line 165... Line 159...
165
 
159