stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Akila Ravihansa Perera <raviha...@wso2.com>
Subject Re: Retrieve Member object from the topology for a given member id
Date Wed, 24 Sep 2014 10:29:54 GMT
Any thoughts, please.

On Tue, Sep 23, 2014 at 11:37 PM, Akila Ravihansa Perera
<ravihansa@wso2.com> wrote:
> Hi,
>
> If we need to retrieve a Member object from the topology for a given
> member id, we need to perform a 3 level iteration to look it up. This
> is a limitation of current topology data structure. Following is a
> sample code I had to use for this.
>
>       for (Service service : topology.getServices()) {
>             if (service.getClusters() != null) {
>                 for (Cluster cluster : service.getClusters()) {
>                     if (cluster.getMembers() != null) {
>                         for (Member member : cluster.getMembers()) {
>                             // we are checking faulty status only in
> previously activated members
>                             if (member != null &&
> MemberStatus.Activated.equals(member.getStatus())) {
>                                 // get the member
>                             }
>                         }
>                     }
>                 }
>             }
>         }
>
> Is there a better way to do this? If not, shall we add more efficient
> APIs to retrieve these kind of information?
>
> Thanks.
>
> --
> Akila Ravihansa Perera
> Software Engineer, WSO2
>
> Blog: http://ravihansa3000.blogspot.com



-- 
Akila Ravihansa Perera
Software Engineer, WSO2

Blog: http://ravihansa3000.blogspot.com

Mime
View raw message