/** * Sets {@link Partition}s used by this DirectoryService. * * @param partitions the partitions to used */ public void setPartitions( Set<? extends Partition> partitions ) { Set<Partition> cloned = new HashSet<Partition>(); cloned.addAll( partitions ); Set<String> names = new HashSet<String>(); for ( Partition partition : cloned ) { String id = partition.getId(); if ( names.contains( id ) ) { LOG.warn( "Encountered duplicate partition {} identifier.", id ); } names.add( id ); } this.partitions = cloned; }
/** * Try to repair the partitions. Precondition is that this service was started before. * * @param instanceLayout the on disk location's layout of the intance to be repaired * @throws Exception If the repair failed */ public void repair( InstanceLayout instanceLayout ) throws Exception { File partitionsDir = instanceLayout.getPartitionsDirectory(); System.out.println( "Repairing partition dir " + partitionsDir.getAbsolutePath() ); Set<? extends Partition> partitions = getDirectoryService().getPartitions(); // Iterate on the partitions to repair them for ( Partition partition : partitions ) { try { partition.repair(); } catch ( Exception e ) { System.out.println( "Failed to repair the partition " + partition.getId() ); e.printStackTrace(); return; } } }
throw new LdapOtherException( I18n.err( I18n.ERR_267, partition.getId() ) );