From 5a4309abf05a0674b43f6ce45a809b8868fe2667 Mon Sep 17 00:00:00 2001 From: Matthew Nesbit Date: Fri, 6 May 2016 10:06:34 +0100 Subject: [PATCH 1/4] Fix node lock to work on windows where automatic file deletion on exit does not work reliably. --- src/main/kotlin/core/node/Node.kt | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/main/kotlin/core/node/Node.kt b/src/main/kotlin/core/node/Node.kt index 35780542a9..4520a182ee 100644 --- a/src/main/kotlin/core/node/Node.kt +++ b/src/main/kotlin/core/node/Node.kt @@ -23,9 +23,7 @@ import org.glassfish.jersey.servlet.ServletContainer import java.io.RandomAccessFile import java.lang.management.ManagementFactory import java.nio.channels.FileLock -import java.nio.file.Files import java.nio.file.Path -import java.nio.file.StandardOpenOption import java.time.Clock import javax.management.ObjectName @@ -155,20 +153,20 @@ class Node(dir: Path, val p2pAddr: HostAndPort, configuration: NodeConfiguration // twice with the same directory: that's a user error and we should bail out. val pidPath = dir.resolve("process-id") val file = pidPath.toFile() - if (file.exists()) { - val f = RandomAccessFile(file, "rw") - val l = f.channel.tryLock() - if (l == null) { - println("It appears there is already a node running with the specified data directory $dir") - println("Shut that other node down and try again. It may have process ID ${file.readText()}") - System.exit(1) - } - nodeFileLock = l + if (!file.exists()) { + file.createNewFile() } + file.deleteOnExit() + val f = RandomAccessFile(file, "rw") + val l = f.channel.tryLock() + if (l == null) { + println("It appears there is already a node running with the specified data directory $dir") + println("Shut that other node down and try again. It may have process ID ${file.readText()}") + System.exit(1) + } + nodeFileLock = l val ourProcessID: String = ManagementFactory.getRuntimeMXBean().name.split("@")[0] - Files.write(pidPath, ourProcessID.toByteArray(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING) - pidPath.toFile().deleteOnExit() - if (nodeFileLock == null) - nodeFileLock = RandomAccessFile(file, "rw").channel.lock() - } + f.setLength(0) + f.write(ourProcessID.toByteArray()) + } } From 61605b18e3ac11361b146abeab1117b1dbd4f1a1 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Tue, 10 May 2016 18:44:41 +0200 Subject: [PATCH 2/4] Add a page that briefly describes the proposed release process. --- docs/source/index.rst | 29 ++++++++++++++--------------- docs/source/release-process.rst | 23 +++++++++++++++++++++++ 2 files changed, 37 insertions(+), 15 deletions(-) create mode 100644 docs/source/release-process.rst diff --git a/docs/source/index.rst b/docs/source/index.rst index a11b6fcd76..bcd71ccab1 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,26 +1,24 @@ -Welcome to the R3 prototyping repository! -========================================= +Welcome to the Corda repository! +================================ -This documentation describes the first prototype of a possible future R3 shared ledger platform. +This documentation describes the prototype of a proposed architecture for distributed ledgers. -The goal of this prototype is to explore fundamentally better designs for transactions, states and smart contract APIs -than what presently exists on the market, tailor made for the needs of the financial industry. We are attempting to -prove or disprove the following hypothesis: +The goal of this prototype is to explore fundamentally better designs for distributed ledgers than what presently exists +on the market, tailor made for the needs of the financial industry. We are attempting to prove or disprove the +following hypothesis: -*The combination of* - -* *An upgraded state transition model* -* *Industry standard, production quality virtual machines and languages* -* *Limited data propagation* -* *Conflict resolution without proof of work or blocks* - -*is sufficiently powerful to justify the creation of a new platform implementation.* +The combination of +* An upgraded state transition model +* Industry standard, production quality virtual machines and languages +* An advanced orchestration framework +* Limited data propagation +* Conflict resolution without proof of work or blocks +is sufficiently powerful to justify the creation of a new platform implementation. Read on to learn: - .. toctree:: :maxdepth: 2 :caption: Overview @@ -45,6 +43,7 @@ Read on to learn: :maxdepth: 2 :caption: Appendix + release-process visualiser codestyle building-the-docs diff --git a/docs/source/release-process.rst b/docs/source/release-process.rst new file mode 100644 index 0000000000..46768f32cf --- /dev/null +++ b/docs/source/release-process.rst @@ -0,0 +1,23 @@ +Release process +=============== + +Corda is under heavy development. The current release process is therefore geared towards rapid iteration. + +Each Corda development release is called a *milestone* and has its own branch in the git repository. Milestones are +temporarily stabilised snapshots of the Corda code which are suitable for developers to experiment with. They may +receive backported bugfixes but once announced a milestone will not have any API or backwards compatibility breaks. + +Between milestones backwards compatibility is expected to break. Every new milestone comes with a short announcement +detailing: + +* What major improvements have been made. +* How to forward port your code to the new milestone. +* What new documentation has become available. +* Important known issues. + +Eventually, Corda will stabilise and release version 1. At that point backwards compatibility will be guaranteed +forever and the software will be considered production ready. Until then, expect it to be a building site and wear your +hard hat. + +Our goal is to cut a new milestone roughly once a month. There are no fixed dates. If need be, a milestone may slip by +a few days to ensure the code is sufficiently usable. \ No newline at end of file From 32c2ee7966d2b0bfec778c1b06094465326bf1b6 Mon Sep 17 00:00:00 2001 From: Matthew Nesbit Date: Fri, 6 May 2016 10:06:34 +0100 Subject: [PATCH 3/4] Fix node lock to work on windows where automatic file deletion on exit does not work reliably. --- src/main/kotlin/core/node/Node.kt | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/main/kotlin/core/node/Node.kt b/src/main/kotlin/core/node/Node.kt index 35780542a9..4520a182ee 100644 --- a/src/main/kotlin/core/node/Node.kt +++ b/src/main/kotlin/core/node/Node.kt @@ -23,9 +23,7 @@ import org.glassfish.jersey.servlet.ServletContainer import java.io.RandomAccessFile import java.lang.management.ManagementFactory import java.nio.channels.FileLock -import java.nio.file.Files import java.nio.file.Path -import java.nio.file.StandardOpenOption import java.time.Clock import javax.management.ObjectName @@ -155,20 +153,20 @@ class Node(dir: Path, val p2pAddr: HostAndPort, configuration: NodeConfiguration // twice with the same directory: that's a user error and we should bail out. val pidPath = dir.resolve("process-id") val file = pidPath.toFile() - if (file.exists()) { - val f = RandomAccessFile(file, "rw") - val l = f.channel.tryLock() - if (l == null) { - println("It appears there is already a node running with the specified data directory $dir") - println("Shut that other node down and try again. It may have process ID ${file.readText()}") - System.exit(1) - } - nodeFileLock = l + if (!file.exists()) { + file.createNewFile() } + file.deleteOnExit() + val f = RandomAccessFile(file, "rw") + val l = f.channel.tryLock() + if (l == null) { + println("It appears there is already a node running with the specified data directory $dir") + println("Shut that other node down and try again. It may have process ID ${file.readText()}") + System.exit(1) + } + nodeFileLock = l val ourProcessID: String = ManagementFactory.getRuntimeMXBean().name.split("@")[0] - Files.write(pidPath, ourProcessID.toByteArray(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING) - pidPath.toFile().deleteOnExit() - if (nodeFileLock == null) - nodeFileLock = RandomAccessFile(file, "rw").channel.lock() - } + f.setLength(0) + f.write(ourProcessID.toByteArray()) + } } From 306c9a67cba72f72fd471e894542466b17249946 Mon Sep 17 00:00:00 2001 From: Matthew Nesbit Date: Mon, 16 May 2016 13:48:09 +0100 Subject: [PATCH 4/4] Force wildcard classpath into generated windows startup scripts to prevent 'command line too long' issues --- build.gradle | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a6d23adc24..99a2b61b4d 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,7 @@ buildscript { ext.artemis_version = '1.2.0' ext.jetty_version = '9.1.1.v20140108' ext.jersey_version = '2.22.2' + ext.jolokia_version = '2.0.0-M1' repositories { mavenCentral() @@ -89,7 +90,7 @@ dependencies { compile "org.eclipse.jetty:jetty-servlet:${jetty_version}" compile "org.eclipse.jetty:jetty-webapp:${jetty_version}" compile "javax.servlet:javax.servlet-api:3.1.0" - compile "org.jolokia:jolokia-agent-war:2.0.0-M1" + compile "org.jolokia:jolokia-agent-war:${jolokia_version}" compile "commons-fileupload:commons-fileupload:1.3.1" // Jersey for JAX-RS implementation for use in Jetty @@ -157,6 +158,18 @@ task getIRSDemo(type: CreateStartScripts) { classpath = jar.outputs.files + project.configurations.runtime } +// Force windows script classpath to wildcard path to avoid the 'Command Line Is Too Long' issues +// with generated scripts. Include Jolokia .war explicitly as this isn't picked up by wildcard +tasks.withType(CreateStartScripts) +{ + doLast { + windowsScript.text = windowsScript + .readLines() + .collect { line -> line.replaceAll(~/^set CLASSPATH=.*$/, 'set CLASSPATH=%APP_HOME%/lib/*;%APP_HOME%/lib/jolokia-agent-war-'+project.ext.jolokia_version+'.war') } + .join('\r\n') + } +} + // These lines tell gradle to run the Quasar suspendables scanner to look for unannotated super methods // that have @Suspendable sub implementations. These tend to cause NPEs and are not caught by the verifier // NOTE: need to make sure the output isn't on the classpath or every other run it generates empty results, so