JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   On Github   Forums 
June 13, 2021, 03:31:45 AM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: [TOPOLOGY MANAGER DID NOT WROK]  (Read 33 times)

hoho23

  • JPPF Padawan
  • *
  • Posts: 13
[TOPOLOGY MANAGER DID NOT WROK]
« on: May 19, 2021, 03:35:13 PM »

Hello JPPF Community,

I am working on a project that needs to know every node's IP address before executing a specific job. For that, I've used the TopologyManager class then I tried to get the nodes information but it didn't work, I've even tried to get the number of nodes present on the network, but the result is always zero although I have two nodes running on the network.
Here is the code example to get a clear idea about the problem :
Code: [Select]
JPPFClient jppfClient = getConfiguredJPPFClient(null,"");
// Get connected Nodes begin
System.err.println("############ BEGIN NODE DISCOVERY ############");
TopologyManager manager = new TopologyManager(jppfClient);
List<TopologyNode> nodeList = manager.getNodes();
for (TopologyNode node : nodeList) {
System.err.println(node.getManagementInfo().toDisplayString());
}
System.err.println(manager.getNodeCount());
manager.close();
System.err.println("############ END NODE DISCOVERY ############");
// Get connected Nodes end
P.S: the method getConfiguredJPPFClient(null,"") returns a JPPFClient object, and this jppfClient is used to create the TopologyManager.
Actually I try to get informations, precisely ip address, of every node present on the network containing this jppfClient.
Below the result of the execution although I have two connected nodes.
Code: [Select]
############ BEGIN NODE DISCOVERY ############
0
############ END NODE DISCOVERY ############
« Last Edit: May 19, 2021, 03:37:11 PM by hoho23 »
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2269
    • JPPF Web site
Re: [TOPOLOGY MANAGER DID NOT WROK]
« Reply #1 on: May 21, 2021, 08:56:48 AM »

Hello,

I believe that your code is not waiting long enough for the TopologyManager to collect the information about the topology.
As an experiment, could you insert a Thread.sleep(5000L); statement just before manager.getNodes()?
I'm hoping that it will show more than 0 node this way, because it will give the JPPFClient enough time to connect and the TopologyManager enough time to fetch the information.

You may also consider using asynchronous notifications of changes in the topology.

Sincerely,
-Laurent
« Last Edit: May 21, 2021, 09:03:17 AM by lolo »
Logged

hoho23

  • JPPF Padawan
  • *
  • Posts: 13
Re: [TOPOLOGY MANAGER DID NOT WROK]
« Reply #2 on: May 21, 2021, 05:31:22 PM »

Thank you, it works now,
 just a clarification, the code below did not put the execution runtime on sleep mode
Code: [Select]
Thread.sleep(5000L);Instead, I've used this code for the delay of 5 seconds
Code: [Select]
TimeUnit.SECONDS.sleep(5);
Logged
Pages: [1]   Go Up
 
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads