You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ff...@apache.org on 2014/04/15 09:10:37 UTC
git commit: [KARAF-2910]Properties login module leak a
PropertiesInstaller reference results in OOM (cherry picked from commit
a1b2aac03b675fb18936674cc050135fc683eb09)
Repository: karaf
Updated Branches:
refs/heads/karaf-2.x fdababb92 -> e5453482f
[KARAF-2910]Properties login module leak a PropertiesInstaller reference results in OOM
(cherry picked from commit a1b2aac03b675fb18936674cc050135fc683eb09)
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/e5453482
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/e5453482
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/e5453482
Branch: refs/heads/karaf-2.x
Commit: e5453482f68eccfeadc4c14cf019a4d9f2b81b7e
Parents: fdababb
Author: Freeman Fang <fr...@gmail.com>
Authored: Tue Apr 15 15:04:54 2014 +0800
Committer: Freeman Fang <fr...@gmail.com>
Committed: Tue Apr 15 15:10:09 2014 +0800
----------------------------------------------------------------------
.../modules/properties/PropertiesInstaller.java | 4 ++++
.../modules/properties/PropertiesLoginModule.java | 16 +++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/e5453482/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java
----------------------------------------------------------------------
diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java
index d8bcacd..5cc0c11 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesInstaller.java
@@ -64,5 +64,9 @@ public class PropertiesInstaller implements ArtifactInstaller {
public void uninstall(File artifact) throws Exception {
LOGGER.warn("the users.properties was removed");
}
+
+ public String getUsersFileName() {
+ return this.usersFileName;
+ }
}
http://git-wip-us.apache.org/repos/asf/karaf/blob/e5453482/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModule.java
----------------------------------------------------------------------
diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModule.java b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModule.java
index c5f00c8..a31adeb 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModule.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/properties/PropertiesLoginModule.java
@@ -50,7 +50,7 @@ public class PropertiesLoginModule extends AbstractKarafLoginModule {
private String usersFile;
- private PropertiesInstaller propertiesInstaller;
+ private static PropertiesInstaller propertiesInstaller;
public void initialize(Subject sub, CallbackHandler handler, Map sharedState, Map options) {
@@ -59,10 +59,16 @@ public class PropertiesLoginModule extends AbstractKarafLoginModule {
if (debug) {
LOGGER.debug("Initialized debug={} usersFile={}", debug, usersFile);
}
- propertiesInstaller = new PropertiesInstaller(this, usersFile);
- if (this.bundleContext != null) {
- this.bundleContext.registerService("org.apache.felix.fileinstall.ArtifactInstaller", propertiesInstaller, null);
- }
+
+ if (propertiesInstaller == null || !usersFile.equals(propertiesInstaller.getUsersFileName()) ) {
+
+ LOG.debug("Register PropertiesInstaller service");
+
+ propertiesInstaller = new PropertiesInstaller(this, usersFile);
+ if (this.bundleContext != null) {
+ this.bundleContext.registerService("org.apache.felix.fileinstall.ArtifactInstaller", propertiesInstaller, null);
+ }
+ }
}
public boolean login() throws LoginException {