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

The open source
grid computing

 Home   About   Features   Download   Documentation   On Github   Forums 
June 04, 2023, 06:39:29 PM *
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: Client Rolling Queue of Drivers  (Read 1519 times)


  • JPPF Padawan
  • *
  • Posts: 7
Client Rolling Queue of Drivers
« on: February 27, 2013, 10:48:58 PM »

Hello all -

I was wondering if anyone out there has done something like this before.

My Program:
I have setup two drivers where one is the primary one and the other is the secondary. They each have a single dedicated node and also share a group of nodes which switch back and forth based on the Discovery Hook example in the sample pack (which works beautifully). So whichever driver is the active driver will be connected to its single dedicated node and the group of fluctuating nodes. Initially my primary driver is the active driver.

Currently I have my client setup to attempt to connect to both my primary and secondary drivers but due to a priority level it will choose to send jobs to my primary driver first. In the event my primary driver is out of commission my client sends jobs to my secondary driver. Unfortunately at this point my client doesn't keep trying to connect to the primary driver. But if I set the reconnect time to -1 (for infinite) the program would hang trying to reestablish the connection to the primary driver instead of checking the connection periodically and using my secondary driver to submit subsequent jobs in the meantime. Now in the unfortunate event my secondary driver goes down my client just hangs. I would expect it to fail and throw an exception but either way the process does not wait for an available driver.

My Solution:
What I would like to happen is to have a similar queue system setup on the nodes (from the above mentioned Initialization Hook example) to be setup on the client. Meaning I have one connection to a driver and when it fails I try the next driver in the queue. Then I can put the failed driver at the end of the queue and we continue on. If the new driver fails we follow the same process and use the next driver in the queue. And if we have my setup with only two drivers it basically toggles the drivers back and forth when one of them fails.

I know we can attach listeners to JPPF clients when connections are made and fail but I didn't see we could create them programmatically. Here is an outline of what I was thinking:
Code: [Select]

        this.jppfClient = new JPPFClient();
        this.jppfClient.addClientListener(new ClientListener() {
            public void newConnection(final ClientEvent event) {}

            public void connectionFailed(final ClientEvent event) {
                // Get new driver information from Queue

               // Create/Retrieve JPPF connection with driver information

               // Add the new JPPF connection to the client

I'm not sure how that would work with the JPPF connections because I am guessing that the failed connections are still held within the JPPF client so can we somehow reuse the failed connections to try connecting again?

Or does anyone have a much better idea of how to toggle between driver connections on the client side? Is there some other mechanism that can do this?

- Zak
Pages: [1]   Go Up
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at Fast, secure and Free Open Source software downloads