Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Dev/grze/euca 5133 #20

Closed
wants to merge 11 commits into from
This page is out of date. Refresh to see the latest.
View
2  clc/modules/cluster-manager/src/main/java/com/eucalyptus/blockstorage/Snapshots.java
@@ -123,7 +123,7 @@ public static void register( ) {
@Override
public void fireEvent( ClockTick event ) {
- if ( Hosts.isCoordinator( ) && ready.compareAndSet( true, false ) ) {
+ if ( Topology.isEnabledLocally( Eucalyptus.class ) && ready.compareAndSet( true, false ) ) {
try {
Threads.enqueue( Eucalyptus.class, Snapshots.class, this );
} catch ( Exception ex ) {
View
2  clc/modules/cluster-manager/src/main/java/com/eucalyptus/blockstorage/Volumes.java
@@ -165,7 +165,7 @@ public static void register( ) {
@Override
public void fireEvent( final ClockTick event ) {
- if ( Hosts.isCoordinator( ) && ready.compareAndSet( true, false ) ) {
+ if ( Topology.isEnabledLocally( Eucalyptus.class ) && ready.compareAndSet( true, false ) ) {
try {
Threads.enqueue( Eucalyptus.class, Volumes.class, this );
} catch ( final Exception ex ) {
View
12 clc/modules/msgs/src/main/java/com/eucalyptus/component/Faults.java
@@ -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;
@@ -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;
@@ -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 ) {
@@ -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 {
View
15 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/modules/backend/DescribeSensorsListener.java
@@ -21,11 +21,10 @@
package com.eucalyptus.reporting.modules.backend;
import org.apache.log4j.Logger;
-
import com.eucalyptus.bootstrap.Bootstrap;
+import com.eucalyptus.bootstrap.BootstrapArgs;
import com.eucalyptus.bootstrap.Hosts;
import com.eucalyptus.cluster.callback.DescribeSensorCallback;
-
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -56,16 +55,18 @@
private Integer HISTORY_SIZE = 5;
private Integer MAX_WRITE_INTERVAL_MS = 86400000;
private Integer SENSOR_QUERY_BATCH_SIZE = 10;
-
+
private static final Logger LOG = Logger.getLogger(DescribeSensorsListener.class);
-
+
public static void register() {
Listeners.register( Hertz.class, new DescribeSensorsListener() );
}
-
+
@Override
public void fireEvent( Hertz event ) {
-
+ if ( !Bootstrap.isOperational( ) || !BootstrapArgs.isCloudController( ) || !event.isAsserted( DEFAULT_POLL_INTERVAL_MINS ) ) {
+ return;
+ } else {
if (DEFAULT_POLL_INTERVAL_MINS >= 1) {
COLLECTION_INTERVAL_TIME_MS = ((int) TimeUnit.MINUTES
.toMillis(DEFAULT_POLL_INTERVAL_MINS) / 2);
@@ -118,6 +119,6 @@ public void fireEvent( Hertz event ) {
+ DEFAULT_POLL_INTERVAL_MINS
+ " must be less than 1440 minutes");
}
-
+ }
}
}
View
6 ...storage-controller/src/main/java/edu/ucsb/eucalyptus/cloud/ws/BlockStorageAvailabilityEventListener.java
@@ -28,6 +28,8 @@
import com.eucalyptus.bootstrap.Bootstrap;
import com.eucalyptus.bootstrap.Hosts;
import com.eucalyptus.cluster.Clusters;
+import com.eucalyptus.component.Topology;
+import com.eucalyptus.component.id.Storage;
import com.eucalyptus.entities.TransactionException;
import com.eucalyptus.entities.Transactions;
import com.eucalyptus.event.ClockTick;
@@ -45,7 +47,7 @@
* Event listener that fires resource availability events for block storage.
*/
public class BlockStorageAvailabilityEventListener implements EventListener<ClockTick> {
- private static Logger logger = Logger.getLogger( WalrusAvailabilityEventListener.class );
+ private static Logger logger = Logger.getLogger( BlockStorageAvailabilityEventListener.class );
public static void register( ) {
Listeners.register( ClockTick.class, new BlockStorageAvailabilityEventListener() );
@@ -53,7 +55,7 @@ public static void register( ) {
@Override
public void fireEvent( final ClockTick event ) {
- if ( Bootstrap.isFinished() && Hosts.isCoordinator() ) {
+ if ( Topology.isEnabledLocally( Storage.class ) && Bootstrap.isFinished() ) {
final List<Availability> resourceAvailability = Lists.newArrayList();
final Set<String> partitions =
Sets.newHashSet( Iterables.transform( Clusters.getInstance().listValues(), HasFullName.GET_PARTITION ) );
View
13 clc/modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/DBResourceCheck.java
@@ -35,6 +35,7 @@
import org.logicalcobwebs.proxool.ProxoolException;
import org.logicalcobwebs.proxool.ProxoolFacade;
+import com.eucalyptus.bootstrap.OrderedShutdown;
import com.eucalyptus.component.ComponentId;
import com.eucalyptus.component.ComponentIds;
import com.eucalyptus.component.Faults;
@@ -57,6 +58,16 @@
public class DBResourceCheck extends Thread {
private final static Logger LOG = Logger.getLogger(DBResourceCheck.class);
private static final ScheduledExecutorService pool = Executors.newSingleThreadScheduledExecutor();
+ private static final Runnable shutdownHook = new Runnable( ) {
+
+ @Override
+ public void run( ) {
+ if ( !pool.isShutdown( ) ) {
+ pool.shutdownNow( );
+ }
+ }
+
+ };
private static final int OUT_OF_DB_CONNECTIONS_FAULT_ID = 1006;
private final static long DEFAULT_POLL_INTERVAL = 60 * 1000;
private static final Class<? extends ComponentId> DEFAULT_COMPONENT_ID_CLASS = Eucalyptus.class;
@@ -65,6 +76,7 @@
* Marking the constructor private on purpose, so that no code can instantiate an object this class
*/
private DBResourceCheck() {}
+
/**
* <p>
* Kicks off an infinite series of disk resource checks with a delay in between consecutive checks. {@link ScheduledExecutorService#scheduleWithFixedDelay
@@ -81,6 +93,7 @@ private DBResourceCheck() {}
* @return ScheduledFuture
*/
public static ScheduledFuture<?> start(DBChecker checker) {
+ OrderedShutdown.registerPreShutdownHook( shutdownHook );
return pool.scheduleWithFixedDelay(checker, 0, checker.pollInterval, TimeUnit.MILLISECONDS);
}
View
4 clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusAvailabilityEventListener.java
@@ -25,6 +25,8 @@
import org.apache.log4j.Logger;
import com.eucalyptus.bootstrap.Bootstrap;
import com.eucalyptus.bootstrap.Hosts;
+import com.eucalyptus.component.Topology;
+import com.eucalyptus.component.id.Walrus;
import com.eucalyptus.event.ClockTick;
import com.eucalyptus.event.EventListener;
import com.eucalyptus.event.ListenerRegistry;
@@ -45,7 +47,7 @@ public static void register( ) {
@Override
public void fireEvent( final ClockTick event ) {
- if ( Bootstrap.isFinished() && Hosts.isCoordinator() ) {
+ if ( Topology.isEnabledLocally( Walrus.class ) && Bootstrap.isFinished() ) {
try {
WalrusInfo wInfo = WalrusInfo.getWalrusInfo();
View
1  clc/modules/www/src/main/java/com/eucalyptus/bootstrap/HttpServerBootstrapper.java
@@ -183,6 +183,7 @@ public boolean enable( ) throws Exception {
*/
@Override
public boolean stop( ) throws Exception {
+ jettyServer.stop( );
return true;
}
Something went wrong with that request. Please try again.