public class MyConnectionStrategy extends Object implements DriverConnectionStrategy
DriverConnectionStrategyreads a list of drivers from a CSV file where each line has the following format:
secure, host, port, recovery_port
Additionally, any line starting with a '#' (after trimming) will be considered as a comment and ignored.
The file location is read from the configuration property 'jppf.node.connection.strategy.file'.
It will first be looked up in the file system, then in the classpath if it is not found in the file system.
If no file is found at all, the node will fall back to the
JPPF default strategy and use the configuration to find the driver connection information.
The listed drivers will be used as if they were arrayed in a "circle",
with the driver selection mechanism rotating one tick each time
nextConnectionInfo() is invoked.
|Constructor and Description|
Initialize the set of drivers to connect to.
|Modifier and Type||Method and Description|
Get a new connection information, eventually based on the one that was previously used.
public DriverConnectionInfo nextConnectionInfo(DriverConnectionInfo currentInfo, ConnectionContext context)
DriverConnectionInfothat was previously used to connecto the driver, or
nullif the node is connecting for the first time.
context- provides information on why a new connection is requested, so as to help deciding which connection information to provide.
DriverConnectionInfoobject that the node will use to connect to the driver.
Copyright © 2005-2015 JPPF Team.