Tuesday, January 18, 2011

Interesting article on Reloading Java Classes

Look at the code below. TAll the code is trying to achieve is get an instance of iExample. However, kind of complex code.


public class ExampleFactory {
public static IExample newInstance() {
URLClassLoader tmp =
new URLClassLoader(new URL[] {getClassPath()}) {
public Class loadClass(String name) {
if ('example.Example'.equals(name))
return findClass(name);
return super.loadClass(name);
}
};

return (IExample)
tmp.loadClass('example.Example').newInstance();
}
}"

Monday, January 17, 2011

JDK 7: Support for dynamically-typed languages

JDK 7 is getting ready for GA. One of the very interesting feature of JDK 7 is invoke_dynamic which is about support for dynamically typed language at performance levels near to that of Java language. So far, following has been supported:

invoke_virtual :Interface related methods
invoke_special: private methods invocation
invoke_static: Static method invocation

Other enhancements are following:

Language enhancements such as following:
- Support for String in Switch-case
- Simplified varargs
- automatic resource management
- Multi-catch statement as part of improved exception handling

Upgraded class loader architecture to avoid deadlocks in case of non-hierarchy topologies

Method to close URLClassLoader

Enhanced Concurrency framework
-- A lightweight fork/join framework, flexible and reusable synchronization barriers, transfer queues, a concurrent-reference HashMap, and thread-local pseudo-random number generators

Internationalization related enhancements

I/O and networking related enhancements

JDBC

Security & Cryptography

JDK 7 Features: "Support for dynamically-typed languages"

Sunday, January 16, 2011

Is this beginning for end of Java?

Not sure. But with following, I am thinking if developers should start learning newer JVM languages such as Groovy, Scala, JRuby.

1. Apache Software Foundation (ASF) resigned from Java community.
2. Google & Oracle battling over Java technology
3. Would Java remain open source after Oracle mis-adventures

Software development predictions for 2011 - JavaWorld

Friday, January 14, 2011

JMSAppenders COnfiguration for Various Servers

JBoss Server:

Properties env = new Properties( ); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); env.put(Context.PROVIDER_URL, "jnp://hostname:1099"); env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); InitialContext jndiContext = new InitialContext(env);

WebLogic Server:

Properties env = new Properties( ); env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); env.put(Context.PROVIDER_URL, "t3://localhost:7001"); InitialContext jndiContext = new InitialContext(env);

Log4J Appenders Performance Analysis

This page would give a fair idea of how various log4j appenders perform at a very high load. Well, these are not my stress lab readings, and need to be tested. However, this should give a fair idea for understanding various appenders performance.

http://www.ingrid.org/jajakarta/log4j/jakarta-log4j-1.1.3/docs/api/org/apache/log4j/performance/Logging.html

Also, question is whethar to use JMSAppender alone or use AsyncAppender and JMSAppender. The analysis of these are given in following page:

http://www.theserverside.com/discussions/thread.tss?thread_id=18742

I have tried following scenario and TPS (transaction per second) came almost same in both the case in case of load of 100 threads in 60 sec.

AsyncAppender sending messages to Console and File Appender

And

Messages are sent directly to Console and File Appender

I need to do further analysis to come out with right set of observation.




JVM Language - Groovy, JRuby, Scala and Java

Well, this is definitely a news to me. I was looking at this webinar posted at InfoQ and all of a sudden realized that people have been really doing some good work in these other JVM languages such as groovy, Scala and Jruby.

Need to catch up on this... check out the seminar anyways..