Provides means to create connections to scalaris nodes. This class uses a singleton-alike pattern providing a global (static) instance through its {@link #getInstance()} method but also allowing forobject construction which might be useful when using multiple threads each creating its own connections. The location of the default configuration file used by {@link #ConnectionFactory()} can be overridden by specifying the
scalaris.java.config system property - otherwise the class tries to load
scalaris.properties. A specific property can also be overridden specifying a (non-empty) system property with its name. A user-defined {@link Properties} object can also be used by creating objectswith {@link #ConnectionFactory(Properties)} or setting the new values with{@link #setProperties(Properties)} but must provide the following values(default values as shown)
- scalaris.node = "node1@localhost"
- scalaris.cookie = "chocolate chip cookie"
- scalaris.client.name = "java_client"
- scalaris.client.appendUUID = "true"
Note: {@code scalaris.node} can be a whitespace, ',' or ';' separated list ofavailable nodes. See {@link DefaultConnectionPolicy} about how this list isused when connections are setup or when existing connections fail. Since Java and Erlang both need to known the same node name in order to connect, any "@localhost" in such a name is translated using {@link #fixLocalhostName(String)} to a real node name. The best method ofchanging this name is to use the name Erlang uses - it can be provided by setting the
scalaris.erlang.nodename system property. If this is not set or empty, we will try to look-up the name ourselves (see {@link #getLocalhostName()}. The {@link #connectionPolicy} set will be passed on to created connections.Changing it via {@link #setConnectionPolicy(ConnectionPolicy)} will notchange previously created connections - they keep the old policy. By default, {@link DefaultConnectionPolicy} is used.
@author Nico Kruber, kruber@zib.de
@version 3.10
@since 2.0