From 91c3e55b80ad2b097d4160b2cb0bf6f13d556eca Mon Sep 17 00:00:00 2001 From: dilanSachi Date: Thu, 27 Jun 2024 11:04:26 +0530 Subject: [PATCH 1/3] Isolate listener --- ballerina/listener_endpoint.bal | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ballerina/listener_endpoint.bal b/ballerina/listener_endpoint.bal index 8ce722b3..589cece5 100644 --- a/ballerina/listener_endpoint.bal +++ b/ballerina/listener_endpoint.bal @@ -14,12 +14,12 @@ // specific language governing permissions and limitations // under the License. +import ballerina/jballerina.java; import ballerina/log; import ballerina/task; -import ballerina/jballerina.java; # Represents a service listener that monitors the FTP location. -public class Listener { +public isolated class Listener { private handle EMPTY_JAVA_STRING = java:fromString(""); private ListenerConfiguration config = {}; @@ -30,8 +30,10 @@ public class Listener { # + listenerConfig - Configurations for FTP listener # + return - `()` or else an `ftp:Error` upon failure to initialize the listener public isolated function init(ListenerConfiguration listenerConfig) returns Error? { - self.config = listenerConfig; - return initListener(self, self.config); + self.config = listenerConfig.clone(); + lock { + return initListener(self, self.config); + } } # Starts the `ftp:Listener`. @@ -91,13 +93,17 @@ public class Listener { } isolated function internalStart() returns error? { - self.jobId = check task:scheduleJobRecurByFrequency(new Job(self), self.config.pollingInterval); + lock { + self.jobId = check task:scheduleJobRecurByFrequency(new Job(self), self.config.pollingInterval); + } } isolated function stop() returns error? { - var id = self.jobId; - if id is task:JobId { - check task:unscheduleJob(id); + lock { + var id = self.jobId; + if id is task:JobId { + check task:unscheduleJob(id); + } } } From e01fe4331782cd7db87cf8b5c3a3b774d62cb92f Mon Sep 17 00:00:00 2001 From: dilanSachi Date: Thu, 27 Jun 2024 11:06:27 +0530 Subject: [PATCH 2/3] [Automated] Update the native jar versions --- ballerina/Ballerina.toml | 6 +++--- ballerina/CompilerPlugin.toml | 2 +- ballerina/Dependencies.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index eebaa7ba..889d27d0 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "ftp" -version = "2.9.1" +version = "2.9.2" authors = ["Ballerina"] keywords = ["FTP", "SFTP", "remote file", "file transfer", "client", "service"] repository = "https://github.com/ballerina-platform/module-ballerina-ftp" @@ -33,5 +33,5 @@ path = "./lib/commons-net-3.9.0.jar" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "ftp-native" -version = "2.9.1" -path = "../native/build/libs/ftp-native-2.9.1.jar" +version = "2.9.2" +path = "../native/build/libs/ftp-native-2.9.2-SNAPSHOT.jar" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index d636490b..4afe14eb 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "ftp-compiler-plugin" class = "io.ballerina.stdlib.ftp.plugin.FtpCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/ftp-compiler-plugin-2.9.1.jar" +path = "../compiler-plugin/build/libs/ftp-compiler-plugin-2.9.2-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 1d9433c5..29b6df71 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.8.0" [[package]] org = "ballerina" name = "ftp" -version = "2.9.1" +version = "2.9.2" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -112,7 +112,7 @@ modules = [ [[package]] org = "ballerina" name = "observe" -version = "1.2.0" +version = "1.2.3" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] From c3d043de121a5a27fa3230e75ebc0705b47c7d4d Mon Sep 17 00:00:00 2001 From: dilanSachi Date: Fri, 28 Jun 2024 11:51:47 +0530 Subject: [PATCH 3/3] Update changelog.md --- changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.md b/changelog.md index d5261bc7..fd91d3de 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,12 @@ This file contains all the notable changes done to the Ballerina Email package t The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- [Isolated the `ftp:Listener`](https://github.com/ballerina-platform/module-ballerina-ftp/pull/1287) + ## [2.9.1] - 2024-02-19 ### Added