Buggy code:
public final class ContainerStateMonitor extends AbstractServiceListener < Object > { private static final Logger log = Logger . getLogger ( "org.jboss.as.controller" ) ; private final ServiceRegistry serviceRegistry ; private final ServiceController < ? > controllerController ; private final AtomicInteger busyServiceCount = new AtomicInteger ( ) ; private final Map < ServiceController < ? > , String > failedControllers = new IdentityHashMap < ServiceController < ? > , String > ( ) ; private final Set < ServiceController < ? > > servicesWithMissingDeps = ContainerStateMonitor . identitySet ( ) ; private Set < ServiceName > previousMissingDepSet = new HashSet < ServiceName > ( ) ; private ContainerStateMonitor . ContainerStateChangeReport changeReport ; ContainerStateMonitor ( final ServiceRegistry registry , final ServiceController < ? > controller ) { } void acquire ( ) { } void release ( ) { } @ Override public void listenerAdded ( final ServiceController < ? > controller ) { } @ Override public void transition ( final ServiceController < ? extends Object > controller , final ServiceController . Transition transition ) { } @ Override public void immediateDependencyAvailable ( final ServiceController < ? > controller ) { } @ Override public void immediateDependencyUnavailable ( final ServiceController < ? > controller ) { } void awaitUninterruptibly ( ) { } void awaitUninterruptibly ( int count ) { } void await ( ) throws InterruptedException { } void await ( int count ) throws InterruptedException { } ContainerStateMonitor . ContainerStateChangeReport awaitContainerStateChangeReport ( int count ) throws InterruptedException { } private void tick ( ) { } private void untick ( ) { } private synchronized ContainerStateMonitor . ContainerStateChangeReport createContainerStateChangeReport ( ) { final Map < ServiceName , Set < ServiceName > > missingDeps = new HashMap < ServiceName , Set < ServiceName > > ( ) ; for ( ServiceController < ? > controller : servicesWithMissingDeps ) { for ( ServiceName missing : controller . getImmediateUnavailableDependencies ( ) ) { Set < ServiceName > dependents = missingDeps . get ( missing ) ; if ( dependents == null ) { dependents = new HashSet < ServiceName > ( ) ; missingDeps . put ( missing , dependents ) ; } dependents . add ( controller . getName ( ) ) ; } } final Set < ServiceName > previousMissing = previousMissingDepSet ; final Map < ServiceName , Boolean > noLongerMissingServices = new TreeMap < ServiceName , Boolean > ( ) ; for ( ServiceName name : previousMissing ) { if ( ! ( missingDeps . containsKey ( name ) ) ) { ServiceController < ? > controller = serviceRegistry . getService ( name ) ; noLongerMissingServices . put ( name , ( controller == null ) ) ; } } final Map < ServiceName , ContainerStateMonitor . MissingDependencyInfo > missingServices = new TreeMap < ServiceName , ContainerStateMonitor . MissingDependencyInfo > ( ) ; for ( Map . Entry < ServiceName , Set < ServiceName > > entry : missingDeps . entrySet ( ) ) { final ServiceName name = entry . getKey ( ) ; if ( ! ( previousMissing . contains ( name ) ) ) { ServiceController < ? > controller = serviceRegistry . getService ( name ) ; boolean unavailable = controller != null ; missingServices . put ( name , new ContainerStateMonitor . MissingDependencyInfo ( name , unavailable , entry . getValue ( ) ) ) ; } } <START_BUG> final Map < ServiceController < ? > , String > currentFailedControllers = new TreeMap < ServiceController < ? > , String > ( failedControllers ) ; <END_BUG> previousMissingDepSet = new HashSet < ServiceName > ( missingDeps . keySet ( ) ) ; failedControllers . clear ( ) ; boolean needReport = ( ( ! ( missingServices . isEmpty ( ) ) ) || ( ! ( currentFailedControllers . isEmpty ( ) ) ) ) || ( ! ( noLongerMissingServices . isEmpty ( ) ) ) ; return needReport ? new ContainerStateMonitor . ContainerStateChangeReport ( missingServices , currentFailedControllers , noLongerMissingServices ) : null ; } private synchronized String createChangeReportLogMessage ( ContainerStateMonitor . ContainerStateChangeReport changeReport ) { } public static class ContainerStateChangeReport { private final Map < ServiceName , ContainerStateMonitor . MissingDependencyInfo > missingServices ; private final Map < ServiceController < ? > , String > failedControllers ; private final Map < ServiceName , Boolean > noLongerMissingServices ; private ContainerStateChangeReport ( final Map < ServiceName , ContainerStateMonitor . MissingDependencyInfo > missingServices , final Map < ServiceController < ? > , String > failedControllers , final Map < ServiceName , Boolean > noLongerMissingServices ) { } public final Map < ServiceController < ? > , String > getFailedControllers ( ) { } public Map < ServiceName , ContainerStateMonitor . MissingDependencyInfo > getMissingServices ( ) { } public Map < ServiceName , Boolean > getNoLongerMissingServices ( ) { } } public static class MissingDependencyInfo { private final ServiceName serviceName ; private final boolean unavailable ; private final Set < ServiceName > dependents ; public MissingDependencyInfo ( ServiceName serviceName , boolean unavailable , final Set < ServiceName > dependents ) { } public ServiceName getServiceName ( ) { } public boolean isUnavailable ( ) { } public Set < ServiceName > getDependents ( ) { } } private static < T > Set < T > identitySet ( ) { } }

Fix:
final Map < ServiceController < ? > , String > currentFailedControllers = new HashMap < ServiceController < ? > , String > ( failedControllers ) ;