Link to home
Start Free TrialLog in
Avatar of yankeebushsoftware
yankeebushsoftwareFlag for United States of America

asked on

What does this code snippet do in Java?

What does this code do? Can someone put some comments in it so I can understand it

      public String getNodeAttribute(long nodeId, String attributeName) throws ManagementSupportException {

            TEServiceStub.GetNodeAttribute request = new TEServiceStub.GetNodeAttribute();
            request.setAttributeName(attributeName);
            request.setNodeID(nodeId);

            TEServiceStub.GetNodeAttributeResponse response = null;
            try {
                  response = stub.getNodeAttribute(request);
            } catch (RemoteException e) {
                  logger.warn("Fail to call TEService :" + e);
                  throw new ManagementSupportException("Fail to call TEService :" + e);
            }

            if(!response.getStatus().getSuccess()) {
                  logger.warn("TEService return failure while call getNodeAttribute()");
                  throw new ManagementSupportException("TEService return failure while call getNodeAttribute()");
            }
            return response.getAttributeValue();
      }
Avatar of Mayank S
Mayank S
Flag of India image

Looks like a code to call a web-service or something of that sort using a proxy. Difficult to tell without knowing what TEServiceStub and GetNodeAttribute are.
ASKER CERTIFIED SOLUTION
Avatar of arioh
arioh
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think this should have been a split - I was the first one to say it calls a web service method.