Skip to content

Add current refreshing policy.#128

Merged
palatej merged 1 commit intorjdverse:developfrom
palatej:develop
Apr 23, 2026
Merged

Add current refreshing policy.#128
palatej merged 1 commit intorjdverse:developfrom
palatej:develop

Conversation

@palatej
Copy link
Copy Markdown
Contributor

@palatej palatej commented Apr 23, 2026

Initialize samanagers

Initialize samanagers
@palatej palatej merged commit 95130c6 into rjdverse:develop Apr 23, 2026
7 checks passed
@TanguyBarthelemy
Copy link
Copy Markdown
Contributor

What is Sa manager?

@palatej
Copy link
Copy Markdown
Contributor Author

palatej commented Apr 24, 2026

Hi Tanguy,

I introduced a small piece of code in "onLoad" to solve a problem that appeared with R 4.5.3
More exactly, the java code provides the class SaManager, which contains all the "SaProcessingFactory" and "SaOutputFactory" contained in the loaded libraries. When we call "process" on a SaItem, the SaManager search in its list the factory which is able to process the given sa specification (for instance X13Factory or TramoSeatsFactory). If it doesn't contain any suitable factory, the computation fails. That was the case with R4.5.3. The reason has to be find in the initialisation procedure. When the class SaManager is loaded, the Java loader search in all the loaded packages the services implementing SaProcessingFactory (and SaOutputFactory. So, the order of the loading of SaManager and of TramoSeats/X13Factory is critical. We don't control that order (R uses lazy loading and it seems that something was changed in the last version of R). An explicit call to "SaManager.reload" (rjd3tramoseats and rjd3x13 should be loaded at that point) solves the problem. It is not completely excluded that another similar problem could appear elsewhere in the libraries (I didn't find anything until now).

@TanguyBarthelemy
Copy link
Copy Markdown
Contributor

Ok thank you.

For a long time, I had a problem loading packages with {devtools} (devtools::load_all()) and the issue was resolved with the introduction of:

rjd3workspace/R/zzz.R

Lines 18 to 20 in 1e21656

jar_dir <- file.path(libname, pkgname, "inst", "java")
jars <- list.files(jar_dir, pattern = "\\.jar$", full.names = TRUE, all.files = TRUE)
rJava::.jaddClassPath(jars)

(Ref: rjdverse/rjd3bench#63 (comment))

I will test again with the new R version (4.5.3) and the oldest one.

@palatej
Copy link
Copy Markdown
Contributor Author

palatej commented Apr 24, 2026

I saw that. It's strange, because it is exactly what the .jpackage should do. I will take a look at the code of rjava

@TanguyBarthelemy
Copy link
Copy Markdown
Contributor

I completely agree ! .jpackage() should do this. I raised a issue directly in {devtools} without answer...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants