Skip to content

Commit 5ee9ece

Browse files
Fix the time-oracle scope [ECR-3091] (#823)
time oracle was incorrectly packaged in the QA service artifact, causing TimeSchemaProxy to be loaded by the classloader of that service artifact, which cannot link to an already loaded by the application classloader java_bindings native library. That's another reason to reconsider https://jira.bf.local/browse/ECR-3046 which would have provided a proper error message earlier. Also, make isTimeServiceEnabled static as there is no reason for it to be an instance method (and native already implemented as for static): pub extern "system" fn Java_com_exonum_binding_time_TimeSchemaProxy_isTimeServiceEnabled( _: JNIEnv, _: JClass, // <- ! ) -> jboolean {
1 parent b841b0d commit 5ee9ece

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

exonum-java-binding/qa-service/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
<scope>provided</scope>
3939
</dependency>
4040

41-
<!-- Time oracle is a compile-scoped dependency till Packaging is delivered. -->
4241
<dependency>
4342
<groupId>com.exonum.binding</groupId>
4443
<artifactId>exonum-time-oracle</artifactId>
44+
<scope>provided</scope>
4545
</dependency>
4646

4747
<dependency>

exonum-java-binding/time-oracle/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ Include `exonum-time-oracle` as a dependency in your `pom.xml`:
1313
<groupId>com.exonum.binding</groupId>
1414
<artifactId>exonum-time-oracle</artifactId>
1515
<version>0.6.0-SNAPSHOT</version>
16+
<scope>provided</scope>
1617
</dependency>
1718
```
1819

1920
To use the time oracle, we should enable it. To do that, include its name `time` in
2021
`services.toml` configuration file in the Exonum Java app's directory with the following content:
2122

2223
```toml
23-
services = ["time"]
24+
system_services = ["time"]
2425
```
2526

2627
See more information on built-in services [here][built-in-services].

exonum-java-binding/time-oracle/src/main/java/com/exonum/binding/time/TimeSchemaProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private static boolean runningUnitTests() {
7171
}
7272
}
7373

74-
private native boolean isTimeServiceEnabled();
74+
private static native boolean isTimeServiceEnabled();
7575

7676
/**
7777
* Mapping for Exonum time indexes by name.

0 commit comments

Comments
 (0)