Skip to content

Update JEP to 4.2.2#1332

Merged
lfoppiano merged 8 commits into
masterfrom
improvement/update-jep
Oct 5, 2025
Merged

Update JEP to 4.2.2#1332
lfoppiano merged 8 commits into
masterfrom
improvement/update-jep

Conversation

@lfoppiano

Copy link
Copy Markdown
Member

This PR updates JEP to version 4.2.2 and improve a few things around the integration with DeLFT

@lfoppiano lfoppiano marked this pull request as ready for review August 26, 2025 16:55
@lfoppiano lfoppiano requested a review from Copilot August 26, 2025 16:55

This comment was marked as outdated.

@coveralls

coveralls commented Aug 26, 2025

Copy link
Copy Markdown

Coverage Status

coverage: 40.318% (+0.05%) from 40.266%
when pulling 2e6c0ba on improvement/update-jep
into 9cd6fb9 on master.

@lfoppiano lfoppiano requested a review from Copilot August 26, 2025 17:20

This comment was marked as outdated.

@lfoppiano lfoppiano requested a review from Copilot August 26, 2025 17:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates JEP (Java Embedded Python) from version 4.0.3 to 4.2.2 and enhances resource management in the DeLFT integration by improving instance lifecycle handling and cleanup processes.

  • Updates JEP dependency to version 4.2.2 for improved compatibility and features
  • Adds proper shutdown hooks and resource cleanup for JEP thread pools
  • Refactors exception handling and cleanup logic to use try-finally blocks

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
JEPThreadPoolClassifier.java Added final modifiers, shutdown hooks, and resource cleanup methods
JEPThreadPool.java Added final modifiers, shutdown hooks, and resource cleanup methods
DeLFTModel.java Improved exception handling, cleanup logic, and import organization
DeLFTClassifierModel.java Enhanced exception handling, cleanup patterns, and property access
Dockerfile.delft Updated JEP version from 4.0.3 to 4.2.2

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread grobid-core/src/main/java/org/grobid/core/jni/JEPThreadPool.java
Comment thread grobid-core/src/main/java/org/grobid/core/jni/DeLFTModel.java
Comment thread grobid-core/src/main/java/org/grobid/core/jni/DeLFTModel.java
Comment thread grobid-core/src/main/java/org/grobid/core/jni/DeLFTClassifierModel.java Outdated
@lfoppiano lfoppiano requested a review from Copilot August 26, 2025 17:39

This comment was marked as outdated.

@lfoppiano lfoppiano requested a review from Copilot August 26, 2025 17:54

This comment was marked as outdated.

@lfoppiano lfoppiano requested a review from Copilot August 26, 2025 18:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates JEP (Java Embedded Python) from version 4.0.3 to 4.2.2 and enhances the integration with DeLFT (Deep Learning Framework for Text) by improving resource management, error handling, and adding comprehensive test coverage.

  • Updates JEP to version 4.2.2 in the Docker configuration
  • Improves JEP resource management with proper shutdown hooks and cleanup mechanisms
  • Enhances error handling and exception management in DeLFT integration
  • Adds comprehensive test coverage for JEP thread pools and DeLFT models

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Dockerfile.delft Updates JEP version from 4.0.3 to 4.2.2
JEPThreadPool.java Adds shutdown hooks, proper resource cleanup, and makes fields final
JEPThreadPoolClassifier.java Adds shutdown hooks, proper resource cleanup, and makes fields final
DeLFTModel.java Improves error handling, cleanup logic, and code organization
DeLFTClassifierModel.java Enhances error handling, cleanup logic, and GrobidProperties usage
JEPThreadPoolTest.java Comprehensive test suite for JEP thread pool functionality
JEPThreadPoolShutdownTest.java Separate test class for shutdown functionality
JEPThreadPoolClassifierTest.java Test suite for classifier-specific thread pool
JEPThreadPoolClassifierShutdownTest.java Separate test class for classifier shutdown functionality
JEPIntegrationTest.java Integration tests for JEP thread pool interactions
DeLFTModelTest.java Unit tests for DeLFT model functionality
DeLFTClassifierModelTest.java Unit tests for DeLFT classifier model functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +221 to +225
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
Thread.currentThread().interrupt();

Copilot AI Aug 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line interrupts the current thread (the main thread calling shutdown), not the executor's threads. This could cause unexpected behavior. The interrupt call should be removed here since it's in the context of shutting down the executor, not handling an interrupt.

Suggested change
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();

Copilot uses AI. Check for mistakes.
Comment on lines +221 to +229
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();

Copilot AI Aug 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to line 221, this interrupts the current thread calling shutdown rather than the executor's threads. This should be removed as it's not appropriate in the shutdown context.

Suggested change
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();

Copilot uses AI. Check for mistakes.
Comment on lines +220 to +228
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();

Copilot AI Aug 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line interrupts the current thread (the main thread calling shutdown), not the executor's threads. This could cause unexpected behavior. The interrupt call should be removed here since it's in the context of shutting down the executor, not handling an interrupt.

Suggested change
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
Thread.currentThread().interrupt();
}
} catch (InterruptedException e) {
executor.shutdownNow();
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();

Copilot uses AI. Check for mistakes.
Comment on lines +220 to +224
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
Thread.currentThread().interrupt();

Copilot AI Aug 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to line 220, this interrupts the current thread calling shutdown rather than the executor's threads. This should be removed as it's not appropriate in the shutdown context.

Suggested change
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();
Thread.currentThread().interrupt();
try {
if (!executor.awaitTermination(5, TimeUnit.SECONDS)) {
executor.shutdownNow();

Copilot uses AI. Check for mistakes.
Comment thread grobid-core/src/main/java/org/grobid/core/jni/DeLFTModel.java
@lfoppiano lfoppiano force-pushed the improvement/update-jep branch from f2dfeb6 to 4b69357 Compare August 26, 2025 20:45
@lfoppiano lfoppiano requested a review from Copilot August 26, 2025 20:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@lfoppiano lfoppiano merged commit 9450ddd into master Oct 5, 2025
13 checks passed
@lfoppiano lfoppiano deleted the improvement/update-jep branch October 5, 2025 16:44
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.

3 participants