public Object execute ( final Map < Object , Object > iArgs ) { if ( clusterName == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; final ODatabaseDocumentInternal database = getDatabase ( ) ; // CHECK IF ANY CLASS IS USING IT final int clusterId = database . getStorage ( ) . getClusterIdByName ( clusterName ) ; for ( OClass iClass : database . getMetadata ( ) . getSchema ( ) . getClasses ( ) ) { for ( int i : iClass . getClusterIds ( ) ) { if ( i == clusterId ) // IN USE return false ; } } // REMOVE CACHE OF COMMAND RESULTS IF ACTIVE database . getMetadata ( ) . getCommandCache ( ) . invalidateResultsOfCluster ( clusterName ) ; database . dropCluster ( clusterId , true ) ; return true ; }
Execute the DROP CLUSTER .