Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merged from eee

  • Loading branch information...
commit cfdc10d0caa75f0d117cd51172806b3433e9055e 2 parents 2078f58 + 44ed20a
@dmitrii dmitrii authored
View
13 clc/modules/msgs/src/main/java/com/eucalyptus/component/Faults.java
@@ -167,6 +167,11 @@ public boolean apply( final Throwable input ) {
@Transient
private CheckException other;
+ @SuppressWarnings( "unused" )
+ public CheckException( ) {
+ this( null );
+ }
+
private CheckException( final String serviceName ) {
this.serviceName = serviceName;
this.severity = null;
@@ -429,7 +434,7 @@ private static CheckException chain( final ServiceConfiguration config, final Se
return last;
} catch ( Exception ex ) {
LOG.error( "Faults: error in processing previous error: " + ex );
- Logs.extreme( ).error( ex , ex );
+ Logs.extreme( ).error( ex, ex );
return new CheckException( config, Severity.ERROR, ex );
}
}
@@ -487,14 +492,14 @@ public CheckException apply( final ServiceStatusType input ) {
public static Collection<CheckException> lookup( final ServiceConfiguration config ) {
final EntityTransaction db = Entities.get( CheckException.class );
try {
- final List<CheckException> res = Entities.query( new CheckException( config.getName( ) ) );
+ final List<CheckException> res = Entities.query( new CheckException( config.getName( ) ), true, 1 );
db.commit( );
return res;
} catch ( final Exception ex ) {
LOG.error( "Failed to lookup error information for: " + config.getFullName( ), ex );
db.rollback( );
}
- return null;
+ return Lists.newArrayList( );
}
public static void persist( final CheckException errors ) {
@@ -512,7 +517,7 @@ public static void persist( final CheckException errors ) {
}
} catch ( Exception ex ) {
LOG.error( "Faults: error in processing previous error: " + errors );
- Logs.extreme( ).error( ex , ex );
+ Logs.extreme( ).error( ex, ex );
}
}
}
View
15 clc/modules/msgs/src/main/java/com/eucalyptus/entities/Entities.java
@@ -233,6 +233,21 @@ public static EntityTransaction get( final Object obj ) {
return Lists.newArrayList( Sets.newHashSet( resultList ) );
}
+ @SuppressWarnings( { "unchecked", "cast" } )
+ public static <T> List<T> query( final T example, final boolean readOnly, final int maxResults ) {
+ final Example qbe = Example.create( example ).enableLike( MatchMode.EXACT );
+ final List<T> resultList = ( List<T> ) getTransaction( example ).getTxState( ).getSession( )
+ .createCriteria( example.getClass( ) )
+ .setReadOnly( readOnly )
+ .setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY )
+ .setCacheable( true )
+ .add( qbe )
+ .setMaxResults( maxResults )
+ .setFetchSize( maxResults )
+ .list( );
+ return Lists.newArrayList( Sets.newHashSet( resultList ) );
+ }
+
public static <T> T uniqueResult( final T example ) throws TransactionException, NoSuchElementException {
try {
final Object pk = resolvePrimaryKey( example );
Please sign in to comment.
Something went wrong with that request. Please try again.