protected void cleanState ( String topologyName , SchedulerStateManagerAdaptor statemgr ) throws TopologyRuntimeManagementException { LOG . fine ( "Cleaning up topology state" ) ; Boolean result ; result = statemgr . deleteTMasterLocation ( topologyName ) ; if ( result == null || ! result ) { throw new TopologyRuntimeManagementException ( "Failed to clear TMaster location. Check whether TMaster set it correctly." ) ; } result = statemgr . deleteMetricsCacheLocation ( topologyName ) ; if ( result == null || ! result ) { throw new TopologyRuntimeManagementException ( "Failed to clear MetricsCache location. Check whether MetricsCache set it correctly." ) ; } result = statemgr . deletePackingPlan ( topologyName ) ; if ( result == null || ! result ) { throw new TopologyRuntimeManagementException ( "Failed to clear packing plan. Check whether Launcher set it correctly." ) ; } result = statemgr . deletePhysicalPlan ( topologyName ) ; if ( result == null || ! result ) { throw new TopologyRuntimeManagementException ( "Failed to clear physical plan. Check whether TMaster set it correctly." ) ; } result = statemgr . deleteSchedulerLocation ( topologyName ) ; if ( result == null || ! result ) { throw new TopologyRuntimeManagementException ( "Failed to clear scheduler location. Check whether Scheduler set it correctly." ) ; } result = statemgr . deleteLocks ( topologyName ) ; if ( result == null || ! result ) { throw new TopologyRuntimeManagementException ( "Failed to delete locks. It's possible that the topology never created any." ) ; } result = statemgr . deleteExecutionState ( topologyName ) ; if ( result == null || ! result ) { throw new TopologyRuntimeManagementException ( "Failed to clear execution state" ) ; } // Set topology def at last since we determine whether a topology is running // by checking the existence of topology def result = statemgr . deleteTopology ( topologyName ) ; if ( result == null || ! result ) { throw new TopologyRuntimeManagementException ( "Failed to clear topology definition" ) ; } LOG . fine ( "Cleaned up topology state" ) ; }
Clean all states of a heron topology 1 . Topology def and ExecutionState are required to exist to delete 2 . TMasterLocation SchedulerLocation and PhysicalPlan may not exist to delete