While I am trying to diagnose another problem with my cluster, I tried to isolate my environments to force choices. When starting nodes in isolation, although my application was unable to start with this exception:
Caused by: java.util.concurrent.TimeoutException: null
at org.neo4j.cluster.statemachine.StateMachineProxyFactory$ResponseFuture.get(StateMachineProxyFactory.java:300) ~[neo4j-cluster-2.0.1.jar:2.0.1]
at org.neo4j.cluster.client.ClusterJoin.joinByConfig(ClusterJoin.java:158) ~[neo4j-cluster-2.0.1.jar:2.0.1]
at org.neo4j.cluster.client.ClusterJoin.start(ClusterJoin.java:91) ~[neo4j-cluster-2.0.1.jar:2.0.1]
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:503) ~[neo4j-kernel-2.0.1.jar:2.0.1]
... 59 common frames omitted
My configuration is configured with a 60 second connection timeout ( ha.cluster_join_timeout) and so individual nodes can initialize the cluster ( ha.allow_init_cluster).
Looking at the truncated piece of code from the class ClusterJoin, I believe that after some negative cases, the code will try to connect again or again, or that the current node will create a new cluster.
private void joinByConfig() throws TimeoutException
{
while( true )
{
if (config.getClusterJoinTimeout() > 0)
{
try
{
console.log( "Joined cluster:" + clusterConfig.get(config.getClusterJoinTimeout(), TimeUnit.MILLISECONDS ));
return;
}
catch ( InterruptedException e )
{
console.log( "Could not join cluster, interrupted. Retrying..." );
}
catch ( ExecutionException e )
{
logger.debug( "Could not join cluster " + this.config.getClusterName() );
if ( e.getCause() instanceof IllegalStateException )
{
throw ((IllegalStateException) e.getCause());
}
if ( config.isAllowedToCreateCluster() )
{
console.log( "Could not join cluster of " + hosts.toString() );
console.log( format( "Creating new cluster with name [%s]...", config.getClusterName() ) );
cluster.create( config.getClusterName() );
break;
}
console.log( "Could not join cluster, timed out. Retrying..." );
}
}
a TimeoutException , joinByConfig TimeoutException. StateMachineProxyFactory$ResponseFuture ( Future) a TimooutException, , Machine Machine.
public synchronized Object get( long timeout, TimeUnit unit )
throws InterruptedException, ExecutionException, TimeoutException
{
if ( response != null )
{
getResult();
}
this.wait( unit.toMillis( timeout ) );
if ( response == null )
{
throw new TimeoutException();
}
return getResult();
}
, - , TimoutException ? , ?