Skip to content

Commit

Permalink
Fix for EUCA-5133 Only run the fault queue when the system is fully up
Browse files Browse the repository at this point in the history
  • Loading branch information
chris grzegorczyk committed Feb 21, 2013
1 parent 6eb7919 commit c1348c0
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NaturalId;
import org.hibernate.annotations.Type;
import org.hibernate.type.StringClobType;
import org.jboss.netty.util.internal.LinkedTransferQueue;
import com.eucalyptus.bootstrap.Bootstrap;
import com.eucalyptus.bootstrap.BootstrapArgs;
Expand All @@ -111,8 +110,8 @@
import com.eucalyptus.configurable.ConfigurableField;
import com.eucalyptus.empyrean.ServiceStatusDetail;
import com.eucalyptus.empyrean.ServiceStatusType;
import com.eucalyptus.event.ClockTick;
import com.eucalyptus.event.EventListener;
import com.eucalyptus.event.Hertz;
import com.eucalyptus.event.Listeners;
import com.eucalyptus.records.Logs;
import com.eucalyptus.scripting.Groovyness;
Expand Down Expand Up @@ -634,17 +633,17 @@ public static void submit( final ServiceConfiguration parent, TransitionRecord<S
}
}

public static class FaultNotificationHandler implements EventListener<ClockTick>, Callable<Boolean> {
public static class FaultNotificationHandler implements EventListener<Hertz>, Callable<Boolean> {
private static final AtomicBoolean ready = new AtomicBoolean( true );
private static final AtomicLong lastDigest = new AtomicLong( System.currentTimeMillis( ) );

public static void register( ) {
Listeners.register( ClockTick.class, new FaultNotificationHandler( ) );
Listeners.register( Hertz.class, new FaultNotificationHandler( ) );
}

@Override
public void fireEvent( final ClockTick event ) {
if ( BootstrapArgs.isCloudController( ) && ready.compareAndSet( true, false ) ) {
public void fireEvent( final Hertz event ) {
if ( Bootstrap.isOperational( ) && event.isAsserted( Faults.BATCH_DELAY_SECONDS ) && ready.compareAndSet( true, false ) ) {
try {
Threads.enqueue( Eucalyptus.class, Faults.class, this );
} catch ( final Exception ex ) {
Expand All @@ -656,7 +655,6 @@ public void fireEvent( final ClockTick event ) {
@Override
public Boolean call( ) throws Exception {
try {
TimeUnit.SECONDS.sleep( Faults.BATCH_DELAY_SECONDS );
sendFaults( );
sendDigest( );
} finally {
Expand Down

0 comments on commit c1348c0

Please sign in to comment.