use keyword final to optimize the spark starter


/ Published in: Java
Save to your folder(s)

Because the spark's startup process use a lot time, so add the final to make it faster.


Copy this code and paste it in your HTML
  1. //Before
  2. final ClassLoader loader = new JiveClassLoader(parent, libDir);
  3. Thread.currentThread().setContextClassLoader(loader);
  4. Class sparkClass = loader.loadClass("org.jivesoftware.Spark");
  5. Object instanceOfSpark = sparkClass.newInstance();
  6.  
  7. //after
  8. final ClassLoader loader = new JiveClassLoader(parent, libDir);
  9. Thread.currentThread().setContextClassLoader(loader);
  10. Class sparkClass = loader.loadClass("org.jivesoftware.Spark");
  11. final Object instanceOfSpark = sparkClass.newInstance();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.