You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by js...@apache.org on 2007/11/29 13:08:26 UTC
svn commit: r599402 -
/servicemix/branches/servicemix-4.0/runtime/filemonitor/src/main/java/org/apache/servicemix/runtime/filemonitor/FileMonitor.java
Author: jstrachan
Date: Thu Nov 29 04:08:26 2007
New Revision: 599402
URL: http://svn.apache.org/viewvc?rev=599402&view=rev
Log:
only refresh the changed packages
Modified:
servicemix/branches/servicemix-4.0/runtime/filemonitor/src/main/java/org/apache/servicemix/runtime/filemonitor/FileMonitor.java
Modified: servicemix/branches/servicemix-4.0/runtime/filemonitor/src/main/java/org/apache/servicemix/runtime/filemonitor/FileMonitor.java
URL: http://svn.apache.org/viewvc/servicemix/branches/servicemix-4.0/runtime/filemonitor/src/main/java/org/apache/servicemix/runtime/filemonitor/FileMonitor.java?rev=599402&r1=599401&r2=599402&view=diff
==============================================================================
--- servicemix/branches/servicemix-4.0/runtime/filemonitor/src/main/java/org/apache/servicemix/runtime/filemonitor/FileMonitor.java (original)
+++ servicemix/branches/servicemix-4.0/runtime/filemonitor/src/main/java/org/apache/servicemix/runtime/filemonitor/FileMonitor.java Thu Nov 29 04:08:26 2007
@@ -62,8 +62,8 @@
private Project project = new Project();
private long scanInterval = 500L;
private boolean loggedConfigAdminWarning;
- private boolean changedBundles;
private boolean debug;
+ private List<Bundle> changedBundles = new ArrayList<Bundle>();
public FileMonitor() {
}
@@ -190,7 +190,7 @@
//-------------------------------------------------------------------------
protected void onFilesChanged(List filenames) {
- changedBundles = false;
+ changedBundles.clear();
Set<File> bundleJarsCreated = new HashSet<File>();
for (Object filename : filenames) {
@@ -238,13 +238,10 @@
warn("Failed to process: " + file + ". Reason: " + e, e);
}
}
- if (changedBundles) {
refreshPackages();
- }
}
protected void deployBundle(File file) throws IOException, BundleException {
- changedBundles = true;
log("Deloying: " + file.getCanonicalPath());
InputStream in = new FileInputStream(file);
@@ -252,6 +249,7 @@
try {
Bundle bundle = getBundleForJarFile(file);
if (bundle != null) {
+ changedBundles.add(bundle);
bundle.update(in);
log("Updated: " + file.getCanonicalPath());
}
@@ -269,7 +267,6 @@
}
protected void undeployBundle(File file) throws BundleException, IOException {
- changedBundles = true;
log("Undeloying: " + file.getCanonicalPath());
Bundle bundle = getBundleForJarFile(file);
@@ -277,6 +274,7 @@
warn("Could not find Bundle for file: " + file.getCanonicalPath());
}
else {
+ changedBundles.add(bundle);
bundle.stop();
bundle.uninstall();
}
@@ -390,8 +388,11 @@
protected void refreshPackages() {
PackageAdmin packageAdmin = getPackageAdmin();
if (packageAdmin != null) {
- packageAdmin.refreshPackages(null);
+ Bundle[] bundles = new Bundle[changedBundles.size()];
+ changedBundles.toArray(bundles);
+ packageAdmin.refreshPackages(bundles);
}
+ changedBundles.clear();
}
protected File createBundleJar(File dir) throws BundleException, IOException {