Skip to content

Commit

Permalink
Merge branch 'release/4' into jlocke/merge_4.1_20190827
Browse files Browse the repository at this point in the history
Merged release/4 (Corda OS version 4.1) into a branch created from master (Corda OS version 4.3)

Conflicts:
	build.gradle
	client/rpc/src/main/kotlin/net/corda/client/rpc/internal/ReconnectingCordaRPCOps.kt
	common/logging/build.gradle
	common/logging/src/main/kotlin/net/corda/common/logging/CordaVersion.kt
	constants.properties
	core-tests/src/test/kotlin/net/corda/coretests/utilities/ProgressTrackerTest.kt
	core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt
	docs/source/api-contract-constraints.rst
	docs/source/api-stability-guarantees.rst
	docs/source/app-upgrade-notes.rst
	docs/source/changelog.rst
	docs/source/clientrpc.rst
	docs/source/conf.py
	docs/source/corda-network/UAT.md
	docs/source/getting-set-up.rst
	docs/source/network-builder.rst
	docs/source/upgrading-cordapps.rst
	docs/source/versioning.rst
	node/src/integration-test/kotlin/net/corda/node/services/rpc/RpcReconnectTests.kt
	serialization/src/main/kotlin/net/corda/serialization/internal/amqp/PropertyDescriptor.kt
	serialization/src/main/kotlin/net/corda/serialization/internal/model/LocalTypeInformationBuilder.kt
	tools/network-builder/src/main/resources/node-Dockerfile
	tools/network-builder/src/main/resources/notary-Dockerfile
  • Loading branch information
lockathan committed Aug 27, 2019
2 parents fc5cd62 + 33bd3b2 commit e5f314f
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import net.corda.core.messaging.ClientRpcSslOptions
import net.corda.core.messaging.CordaRPCOps
import net.corda.core.messaging.DataFeed
import net.corda.core.messaging.FlowHandle
import net.corda.core.utilities.NetworkHostAndPort
import net.corda.core.utilities.contextLogger
import net.corda.core.utilities.debug
import net.corda.core.utilities.seconds
import net.corda.core.utilities.*
import net.corda.nodeapi.exceptions.RejectedCommandException
import org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException
import org.apache.activemq.artemis.api.core.ActiveMQSecurityException
import org.apache.activemq.artemis.api.core.ActiveMQUnBlockedException
import rx.Observable
import java.lang.reflect.InvocationHandler
import java.lang.reflect.InvocationTargetException
import java.lang.reflect.Method
Expand Down Expand Up @@ -49,7 +47,6 @@ class ReconnectingCordaRPCOps private constructor(
private val observersPool: ExecutorService,
private val userPool: Boolean
) : AutoCloseable, InternalCordaRPCOps by proxy(reconnectingRPCConnection, observersPool) {

// Constructors that mirror CordaRPCClient.
constructor(
nodeHostAndPort: NetworkHostAndPort,
Expand All @@ -62,7 +59,6 @@ class ReconnectingCordaRPCOps private constructor(
ReconnectingRPCConnection(listOf(nodeHostAndPort), username, password, sslConfiguration, classLoader),
observersPool ?: Executors.newCachedThreadPool(),
observersPool != null)

constructor(
nodeHostAndPorts: List<NetworkHostAndPort>,
username: String,
Expand All @@ -74,12 +70,10 @@ class ReconnectingCordaRPCOps private constructor(
ReconnectingRPCConnection(nodeHostAndPorts, username, password, sslConfiguration, classLoader),
observersPool ?: Executors.newCachedThreadPool(),
observersPool != null)

private companion object {
// See https://r3-cev.atlassian.net/browse/CORDA-2890.
// TODO Once the bug is fixed, this retry logic should be removed.
const val MAX_RETRY_ATTEMPTS_ON_AUTH_ERROR = 3

private val log = contextLogger()
private fun proxy(reconnectingRPCConnection: ReconnectingRPCConnection, observersPool: ExecutorService): InternalCordaRPCOps {
return Proxy.newProxyInstance(
Expand All @@ -88,9 +82,7 @@ class ReconnectingCordaRPCOps private constructor(
ErrorInterceptingHandler(reconnectingRPCConnection, observersPool)) as InternalCordaRPCOps
}
}

private val retryFlowsPool = Executors.newScheduledThreadPool(1)

/**
* This function runs a flow and retries until it completes successfully.
*
Expand Down Expand Up @@ -120,7 +112,6 @@ class ReconnectingCordaRPCOps private constructor(
)
}
}

/**
* Helper class useful for reconnecting to a Node.
*/
Expand All @@ -132,25 +123,20 @@ class ReconnectingCordaRPCOps private constructor(
val classLoader: ClassLoader?
) : RPCConnection<CordaRPCOps> {
private var currentRPCConnection: CordaRPCConnection? = null

enum class CurrentState {
UNCONNECTED, CONNECTED, CONNECTING, CLOSED, DIED
}

private var currentState = CurrentState.UNCONNECTED

init {
current
}

private val current: CordaRPCConnection
@Synchronized get() = when (currentState) {
CurrentState.UNCONNECTED -> connect()
CurrentState.CONNECTED -> currentRPCConnection!!
CurrentState.CLOSED -> throw IllegalArgumentException("The ReconnectingRPCConnection has been closed.")
CurrentState.CONNECTING, CurrentState.DIED -> throw IllegalArgumentException("Illegal state: $currentState ")
}

/**
* Called on external error.
* Will block until the connection is established again.
Expand All @@ -163,15 +149,13 @@ class ReconnectingCordaRPCOps private constructor(
log.debug("", e)
connect()
}

@Synchronized
private fun connect(): CordaRPCConnection {
currentState = CurrentState.CONNECTING
currentRPCConnection = establishConnectionWithRetry()
currentState = CurrentState.CONNECTED
return currentRPCConnection!!
}

private tailrec fun establishConnectionWithRetry(retryInterval: Duration = 1.seconds, currentAuthenticationRetries: Int = 0): CordaRPCConnection {
var _currentAuthenticationRetries = currentAuthenticationRetries
log.info("Connecting to: $nodeHostAndPorts")
Expand Down Expand Up @@ -212,41 +196,33 @@ class ReconnectingCordaRPCOps private constructor(
}
}
}

// Could not connect this time round - pause before giving another try.
Thread.sleep(retryInterval.toMillis())
// TODO - make the exponential retry factor configurable.
return establishConnectionWithRetry((retryInterval * 10) / 9, _currentAuthenticationRetries)
}

override val proxy: CordaRPCOps
get() = current.proxy

override val serverProtocolVersion
get() = current.serverProtocolVersion

@Synchronized
override fun notifyServerAndClose() {
currentState = CurrentState.CLOSED
currentRPCConnection?.notifyServerAndClose()
}

@Synchronized
override fun forceClose() {
currentState = CurrentState.CLOSED
currentRPCConnection?.forceClose()
}

@Synchronized
override fun close() {
currentState = CurrentState.CLOSED
currentRPCConnection?.close()
}
}

private class ErrorInterceptingHandler(val reconnectingRPCConnection: ReconnectingRPCConnection, val observersPool: ExecutorService) : InvocationHandler {
private fun Method.isStartFlow() = name.startsWith("startFlow") || name.startsWith("startTrackedFlow")

override fun invoke(proxy: Any, method: Method, args: Array<out Any>?): Any? {
val result: Any? = try {
log.debug { "Invoking RPC $method..." }
Expand All @@ -260,7 +236,6 @@ class ReconnectingCordaRPCOps private constructor(
} else {
this.invoke(proxy, method, args)
}

when (e.targetException) {
is RejectedCommandException -> {
log.error("Node is being shutdown. Operation ${method.name} rejected. Retrying when node is up...", e)
Expand All @@ -285,7 +260,6 @@ class ReconnectingCordaRPCOps private constructor(
}
}
}

return when (method.returnType) {
DataFeed::class.java -> {
// Intercept the data feed methods and returned a ReconnectingObservable instance
Expand All @@ -301,7 +275,6 @@ class ReconnectingCordaRPCOps private constructor(
}
}
}

override fun close() {
if (!userPool) observersPool.shutdown()
retryFlowsPool.shutdown()
Expand Down
1 change: 1 addition & 0 deletions docs/source/_static/versions
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"https://docs.corda.net/releases/release-V3.2": "V3.2",
"https://docs.corda.net/releases/release-V3.3": "V3.3",
"https://docs.corda.net/releases/release-V4.0": "V4.0",
"https://docs.corda.net/releases/release-V4.1": "V4.1",
"https://docs.corda.net/head/": "Master"
}
5 changes: 5 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ Version 4.2
* :doc:`design/data-model-upgrades/package-namespace-ownership` configurations can be now be set as described in
:ref:`node_package_namespace_ownership`, when using the Cordformation plugin version 4.0.43.

Unreleased
----------

* Fix a bug in Corda 4.0 that combined commands in ``TransactionBuilder`` if they only differed by the signers list. The behaviour is now consistent with prior Corda releases.

* Disabled the default loading of ``hibernate-validator`` as a plugin by hibernate when a CorDapp depends on it. This change will in turn fix the
(https://github.com/corda/corda/issues/4444) issue, because nodes will no longer need to add ``hibernate-validator`` to the ``\libs`` folder.
For nodes that already did that, it can be safely removed when the latest Corda is installed.
Expand Down
10 changes: 10 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ def setup(app):
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
<<<<<<< HEAD
=======

html_theme_options = {
'includehidden':True,
'collapse_navigation':False,
'sticky_navigation':True,
'titles_only':True
}
>>>>>>> release/4

html_theme_options = {
'includehidden':True,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/corda-network/UAT.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Corda Network UAT is governed by an [independent Foundation](https://corda.netwo
Steps to join UAT environment
-----------------------------

Steps to join are outlined on this website: https://corda.network/participation/index.html
Steps to join are outlined on the [Corda Network UAT microsite](http://uat.network.r3.com/pages/joining/joining.html)

For further questions on this process, please contact us - preferably on the mailing list: https://groups.io/g/corda-network
2 changes: 1 addition & 1 deletion docs/source/generating-a-node.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A node can be created manually by creating a folder that contains the following

* **Optional:** A webserver JAR entitled ``corda-webserver.jar`` that will connect to the node via RPC

* The (deprecated) default webserver can be downloaded from http://r3.bintray.com/corda/net/corda/corda-webserver/ (under /|corda_version|/corda-webserver-|corda_version|.jar)
* The (deprecated) default webserver can be downloaded from http://r3.bintray.com/corda/net/corda/corda-webserver/ (under /|corda_version|/corda-|corda_version|.jar)
* A Spring Boot alternative can be found here: https://github.com/corda/spring-webserver

The remaining files and folders described in :doc:`node-structure` will be generated at runtime.
Expand Down
10 changes: 10 additions & 0 deletions docs/source/getting-set-up.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ The set-up instructions are available for the following platforms:

.. _windows-label:

.. note:: These setup instructions will guide you on how to install the Oracle JDK. Each JDK can be found on their respective sites:

* `Oracle <http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html>`_

* `Amazon Corretto <https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html>`_

* `Red Hat OpenJDK <https://developers.redhat.com/products/openjdk/download/>`_

* `Zulu OpenJDK <https://www.azul.com/downloads/zulu/>`_

Windows
-------

Expand Down
20 changes: 5 additions & 15 deletions docs/source/network-bootstrapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ The Corda Network Bootstrapper can be downloaded from `here <https://software.r3
Create a directory containing a node config file, ending in "_node.conf", for each node you want to create. "devMode" must be set to true. Then run the
following command:

.. sourcecode:: bash

java -jar corda-tools-network-bootstrapper-|corda_version|.jar --dir <nodes-root-dir>
``java -jar network-bootstrapper-|corda_version|.jar --dir <nodes-root-dir>``

For example running the command on a directory containing these files:

Expand Down Expand Up @@ -155,9 +153,7 @@ can use the Network Bootstrapper on the following network structure:

Then run the Network Bootstrapper again from the root dir:

.. sourcecode:: bash

java -jar corda-tools-network-bootstrapper-|corda_version|.jar --dir <nodes-root-dir>
``java -jar network-bootstrapper-|corda_version|.jar --dir <nodes-root-dir>``

Which will give the following:

Expand Down Expand Up @@ -228,9 +224,7 @@ For example, with the following pre-generated network:

Then run the Network Bootstrapper again from the root dir:

.. sourcecode:: bash

java -jar corda-tools-network-bootstrapper-|corda_version|.jar --dir <nodes-root-dir>
``java -jar network-bootstrapper-|corda_version|.jar --dir <nodes-root-dir>``

To give the following:

Expand Down Expand Up @@ -277,15 +271,11 @@ Overriding network parameters via a file

You can provide a network parameters overrides file using the following syntax:

.. sourcecode:: bash

java -jar corda-tools-network-bootstrapper-|corda_version|.jar --network-parameter-overrides=<path_to_file>
``java -jar network-bootstrapper-|corda_version|.jar --network-parameter-overrides=<path_to_file>``

Or alternatively, by using the short form version:

.. sourcecode:: bash

java -jar corda-tools-network-bootstrapper-|corda_version|.jar -n=<path_to_file>
``java -jar network-bootstrapper-|corda_version|.jar -n=<path_to_file>``

The network parameter overrides file is a HOCON file with the following fields, all of which are optional. Any field that is not provided will be
ignored. If a field is not provided and you are bootstrapping a new network, a sensible default value will be used. If a field is not provided and you
Expand Down
2 changes: 1 addition & 1 deletion docs/source/network-builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ containers to abstract the complexity of managing a distributed network away fro

The network you build will either be made up of local ``Docker`` nodes *or* of nodes spread across Azure
containers.
For each node a separate Docker image is built based on `corda/corda-zulu-4.0 <https://hub.docker.com/r/corda/corda-zulu-4.0>`_.
For each node a separate Docker image is built based on `corda/corda-zulu-|corda_version| <https://hub.docker.com/r/corda/corda-zulu-|corda_version|>`_.
Unlike the official image, a `node.conf` file and CorDapps are embedded into the image
(they are not externally provided to the running container via volumes/mount points).
More backends may be added in future. The tool is open source, so contributions to add more
Expand Down
Loading

0 comments on commit e5f314f

Please sign in to comment.