Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 117 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,15 @@ await str.length(); // 11
await str.toString(); // 'Hello World'
```

### Setting the number of threads

When using asynchronous functions, by default, the number of threads used by these functions
is determined by the number of physical CPUs available.
In order to change this behaviour, set the `JAVA_BRIDGE_THREAD_POOL_SIZE` environment variable
to the desired amount of threads.

Note: Setting this to a non-numeric value will cause an error to be thrown during startup.

### Implement a Java interface

You can also implement a Java interface in node.js using the
Expand Down
20 changes: 10 additions & 10 deletions crates/java-bridge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
edition = "2021"
name = "java"
version = "2.4.0"
version = "2.8.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
napi = { version = "2.16.0", default-features = false, features = [
napi = { version = "2.16.17", default-features = false, features = [
"napi2",
"napi3",
"napi4",
Expand All @@ -18,26 +18,26 @@ napi = { version = "2.16.0", default-features = false, features = [
] }
napi-derive = "2.16.13"
futures = "0.3.31"
java-locator = "0.1.8"
java-locator = "0.1.9"
lazy_static = "1.5.0"
rand = "0.8.5"
rand = "0.9.0"
glob = "0.3.1"
java-rs = { path = "../java-rs" }
app-state = { git = "https://github.com/MarkusJx/app-state" }
# TODO: remove this once the next version of napi-sys is released
libloading = "0.8.6"
anyhow = { version = "1.0.94", optional = true }
log = { version = "0.4.22", optional = true }
anyhow = "1.0.97"
log = { version = "0.4.27", optional = true }
log4rs = { version = "1.3.0", features = ["json_format"], optional = true }
serde = { version = "1.0.216", optional = true }
serde = { version = "1.0.219", optional = true }
smart-default = "0.7.1"
spin_sleep = "1.3.0"
spin_sleep = "1.3.1"

[build-dependencies]
napi-build = "2.1.4"
napi-build = "2.1.6"

[features]
default = []
all = ["log", "type_check"]
type_check = ["java-rs/type_check"]
log = ["dep:log", "dep:log4rs", "dep:serde", "dep:anyhow", "java-rs/log"]
log = ["dep:log", "dep:log4rs", "dep:serde", "java-rs/log"]
3 changes: 2 additions & 1 deletion crates/java-bridge/src/logging/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ mod logging {
/// Call {@link logging.setLogCallbacks} to enable the `node` appender again.
pub fn reset_log_callbacks() -> napi::Result<()> {
debug!("Resetting log callbacks");
Ok(NodeWriter::set_callbacks(None, None))
NodeWriter::set_callbacks(None, None);
Ok(())
}

#[napi]
Expand Down
Loading
Loading