public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFSecuritySysClusterHBuff) {
     CFSecuritySysClusterHBuff rhs = (CFSecuritySysClusterHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredSingletonId() != rhs.getRequiredSingletonId()) {
       return (false);
     }
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySysClusterBuff) {
     CFSecuritySysClusterBuff rhs = (CFSecuritySysClusterBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredSingletonId() != rhs.getRequiredSingletonId()) {
       return (false);
     }
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySysClusterByClusterIdxKey) {
     CFSecuritySysClusterByClusterIdxKey rhs = (CFSecuritySysClusterByClusterIdxKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySysClusterHPKey) {
     CFSecuritySysClusterHPKey rhs = (CFSecuritySysClusterHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredSingletonId() != rhs.getRequiredSingletonId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityHPKey) {
     CFSecurityHPKey rhs = (CFSecurityHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFSecuritySysClusterPKey) {
     CFSecuritySysClusterPKey rhs = (CFSecuritySysClusterPKey) obj;
     if (getRequiredSingletonId() != rhs.getRequiredSingletonId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFBamEnumTagHBuff) {
     CFBamEnumTagHBuff rhs = (CFBamEnumTagHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (getOptionalDefSchemaTenantId() != null) {
       if (rhs.getOptionalDefSchemaTenantId() != null) {
         if (!getOptionalDefSchemaTenantId().equals(rhs.getOptionalDefSchemaTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalDefSchemaTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalDefSchemaId() != null) {
       if (rhs.getOptionalDefSchemaId() != null) {
         if (!getOptionalDefSchemaId().equals(rhs.getOptionalDefSchemaId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalDefSchemaId() != null) {
         return (false);
       }
     }
     if (getRequiredEnumId() != rhs.getRequiredEnumId()) {
       return (false);
     }
     if (getOptionalEnumCode() != null) {
       if (rhs.getOptionalEnumCode() != null) {
         if (!getOptionalEnumCode().equals(rhs.getOptionalEnumCode())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalEnumCode() != null) {
         return (false);
       }
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     if (getOptionalPrevTenantId() != null) {
       if (rhs.getOptionalPrevTenantId() != null) {
         if (!getOptionalPrevTenantId().equals(rhs.getOptionalPrevTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalPrevTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalPrevId() != null) {
       if (rhs.getOptionalPrevId() != null) {
         if (!getOptionalPrevId().equals(rhs.getOptionalPrevId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalPrevId() != null) {
         return (false);
       }
     }
     if (getOptionalNextTenantId() != null) {
       if (rhs.getOptionalNextTenantId() != null) {
         if (!getOptionalNextTenantId().equals(rhs.getOptionalNextTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNextTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalNextId() != null) {
       if (rhs.getOptionalNextId() != null) {
         if (!getOptionalNextId().equals(rhs.getOptionalNextId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNextId() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagBuff) {
     CFBamEnumTagBuff rhs = (CFBamEnumTagBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (getOptionalDefSchemaTenantId() != null) {
       if (rhs.getOptionalDefSchemaTenantId() != null) {
         if (!getOptionalDefSchemaTenantId().equals(rhs.getOptionalDefSchemaTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalDefSchemaTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalDefSchemaId() != null) {
       if (rhs.getOptionalDefSchemaId() != null) {
         if (!getOptionalDefSchemaId().equals(rhs.getOptionalDefSchemaId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalDefSchemaId() != null) {
         return (false);
       }
     }
     if (getRequiredEnumId() != rhs.getRequiredEnumId()) {
       return (false);
     }
     if (getOptionalEnumCode() != null) {
       if (rhs.getOptionalEnumCode() != null) {
         if (!getOptionalEnumCode().equals(rhs.getOptionalEnumCode())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalEnumCode() != null) {
         return (false);
       }
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     if (getOptionalPrevTenantId() != null) {
       if (rhs.getOptionalPrevTenantId() != null) {
         if (!getOptionalPrevTenantId().equals(rhs.getOptionalPrevTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalPrevTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalPrevId() != null) {
       if (rhs.getOptionalPrevId() != null) {
         if (!getOptionalPrevId().equals(rhs.getOptionalPrevId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalPrevId() != null) {
         return (false);
       }
     }
     if (getOptionalNextTenantId() != null) {
       if (rhs.getOptionalNextTenantId() != null) {
         if (!getOptionalNextTenantId().equals(rhs.getOptionalNextTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNextTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalNextId() != null) {
       if (rhs.getOptionalNextId() != null) {
         if (!getOptionalNextId().equals(rhs.getOptionalNextId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNextId() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagByEnumTagTenantIdxKey) {
     CFBamEnumTagByEnumTagTenantIdxKey rhs = (CFBamEnumTagByEnumTagTenantIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagByEnumIdxKey) {
     CFBamEnumTagByEnumIdxKey rhs = (CFBamEnumTagByEnumIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredEnumId() != rhs.getRequiredEnumId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagByDefSchemaIdxKey) {
     CFBamEnumTagByDefSchemaIdxKey rhs = (CFBamEnumTagByDefSchemaIdxKey) obj;
     if (getOptionalDefSchemaTenantId() != null) {
       if (rhs.getOptionalDefSchemaTenantId() != null) {
         if (!getOptionalDefSchemaTenantId().equals(rhs.getOptionalDefSchemaTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalDefSchemaTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalDefSchemaId() != null) {
       if (rhs.getOptionalDefSchemaId() != null) {
         if (!getOptionalDefSchemaId().equals(rhs.getOptionalDefSchemaId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalDefSchemaId() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagByEnumNameIdxKey) {
     CFBamEnumTagByEnumNameIdxKey rhs = (CFBamEnumTagByEnumNameIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredEnumId() != rhs.getRequiredEnumId()) {
       return (false);
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagByPrevIdxKey) {
     CFBamEnumTagByPrevIdxKey rhs = (CFBamEnumTagByPrevIdxKey) obj;
     if (getOptionalPrevTenantId() != null) {
       if (rhs.getOptionalPrevTenantId() != null) {
         if (!getOptionalPrevTenantId().equals(rhs.getOptionalPrevTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalPrevTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalPrevId() != null) {
       if (rhs.getOptionalPrevId() != null) {
         if (!getOptionalPrevId().equals(rhs.getOptionalPrevId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalPrevId() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagByNextIdxKey) {
     CFBamEnumTagByNextIdxKey rhs = (CFBamEnumTagByNextIdxKey) obj;
     if (getOptionalNextTenantId() != null) {
       if (rhs.getOptionalNextTenantId() != null) {
         if (!getOptionalNextTenantId().equals(rhs.getOptionalNextTenantId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNextTenantId() != null) {
         return (false);
       }
     }
     if (getOptionalNextId() != null) {
       if (rhs.getOptionalNextId() != null) {
         if (!getOptionalNextId().equals(rhs.getOptionalNextId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalNextId() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagHPKey) {
     CFBamEnumTagHPKey rhs = (CFBamEnumTagHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamHPKey) {
     CFBamHPKey rhs = (CFBamHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamEnumTagPKey) {
     CFBamEnumTagPKey rhs = (CFBamEnumTagPKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFFreeSwitchFSSFDirectoryHBuff) {
     CFFreeSwitchFSSFDirectoryHBuff rhs = (CFFreeSwitchFSSFDirectoryHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredFSSFDirectoryId() != rhs.getRequiredFSSFDirectoryId()) {
       return (false);
     }
     if (getRequiredFSSofiaId() != rhs.getRequiredFSSofiaId()) {
       return (false);
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     if (!getRequiredDialString().equals(rhs.getRequiredDialString())) {
       return (false);
     }
     if (getRequiredRecordStereo() != rhs.getRequiredRecordStereo()) {
       return (false);
     }
     if (!getRequiredDefaultGateway().equals(rhs.getRequiredDefaultGateway())) {
       return (false);
     }
     if (!getRequiredDefaultAreacode().equals(rhs.getRequiredDefaultAreacode())) {
       return (false);
     }
     if (!getRequiredTransferFallbackExtension()
         .equals(rhs.getRequiredTransferFallbackExtension())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFFreeSwitchFSSFDirectoryBuff) {
     CFFreeSwitchFSSFDirectoryBuff rhs = (CFFreeSwitchFSSFDirectoryBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredFSSFDirectoryId() != rhs.getRequiredFSSFDirectoryId()) {
       return (false);
     }
     if (getRequiredFSSofiaId() != rhs.getRequiredFSSofiaId()) {
       return (false);
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     if (!getRequiredDialString().equals(rhs.getRequiredDialString())) {
       return (false);
     }
     if (getRequiredRecordStereo() != rhs.getRequiredRecordStereo()) {
       return (false);
     }
     if (!getRequiredDefaultGateway().equals(rhs.getRequiredDefaultGateway())) {
       return (false);
     }
     if (!getRequiredDefaultAreacode().equals(rhs.getRequiredDefaultAreacode())) {
       return (false);
     }
     if (!getRequiredTransferFallbackExtension()
         .equals(rhs.getRequiredTransferFallbackExtension())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFFreeSwitchFSSFDirectoryByTenantIdxKey) {
     CFFreeSwitchFSSFDirectoryByTenantIdxKey rhs = (CFFreeSwitchFSSFDirectoryByTenantIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFFreeSwitchFSSFDirectoryBySofiaIdxKey) {
     CFFreeSwitchFSSFDirectoryBySofiaIdxKey rhs = (CFFreeSwitchFSSFDirectoryBySofiaIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredFSSofiaId() != rhs.getRequiredFSSofiaId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFFreeSwitchFSSFDirectoryByUNameIdxKey) {
     CFFreeSwitchFSSFDirectoryByUNameIdxKey rhs = (CFFreeSwitchFSSFDirectoryByUNameIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredFSSofiaId() != rhs.getRequiredFSSofiaId()) {
       return (false);
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFFreeSwitchFSSFDirectoryHPKey) {
     CFFreeSwitchFSSFDirectoryHPKey rhs = (CFFreeSwitchFSSFDirectoryHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredFSSFDirectoryId() != rhs.getRequiredFSSFDirectoryId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFFreeSwitchHPKey) {
     CFFreeSwitchHPKey rhs = (CFFreeSwitchHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFFreeSwitchFSSFDirectoryPKey) {
     CFFreeSwitchFSSFDirectoryPKey rhs = (CFFreeSwitchFSSFDirectoryPKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredFSSFDirectoryId() != rhs.getRequiredFSSFDirectoryId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }
  /** @throws Exception If failed. */
  public void testAffinityPut() throws Exception {
    Thread.sleep(2 * TOP_REFRESH_FREQ);

    assertEquals(NODES_CNT, client.compute().refreshTopology(false, false).size());

    Map<UUID, Grid> gridsByLocNode = new HashMap<>(NODES_CNT);

    GridClientData partitioned = client.data(PARTITIONED_CACHE_NAME);

    GridClientCompute compute = client.compute();

    for (int i = 0; i < NODES_CNT; i++) gridsByLocNode.put(grid(i).localNode().id(), grid(i));

    for (int i = 0; i < 100; i++) {
      String key = "key" + i;

      UUID primaryNodeId = grid(0).mapKeyToNode(PARTITIONED_CACHE_NAME, key).id();

      assertEquals("Affinity mismatch for key: " + key, primaryNodeId, partitioned.affinity(key));

      assertEquals(primaryNodeId, partitioned.affinity(key));

      // Must go to primary node only. Since backup count is 0, value must present on
      // primary node only.
      partitioned.put(key, "val" + key);

      for (Map.Entry<UUID, Grid> entry : gridsByLocNode.entrySet()) {
        Object val = entry.getValue().cache(PARTITIONED_CACHE_NAME).peek(key);

        if (primaryNodeId.equals(entry.getKey())) assertEquals("val" + key, val);
        else assertNull(val);
      }
    }

    // Now check that we will see value in near cache in pinned mode.
    for (int i = 100; i < 200; i++) {
      String pinnedKey = "key" + i;

      UUID primaryNodeId = grid(0).mapKeyToNode(PARTITIONED_CACHE_NAME, pinnedKey).id();

      UUID pinnedNodeId = F.first(F.view(gridsByLocNode.keySet(), F.notEqualTo(primaryNodeId)));

      GridClientNode node = compute.node(pinnedNodeId);

      partitioned.pinNodes(node).put(pinnedKey, "val" + pinnedKey);

      for (Map.Entry<UUID, Grid> entry : gridsByLocNode.entrySet()) {
        Object val = entry.getValue().cache(PARTITIONED_CACHE_NAME).peek(pinnedKey);

        if (primaryNodeId.equals(entry.getKey()) || pinnedNodeId.equals(entry.getKey()))
          assertEquals("val" + pinnedKey, val);
        else assertNull(val);
      }
    }
  }
예제 #5
0
  /**
   * Store an end-point to host ID mapping. Each ID must be unique, and cannot be changed after the
   * fact.
   *
   * @param hostId
   * @param endpoint
   */
  public void updateHostId(UUID hostId, InetAddress endpoint) {
    assert hostId != null;
    assert endpoint != null;

    lock.writeLock().lock();
    try {
      InetAddress storedEp = endpointToHostIdMap.inverse().get(hostId);
      if (storedEp != null) {
        if (!storedEp.equals(endpoint) && (FailureDetector.instance.isAlive(storedEp))) {
          throw new RuntimeException(
              String.format(
                  "Host ID collision between active endpoint %s and %s (id=%s)",
                  storedEp, endpoint, hostId));
        }
      }

      UUID storedId = endpointToHostIdMap.get(endpoint);
      if ((storedId != null) && (!storedId.equals(hostId)))
        logger.warn("Changing {}'s host ID from {} to {}", endpoint, storedId, hostId);

      endpointToHostIdMap.forcePut(endpoint, hostId);
    } finally {
      lock.writeLock().unlock();
    }
  }
  public boolean isSameObject(
      DatabaseObject object1, DatabaseObject object2, Database accordingTo) {
    if (object1 == null && object2 == null) {
      return true;
    }
    if (object1 == null || object2 == null) {
      return false;
    }

    UUID snapshotId1 = object1.getSnapshotId();
    UUID snapshotId2 = object2.getSnapshotId();
    if (snapshotId1 != null && snapshotId2 != null) {
      if (snapshotId1.equals(snapshotId2)) {
        return true;
      }
    }

    boolean aHashMatches = false;

    List<String> hash1 = Arrays.asList(hash(object1, accordingTo));
    List<String> hash2 = Arrays.asList(hash(object2, accordingTo));
    for (String hash : hash1) {
      if (hash2.contains(hash)) {
        aHashMatches = true;
        break;
      }
    }

    if (!aHashMatches) {
      return false;
    }

    return createComparatorChain(object1.getClass(), accordingTo)
        .isSameObject(object1, object2, accordingTo);
  }
    /** {@inheritDoc} */
    @SuppressWarnings({"unchecked"})
    @Override
    public boolean equals(Object obj) {
      if (obj == this) return true;

      CancelMessageId other = (CancelMessageId) obj;

      return reqId == other.reqId && nodeId.equals(other.nodeId);
    }
예제 #8
0
 @Override
 public GlowWorld getWorld(UUID uid) {
   for (GlowWorld world : worlds.getWorlds()) {
     if (uid.equals(world.getUID())) {
       return world;
     }
   }
   return null;
 }
예제 #9
0
  /**
   * @param meta Job metadata.
   * @return {@code true} If local node is participating in job execution.
   */
  public boolean isParticipating(HadoopJobMetadata meta) {
    UUID locNodeId = localNodeId();

    if (locNodeId.equals(meta.submitNodeId())) return true;

    HadoopMapReducePlan plan = meta.mapReducePlan();

    return plan.mapperNodeIds().contains(locNodeId)
        || plan.reducerNodeIds().contains(locNodeId)
        || jobUpdateLeader();
  }
예제 #10
0
파일: Person.java 프로젝트: 99soft/be3
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Person person = (Person) o;

    if (id != null ? !id.equals(person.id) : person.id != null) return false;

    return true;
  }
예제 #11
0
파일: Q2.java 프로젝트: rlishtaba/jPOS
  private boolean deploy(File f) {
    try {
      if (log != null) log.info("deploy:" + f.getCanonicalPath());
      QEntry qentry = (QEntry) dirMap.get(f);
      SAXBuilder builder = createSAXBuilder();
      Document doc;
      if (decorator != null && !f.getName().equals(LOGGER_CONFIG)) {
        doc = decrypt(builder.build(new StringReader(decorator.decorateFile(f))));
      } else {
        doc = decrypt(builder.build(f));
      }

      Element rootElement = doc.getRootElement();
      String iuuid = rootElement.getAttributeValue("instance");
      if (iuuid != null) {
        UUID uuid = UUID.fromString(iuuid);
        if (!uuid.equals(getInstanceId())) {
          deleteFile(f, iuuid);
          return false;
        }
      }
      Object obj = factory.instantiate(this, rootElement);
      qentry.setObject(obj);

      ObjectInstance instance = factory.createQBean(this, doc.getRootElement(), obj);
      qentry.setInstance(instance);
    } catch (InstanceAlreadyExistsException e) {
      /*
       * Ok, the file we tried to deploy, holds an object
       *  that already has been deployed.
       *
       * Rename it out of the way.
       *
       */
      tidyFileAway(f, DUPLICATE_EXTENSION);
      getLog().warn("deploy", e);
      return false;
    } catch (Exception e) {
      getLog().warn("deploy", e);
      tidyFileAway(f, ERROR_EXTENSION);
      // This will also save deploy error repeats...
      return false;
    } catch (Error e) {
      getLog().warn("deploy", e);
      tidyFileAway(f, ENV_EXTENSION);
      // This will also save deploy error repeats...
      return false;
    }
    return true;
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      // Request Attributes
      String attrSecSessionId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstLogOut");

      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = (CFFreeSwitchXMsgRqstHandler) getParser();
      if (xmsgRqstHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFFreeSwitchSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SecSessionId")) {
          if (attrSecSessionId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecSessionId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Ensure that required attributes have values
      if ((attrSecSessionId == null) || (attrSecSessionId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecSessionId");
      }

      UUID secSessionId = UUID.fromString(attrSecSessionId);
      if (secSessionId == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "converted-secSessionId");
      }
      if (schemaObj.getAuthorization() == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newRuntimeException(getClass(), S_ProcName, "Already disconnected from the database");
      }
      ICFSecuritySecSessionObj secSession = schemaObj.getSecSession();
      if (secSession == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newRuntimeException(
                getClass(), S_ProcName, "Security session does not exist for this schema");
      }
      if (!secSessionId.equals(secSession.getRequiredSecSessionId())) {
        throw CFLib.getDefaultExceptionFactory()
            .newRuntimeException(
                getClass(),
                S_ProcName,
                "Security session id does not match the one established by this schema");
      }
      if (secSession.getOptionalFinish() == null) {
        schemaObj.rollback();
        schemaObj.beginTransaction();
        ICFSecuritySecSessionEditObj editSecSession = secSession.beginEdit();
        editSecSession.setOptionalFinish(Calendar.getInstance());
        editSecSession.update();
        editSecSession.endEdit();
        schemaObj.commit();
      }
      schemaObj.disconnect(false);
      schemaObj.setAuthorization(null);
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnLoggedOut("\n\t\t\t", secSessionId)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      ((CFFreeSwitchXMsgRqstHandler) getParser()).appendResponse(response);
    } catch (RuntimeException e) {
      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFBamISOLanguageHPKey) {
     CFBamISOLanguageHPKey rhs = (CFBamISOLanguageHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamHPKey) {
     CFBamHPKey rhs = (CFBamHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamISOLanguagePKey) {
     CFBamISOLanguagePKey rhs = (CFBamISOLanguagePKey) obj;
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamISOLanguageHBuff) {
     CFBamISOLanguageHBuff rhs = (CFBamISOLanguageHBuff) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamISOLanguageBuff) {
     CFBamISOLanguageBuff rhs = (CFBamISOLanguageBuff) obj;
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else {
     return (false);
   }
 }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFCrmAddressHBuff) {
     CFCrmAddressHBuff rhs = (CFCrmAddressHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredAddressId() != rhs.getRequiredAddressId()) {
       return (false);
     }
     if (getRequiredContactId() != rhs.getRequiredContactId()) {
       return (false);
     }
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     if (getOptionalAddrLine1() != null) {
       if (rhs.getOptionalAddrLine1() != null) {
         if (!getOptionalAddrLine1().equals(rhs.getOptionalAddrLine1())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalAddrLine1() != null) {
         return (false);
       }
     }
     if (getOptionalAddrLine2() != null) {
       if (rhs.getOptionalAddrLine2() != null) {
         if (!getOptionalAddrLine2().equals(rhs.getOptionalAddrLine2())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalAddrLine2() != null) {
         return (false);
       }
     }
     if (getOptionalCity() != null) {
       if (rhs.getOptionalCity() != null) {
         if (!getOptionalCity().equals(rhs.getOptionalCity())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCity() != null) {
         return (false);
       }
     }
     if (getOptionalState() != null) {
       if (rhs.getOptionalState() != null) {
         if (!getOptionalState().equals(rhs.getOptionalState())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalState() != null) {
         return (false);
       }
     }
     if (getOptionalCountryId() != null) {
       if (rhs.getOptionalCountryId() != null) {
         if (!getOptionalCountryId().equals(rhs.getOptionalCountryId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCountryId() != null) {
         return (false);
       }
     }
     if (getOptionalZip() != null) {
       if (rhs.getOptionalZip() != null) {
         if (!getOptionalZip().equals(rhs.getOptionalZip())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalZip() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFCrmAddressBuff) {
     CFCrmAddressBuff rhs = (CFCrmAddressBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredAddressId() != rhs.getRequiredAddressId()) {
       return (false);
     }
     if (getRequiredContactId() != rhs.getRequiredContactId()) {
       return (false);
     }
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     if (getOptionalAddrLine1() != null) {
       if (rhs.getOptionalAddrLine1() != null) {
         if (!getOptionalAddrLine1().equals(rhs.getOptionalAddrLine1())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalAddrLine1() != null) {
         return (false);
       }
     }
     if (getOptionalAddrLine2() != null) {
       if (rhs.getOptionalAddrLine2() != null) {
         if (!getOptionalAddrLine2().equals(rhs.getOptionalAddrLine2())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalAddrLine2() != null) {
         return (false);
       }
     }
     if (getOptionalCity() != null) {
       if (rhs.getOptionalCity() != null) {
         if (!getOptionalCity().equals(rhs.getOptionalCity())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCity() != null) {
         return (false);
       }
     }
     if (getOptionalState() != null) {
       if (rhs.getOptionalState() != null) {
         if (!getOptionalState().equals(rhs.getOptionalState())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalState() != null) {
         return (false);
       }
     }
     if (getOptionalCountryId() != null) {
       if (rhs.getOptionalCountryId() != null) {
         if (!getOptionalCountryId().equals(rhs.getOptionalCountryId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCountryId() != null) {
         return (false);
       }
     }
     if (getOptionalZip() != null) {
       if (rhs.getOptionalZip() != null) {
         if (!getOptionalZip().equals(rhs.getOptionalZip())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalZip() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFCrmAddressByTenantIdxKey) {
     CFCrmAddressByTenantIdxKey rhs = (CFCrmAddressByTenantIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFCrmAddressByContactIdxKey) {
     CFCrmAddressByContactIdxKey rhs = (CFCrmAddressByContactIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredContactId() != rhs.getRequiredContactId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFCrmAddressByUDescrIdxKey) {
     CFCrmAddressByUDescrIdxKey rhs = (CFCrmAddressByUDescrIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredContactId() != rhs.getRequiredContactId()) {
       return (false);
     }
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFCrmAddressByCountryIdxKey) {
     CFCrmAddressByCountryIdxKey rhs = (CFCrmAddressByCountryIdxKey) obj;
     if (getOptionalCountryId() != null) {
       if (rhs.getOptionalCountryId() != null) {
         if (!getOptionalCountryId().equals(rhs.getOptionalCountryId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCountryId() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFCrmAddressHPKey) {
     CFCrmAddressHPKey rhs = (CFCrmAddressHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredAddressId() != rhs.getRequiredAddressId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFCrmHPKey) {
     CFCrmHPKey rhs = (CFCrmHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFCrmAddressPKey) {
     CFCrmAddressPKey rhs = (CFCrmAddressPKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredAddressId() != rhs.getRequiredAddressId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }
  /**
   * Processes lock request.
   *
   * @param nodeId Sender node ID.
   * @param msg Lock request.
   */
  @SuppressWarnings({"unchecked", "ThrowableInstanceNeverThrown"})
  private void processLockRequest(UUID nodeId, GridDistributedLockRequest<K, V> msg) {
    assert !nodeId.equals(locNodeId);

    List<byte[]> keys = msg.keyBytes();

    int cnt = keys.size();

    GridReplicatedTxRemote<K, V> tx = null;

    GridDistributedLockResponse res;

    ClassLoader ldr = null;

    try {
      ldr = ctx.deploy().globalLoader();

      if (ldr != null) {
        res = new GridDistributedLockResponse(msg.version(), msg.futureId(), cnt);

        for (int i = 0; i < keys.size(); i++) {
          byte[] bytes = keys.get(i);
          K key = msg.keys().get(i);

          Collection<GridCacheMvccCandidate<K>> cands = msg.candidatesByIndex(i);

          if (bytes == null) continue;

          if (log.isDebugEnabled()) log.debug("Unmarshalled key: " + key);

          GridDistributedCacheEntry<K, V> entry = null;

          while (true) {
            try {
              entry = entryexx(key);

              // Handle implicit locks for pessimistic transactions.
              if (msg.inTx()) {
                tx = ctx.tm().tx(msg.version());

                if (tx != null) {
                  if (msg.txRead()) tx.addRead(key, bytes);
                  else tx.addWrite(key, bytes);
                } else {
                  tx =
                      new GridReplicatedTxRemote<K, V>(
                          nodeId,
                          msg.threadId(),
                          msg.version(),
                          null,
                          PESSIMISTIC,
                          msg.isolation(),
                          msg.isInvalidate(),
                          msg.timeout(),
                          key,
                          bytes,
                          msg.txRead(),
                          ctx);

                  tx = ctx.tm().onCreated(tx);

                  if (tx == null || !ctx.tm().onStarted(tx))
                    throw new GridCacheTxRollbackException(
                        "Failed to acquire lock "
                            + "(transaction has been completed): "
                            + msg.version());
                }
              }

              // Add remote candidate before reordering.
              entry.addRemote(
                  msg.nodeId(),
                  null,
                  msg.threadId(),
                  msg.version(),
                  msg.timeout(),
                  tx != null && tx.ec(),
                  tx != null,
                  tx != null && tx.implicitSingle());

              // Remote candidates for ordered lock queuing.
              entry.addRemoteCandidates(
                  cands, msg.version(), msg.committedVersions(), msg.rolledbackVersions());

              // Double-check in case if sender node left the grid.
              if (ctx.discovery().node(msg.nodeId()) == null) {
                if (log.isDebugEnabled())
                  log.debug(
                      "Node requesting lock left grid (lock request will be ignored): " + msg);

                if (tx != null) tx.rollback();

                return;
              }

              res.setCandidates(
                  i,
                  entry.localCandidates(),
                  ctx.tm().committedVersions(msg.version()),
                  ctx.tm().rolledbackVersions(msg.version()));

              res.addValueBytes(
                  entry.rawGet(), msg.returnValue(i) ? entry.valueBytes(null) : null, ctx);

              // Entry is legit.
              break;
            } catch (GridCacheEntryRemovedException ignored) {
              assert entry.obsoleteVersion() != null
                  : "Obsolete flag not set on removed entry: " + entry;

              if (log.isDebugEnabled())
                log.debug(
                    "Received entry removed exception (will retry on renewed entry): " + entry);

              if (tx != null) {
                tx.clearEntry(entry.key());

                if (log.isDebugEnabled())
                  log.debug(
                      "Cleared removed entry from remote transaction (will retry) [entry="
                          + entry
                          + ", tx="
                          + tx
                          + ']');
              }
            }
          }
        }
      } else {
        String err = "Failed to acquire deployment class for message: " + msg;

        U.warn(log, err);

        res =
            new GridDistributedLockResponse(msg.version(), msg.futureId(), new GridException(err));
      }
    } catch (GridCacheTxRollbackException e) {
      if (log.isDebugEnabled())
        log.debug("Received lock request for completed transaction (will ignore): " + e);

      res = new GridDistributedLockResponse(msg.version(), msg.futureId(), e);
    } catch (GridException e) {
      String err = "Failed to unmarshal at least one of the keys for lock request message: " + msg;

      log.error(err, e);

      res =
          new GridDistributedLockResponse(msg.version(), msg.futureId(), new GridException(err, e));

      if (tx != null) tx.rollback();
    } catch (GridDistributedLockCancelledException ignored) {
      // Received lock request for cancelled lock.
      if (log.isDebugEnabled())
        log.debug("Received lock request for canceled lock (will ignore): " + msg);

      if (tx != null) tx.rollback();

      // Don't send response back.
      return;
    }

    GridNode node = ctx.discovery().node(msg.nodeId());

    boolean releaseAll = false;

    if (node != null) {
      try {
        // Reply back to sender.
        ctx.io().send(node, res);
      } catch (GridException e) {
        U.error(log, "Failed to send message to node (did the node leave grid?): " + node.id(), e);

        releaseAll = ldr != null;
      }
    }
    // If sender left grid, release all locks acquired so far.
    else releaseAll = ldr != null;

    // Release all locks because sender node left grid.
    if (releaseAll) {
      for (K key : msg.keys()) {
        while (true) {
          GridDistributedCacheEntry<K, V> entry = peekexx(key);

          try {
            if (entry != null) entry.removeExplicitNodeLocks(msg.nodeId());

            break;
          } catch (GridCacheEntryRemovedException ignore) {
            if (log.isDebugEnabled())
              log.debug(
                  "Attempted to remove lock on removed entity during failure "
                      + "of replicated lock request handling (will retry): "
                      + entry);
          }
        }
      }

      U.warn(
          log, "Sender node left grid in the midst of lock acquisition (locks will be released).");
    }
  }
  /**
   * @param updateSeq Update sequence.
   * @return Checks if any of the local partitions need to be evicted.
   */
  private boolean checkEvictions(long updateSeq) {
    assert lock.isWriteLockedByCurrentThread();

    boolean changed = false;

    UUID locId = cctx.nodeId();

    for (GridDhtLocalPartition part : locParts.values()) {
      GridDhtPartitionState state = part.state();

      if (state.active()) {
        int p = part.id();

        List<ClusterNode> affNodes = cctx.affinity().nodes(p, topVer);

        if (!affNodes.contains(cctx.localNode())) {
          Collection<UUID> nodeIds = F.nodeIds(nodes(p, topVer, OWNING));

          // If all affinity nodes are owners, then evict partition from local node.
          if (nodeIds.containsAll(F.nodeIds(affNodes))) {
            part.rent(false);

            updateLocal(part.id(), locId, part.state(), updateSeq);

            changed = true;

            if (log.isDebugEnabled())
              log.debug("Evicted local partition (all affinity nodes are owners): " + part);
          } else {
            int ownerCnt = nodeIds.size();
            int affCnt = affNodes.size();

            if (ownerCnt > affCnt) {
              List<ClusterNode> sorted = new ArrayList<>(cctx.discovery().nodes(nodeIds));

              // Sort by node orders in ascending order.
              Collections.sort(sorted, CU.nodeComparator(true));

              int diff = sorted.size() - affCnt;

              for (int i = 0; i < diff; i++) {
                ClusterNode n = sorted.get(i);

                if (locId.equals(n.id())) {
                  part.rent(false);

                  updateLocal(part.id(), locId, part.state(), updateSeq);

                  changed = true;

                  if (log.isDebugEnabled())
                    log.debug(
                        "Evicted local partition (this node is oldest non-affinity node): " + part);

                  break;
                }
              }
            }
          }
        }
      }
    }

    return changed;
  }
 /**
  * Checks if this candidate matches version or thread-nodeId combination.
  *
  * @param nodeId Node ID to check.
  * @param ver Version to check.
  * @param threadId Thread ID to check.
  * @return {@code True} if matched.
  */
 public boolean matches(GridCacheVersion ver, UUID nodeId, long threadId) {
   return ver.equals(this.ver) || (nodeId.equals(this.nodeId) && threadId == this.threadId);
 }
예제 #18
0
 /** {@inheritDoc} */
 @Override
 public boolean isTaskNode() {
   return taskNodeId.equals(ctx.discovery().localNode().id());
 }
  /**
   * Updates value for single partition.
   *
   * @param p Partition.
   * @param nodeId Node ID.
   * @param state State.
   * @param updateSeq Update sequence.
   */
  @SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
  private void updateLocal(int p, UUID nodeId, GridDhtPartitionState state, long updateSeq) {
    assert lock.isWriteLockedByCurrentThread();
    assert nodeId.equals(cctx.nodeId());

    // In case if node joins, get topology at the time of joining node.
    ClusterNode oldest = CU.oldestAliveCacheServerNode(cctx.shared(), topVer);

    assert oldest != null;

    // If this node became the oldest node.
    if (oldest.id().equals(cctx.nodeId())) {
      long seq = node2part.updateSequence();

      if (seq != updateSeq) {
        if (seq > updateSeq) {
          if (this.updateSeq.get() < seq) {
            // Update global counter if necessary.
            boolean b = this.updateSeq.compareAndSet(this.updateSeq.get(), seq + 1);

            assert b
                : "Invalid update sequence [updateSeq="
                    + updateSeq
                    + ", seq="
                    + seq
                    + ", curUpdateSeq="
                    + this.updateSeq.get()
                    + ", node2part="
                    + node2part.toFullString()
                    + ']';

            updateSeq = seq + 1;
          } else updateSeq = seq;
        }

        node2part.updateSequence(updateSeq);
      }
    }

    GridDhtPartitionMap map = node2part.get(nodeId);

    if (map == null)
      node2part.put(
          nodeId,
          map =
              new GridDhtPartitionMap(
                  nodeId,
                  updateSeq,
                  Collections.<Integer, GridDhtPartitionState>emptyMap(),
                  false));

    map.updateSequence(updateSeq);

    map.put(p, state);

    Set<UUID> ids = part2node.get(p);

    if (ids == null) part2node.put(p, ids = U.newHashSet(3));

    ids.add(nodeId);
  }