Distributed notary: manually initialize the serializer for copycat server & client. This fixes the issue where one of the nodes is unable to connect to the cluster.

This commit is contained in:
Andrius Dagys 2016-12-19 15:34:35 +00:00
parent 1bcabc8d41
commit 2e29673392

View File

@ -1,6 +1,7 @@
package net.corda.node.services.transactions package net.corda.node.services.transactions
import com.google.common.net.HostAndPort import com.google.common.net.HostAndPort
import io.atomix.catalyst.serializer.Serializer
import io.atomix.catalyst.transport.Address import io.atomix.catalyst.transport.Address
import io.atomix.catalyst.transport.Transport import io.atomix.catalyst.transport.Transport
import io.atomix.catalyst.transport.netty.NettyTransport import io.atomix.catalyst.transport.netty.NettyTransport
@ -62,11 +63,13 @@ class RaftUniquenessProvider(storagePath: Path, myAddress: HostAndPort, clusterA
val address = Address(myAddress.hostText, myAddress.port) val address = Address(myAddress.hostText, myAddress.port)
val storage = buildStorage(storagePath) val storage = buildStorage(storagePath)
val transport = buildTransport(config) val transport = buildTransport(config)
val serializer = Serializer()
val server = CopycatServer.builder(address) val server = CopycatServer.builder(address)
.withStateMachine(stateMachineFactory) .withStateMachine(stateMachineFactory)
.withStorage(storage) .withStorage(storage)
.withServerTransport(transport) .withServerTransport(transport)
.withSerializer(serializer)
.build() .build()
val serverFuture = if (clusterAddresses.isNotEmpty()) { val serverFuture = if (clusterAddresses.isNotEmpty()) {
@ -81,6 +84,7 @@ class RaftUniquenessProvider(storagePath: Path, myAddress: HostAndPort, clusterA
val client = CopycatClient.builder(address) val client = CopycatClient.builder(address)
.withTransport(transport) // TODO: use local transport for client-server communications .withTransport(transport) // TODO: use local transport for client-server communications
.withConnectionStrategy(ConnectionStrategies.EXPONENTIAL_BACKOFF) .withConnectionStrategy(ConnectionStrategies.EXPONENTIAL_BACKOFF)
.withSerializer(serializer)
.build() .build()
_clientFuture = serverFuture.thenCompose { client.connect(address) } _clientFuture = serverFuture.thenCompose { client.connect(address) }
} }