Exemple #1
0
 @Override
 public List<? extends Host> findHosts(long accountId, long instanceId) {
   return create()
       .select(HOST.fields())
       .from(INSTANCE)
       .join(INSTANCE_HOST_MAP)
       .on(INSTANCE.ID.eq(INSTANCE_HOST_MAP.INSTANCE_ID))
       .join(HOST)
       .on(HOST.ID.eq(INSTANCE_HOST_MAP.HOST_ID))
       .where(
           HOST.REMOVED
               .isNull()
               .and(INSTANCE_HOST_MAP.REMOVED.isNull())
               .and(INSTANCE.ID.eq(instanceId)))
       .fetchInto(HostRecord.class);
 }
Exemple #2
0
 @Override
 public List<? extends Instance> findBadInstances(int count) {
   return create()
       .select(INSTANCE.fields())
       .from(INSTANCE)
       .join(INSTANCE_HOST_MAP)
       .on(INSTANCE_HOST_MAP.INSTANCE_ID.eq(INSTANCE.ID))
       .join(HOST)
       .on(INSTANCE_HOST_MAP.HOST_ID.eq(HOST.ID))
       .where(
           HOST.REMOVED
               .isNotNull()
               .and(INSTANCE.REMOVED.isNull())
               .and(
                   INSTANCE.STATE.notIn(
                       InstanceConstants.STATE_STOPPING, CommonStatesConstants.REMOVING)))
       .limit(count)
       .fetchInto(InstanceRecord.class);
 }