Hi All,
I am trying to calculate time taken to load the bundles in Felix. I played
around with some profiler tool such JProfiler but didn't get any easy way
out.
I finally wrote a small program to calculate the time taken. It is
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class CalculateTimeTaken {
/**
* @param args
*/
public static void main(String[] args) {
// Get the start time of the process
long start = System.currentTimeMillis();
System.out.println("Start: " + start);
Runtime rt = Runtime.getRuntime();
try {
String command1 = "java -jar
C:\\Users\\KK\\Desktop\\felix-1.4.1\\bin\\felix.jar";
Process pr = rt.exec("cmd /c " + command1);
InputStream is = pr.getErrorStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
System.out.println("ERROR STARTS");
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
System.out.println("ERROR END");
int exitval = pr.waitFor();
System.out.println("exit status is " + exitval);
} catch (Exception e) {
e.printStackTrace();
}
// Get the end time of the process
long end = System.currentTimeMillis();
System.out.println("End : " + end);
long elapsedTime = end - start;
// Show how long it took to finish the process
System.out.println("The process took approximately: " + elapsedTime
+ " mili seconds");
}
}
However, this fails with following error
Start: 1235369156728
ERROR STARTS
Auto-properties install: org.osgi.framework.BundleException: Unable to cache
bundle: file:bundle/org.apache.felix.shell-1.0.2.jar
Auto-properties install: org.osgi.framework.BundleException: Unable to cache
bundle: file:bundle/org.apache.felix.shell.tui-1.0.2.jar
Auto-properties install: org.osgi.framework.BundleException: Unable to cache
bundle: file:bundle/org.apache.felix.bundlerepository-1.2.1.jar
Auto-properties start: org.osgi.framework.BundleException: Unable to cache
bundle: file:bundle/org.apache.felix.shell-1.0.2.jar
Auto-properties start: org.osgi.framework.BundleException: Unable to cache
bundle: file:bundle/org.apache.felix.shell.tui-1.0.2.jar
Auto-properties start: org.osgi.framework.BundleException: Unable to cache
bundle: file:bundle/org.apache.felix.bundlerepository-1.2.1.jar
After this, it hangs ...
Any help on what the issue might be?
By the way, is there a better way to calculate the time taken to load
bundles ??
Thanks,
Krishnaveni Krishnarajah