public boolean isEIPBound ( ) { InstanceInfo myInfo = applicationInfoManager . getInfo ( ) ; String myInstanceId = ( ( AmazonInfo ) myInfo . getDataCenterInfo ( ) ) . get ( MetaDataKey . instanceId ) ; String myZone = ( ( AmazonInfo ) myInfo . getDataCenterInfo ( ) ) . get ( MetaDataKey . availabilityZone ) ; String myPublicIP = ( ( AmazonInfo ) myInfo . getDataCenterInfo ( ) ) . get ( MetaDataKey . publicIpv4 ) ; Collection < String > candidateEIPs = getCandidateEIPs ( myInstanceId , myZone ) ; for ( String eipEntry : candidateEIPs ) { if ( eipEntry . equals ( myPublicIP ) ) { logger . info ( "My instance {} seems to be already associated with the public ip {}" , myInstanceId , myPublicIP ) ; return true ; } } return false ; }
Checks if an EIP is already bound to the instance .