Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
fix to state check queue arrival, disable volatile instance updates b…
Browse files Browse the repository at this point in the history
…y default
  • Loading branch information
chris grzegorczyk committed Jan 26, 2012
2 parents 3250cd5 + 0eb5e32 commit 419312a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ protected boolean inState( final VmState state ) {
public static String INSTANCE_SUBDOMAIN = ".eucalyptus";
@ConfigurableField( description = "Period (in seconds) between state updates for actively changing state.",
initial = "3" )
public static Long VOLATILE_STATE_INTERVAL_SEC = 3l;
public static Long VOLATILE_STATE_INTERVAL_SEC = Long.MAX_VALUE;
@ConfigurableField( description = "Timeout (in seconds) before a requested instance terminate will be repeated.",
initial = "60" )
public static Long VOLATILE_STATE_TIMEOUT_SEC = 60l;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public DatabaseStateException( String string ) {
}

private static final int MAX_TX_START_SYNC_RETRIES = 120;
private static final AtomicInteger counter = new AtomicInteger( 120 );
private static final AtomicInteger counter = new AtomicInteger( 500 );
private static final Predicate<Host> FILTER_SYNCING_DBS = Predicates.and( DbFilter.INSTANCE, Predicates.not( SyncedDbFilter.INSTANCE ) );
private static final ScriptedDbBootstrapper singleton = new ScriptedDbBootstrapper( );
private static Logger LOG = Logger.getLogger( Databases.class );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.log4j.Logger;
import com.eucalyptus.bootstrap.Bootstrap;
import com.eucalyptus.bootstrap.BootstrapArgs;
Expand Down Expand Up @@ -169,33 +168,34 @@ public <C> Future<C> enqueue( final Callable<C> call ) {
private enum TopologyTimer implements EventListener<ClockTick> {
INSTANCE;
private static final AtomicInteger counter = new AtomicInteger( 0 );
private static final Lock canHas = new ReentrantLock( );
private static final AtomicBoolean busy = new AtomicBoolean( false );

@Override
public void fireEvent( final ClockTick event ) {
if ( Hosts.isCoordinator( ) && canHas.tryLock( ) ) {
Queue.INTERNAL.enqueue( new Callable<Object>( ) {
public Object call( ) {
try {
return RunChecks.INSTANCE.call( );
} finally {
canHas.unlock( );
}
}
} );
} else if ( counter.incrementAndGet( ) % 3 == 0 && canHas.tryLock( ) ) {
Queue.INTERNAL.enqueue( new Callable<Object>( ) {
public Object call( ) {
try {
return RunChecks.INSTANCE.call( );
} finally {
canHas.unlock( );
}
Callable<Object> call = new Callable<Object>( ) {
public Object call( ) {
try {
TimeUnit.SECONDS.sleep( 10 );
return RunChecks.INSTANCE.call( );
} catch ( InterruptedException ex ) {
return Exceptions.maybeInterrupted( ex );
} finally {
busy.set( false );
}
} );
} else if ( counter.incrementAndGet( ) > 10 ) {
counter.set( 0 );
Queue.INTERNAL.enqueue( RunChecks.INSTANCE );
}
};
if ( Hosts.isCoordinator( ) && busy.compareAndSet( false, true ) ) {
try {
Queue.INTERNAL.enqueue( call );
} catch ( Exception ex ) {
busy.set( false );
}
} else if ( counter.incrementAndGet( ) % 3 == 0 && busy.compareAndSet( false, true ) ) {
try {
Queue.INTERNAL.enqueue( call );
} catch ( Exception ex ) {
busy.set( false );
}
}
}

Expand Down Expand Up @@ -730,7 +730,7 @@ enum WaitForResults implements Predicate<Future> {
@Override
public boolean apply( final Future input ) {
try {
final Object conf = input.get( 30, TimeUnit.SECONDS );
final Object conf = input.get( 120, TimeUnit.SECONDS );
return true;
} catch ( final InterruptedException ex ) {
Thread.currentThread( ).interrupt( );
Expand Down

0 comments on commit 419312a

Please sign in to comment.