@Test public void testSetShardState() throws Exception { String fileName ="arcfile1"; storage.setShardState("1", ArchonConnector.ARC_STATE.RUNNING, 2); storage.addARC(fileName); storage.setARCProperties(arcFile1, "1", ArchonConnector.ARC_STATE.RUNNING, 1); ArcVO arc = storage.getArcByID(fileName); assertEquals("RUNNING",arc.getArcState()); }
public void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority) throws Exception{ PreparedStatement stmt = null; try { stmt = connection.prepareStatement(setShardStateStatement); stmt.setString(1, state.toString()); stmt.setInt(2, priority); stmt.setLong(3, System.currentTimeMillis()); stmt.setString(4, shardID); int updated = stmt.executeUpdate(); log.info("setShardState for shardID:"+shardID +" #updated arcfiles ="+updated); } catch (Exception e) { log.error("SQL Exception in setARCState:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } }
ArchonStorage { public void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority) throws Exception{ PreparedStatement stmt = null; try { stmt = connection.prepareStatement(setShardStateStatement); stmt.setString(1, state.toString()); stmt.setInt(2, priority); stmt.setLong(3, System.currentTimeMillis()); stmt.setString(4, shardID); int updated = stmt.executeUpdate(); log.info("setShardState for shardID:"+shardID +" #updated arcfiles ="+updated); } catch (Exception e) { log.error("SQL Exception in setARCState:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } }
ArchonStorage { public void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority) throws Exception{ PreparedStatement stmt = null; try { stmt = connection.prepareStatement(setShardStateStatement); stmt.setString(1, state.toString()); stmt.setInt(2, priority); stmt.setLong(3, System.currentTimeMillis()); stmt.setString(4, shardID); int updated = stmt.executeUpdate(); log.info("setShardState for shardID:"+shardID +" #updated arcfiles ="+updated); } catch (Exception e) { log.error("SQL Exception in setARCState:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); }
ArchonStorage { public void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority) throws Exception{ PreparedStatement stmt = null; try { stmt = connection.prepareStatement(setShardStateStatement); stmt.setString(1, state.toString()); stmt.setInt(2, priority); stmt.setLong(3, System.currentTimeMillis()); stmt.setString(4, shardID); int updated = stmt.executeUpdate(); log.info("setShardState for shardID:"+shardID +" #updated arcfiles ="+updated); } catch (Exception e) { log.error("SQL Exception in setARCState:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); static void initialize(String driverName, String driverUrl, String userName, String password); int nextShardId(); void addARC(String arcPath); void addOrUpdateARC(String arcPath); List<String> getShardIDs(); String nextARC(String shardID); List<String> getARCFiles(String shardID); ArcVO getArcByID(String arcID); int getArcCount(); List<ArcVO> getLatest1000Arcs(); List<ArcVO> getAllRunningArcs(); void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState); void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority); void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority); void setARCPriority(String fullPath, int priority); void resetArcWithPriorityStatement(String fullPath, int priority); void removeARC(String arcID); void clearIndexing(String shardID); void resetShardId(String shardID); void commit(); void rollback(); void close(); static void shutdown(); }
ArchonStorage { public void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority) throws Exception{ PreparedStatement stmt = null; try { stmt = connection.prepareStatement(setShardStateStatement); stmt.setString(1, state.toString()); stmt.setInt(2, priority); stmt.setLong(3, System.currentTimeMillis()); stmt.setString(4, shardID); int updated = stmt.executeUpdate(); log.info("setShardState for shardID:"+shardID +" #updated arcfiles ="+updated); } catch (Exception e) { log.error("SQL Exception in setARCState:" + e.getMessage()); throw e; } finally { closeStatement(stmt); } } ArchonStorage(); static void initialize(String driverName, String driverUrl, String userName, String password); int nextShardId(); void addARC(String arcPath); void addOrUpdateARC(String arcPath); List<String> getShardIDs(); String nextARC(String shardID); List<String> getARCFiles(String shardID); ArcVO getArcByID(String arcID); int getArcCount(); List<ArcVO> getLatest1000Arcs(); List<ArcVO> getAllRunningArcs(); void setARCState(String arcPath, ArchonConnector.ARC_STATE arcState); void setShardState(String shardID, ArchonConnector.ARC_STATE state, int priority); void setARCProperties(String fullPath, String shardID,ArchonConnector.ARC_STATE state, int priority); void setARCPriority(String fullPath, int priority); void resetArcWithPriorityStatement(String fullPath, int priority); void removeARC(String arcID); void clearIndexing(String shardID); void resetShardId(String shardID); void commit(); void rollback(); void close(); static void shutdown(); static Date INITDATE; }