<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5416346355071142326</id><updated>2011-07-30T19:13:28.848-07:00</updated><category term='garbage collection'/><title type='text'>shivnarayan</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-5466592155349964985</id><published>2011-03-28T05:40:00.000-07:00</published><updated>2011-03-28T05:43:19.354-07:00</updated><title type='text'>potential uses for dynamic proxies</title><content type='html'>1.Event publishing - on method x(), transparently call y() or send message z.&lt;br /&gt;2.Transaction management (for db connections or other transactional ops)&lt;br /&gt;3.Thread management - thread out expensive operations transparently. &lt;br /&gt;4.Performance tracking - timing operations checked by a CountdownLatch, for example.&lt;br /&gt;5.Connection management - thinking of APIs like Salesforce's Enterprise API that require clients of their service to start a session before executing any operations.&lt;br /&gt;6.Changing method parameters - in case you want to pass default values for nulls, if that's your sort of thing.&lt;br /&gt;Those are just a few options in addition to validation and logging like you've described above. FWIW, JSR 303, a bean validation specification, has an AOP-style implementation in Hibernate Validator, so you don't need to implement it for your data objects specifically. Spring framework also has validation built in and has really nice integration with AspectJ for some of the stuff described here.&lt;br /&gt;7. Another useful side of a dynamic proxy is when you want to apply the same operation to all methods. With a static proxy you'd need a lot of duplicated code (on each proxied method you would need the same call to a method, and then delegate to the proxied object), and a dynamic proxy would minimize this.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-5466592155349964985?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/5466592155349964985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2011/03/potential-uses-for-dynamic-proxies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5466592155349964985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5466592155349964985'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2011/03/potential-uses-for-dynamic-proxies.html' title='potential uses for dynamic proxies'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-7096969881011143126</id><published>2011-03-28T05:01:00.000-07:00</published><updated>2011-03-28T05:02:34.242-07:00</updated><title type='text'>How Java AOP implemented</title><content type='html'>How Java AOP works&lt;br /&gt;&lt;br /&gt;Class-weaving-based, such as AspectJ and JBoss AOP. Core and crosscutting concerns are implemented independently. Class weaving is the process of integrating the concern implementations to form the final system. Weaving can be performed at compile, load, and run time. Both AspectJ and JBoss AOP are very powerful AOP implementations. They provide field interception, caller side interception, and constructor interception.&lt;br /&gt;Proxy-based, such as Spring AOP, Nanning, and dynaop. With proxies, method invocations on an object can be intercepted to inject custom code. The aforementioned AOP frameworks use JDK dynamic proxy, CGLIB proxy, or both. Unlike the class-weaving-based ones, proxy-based AOP frameworks are simpler and often focus on method interception. Most of the time, Java developers use method interception only. Some proxy-based AOP implementations, such as Spring AOP, provide close integration with AspectJ to take advantage of its capabilities.&lt;br /&gt;&lt;br /&gt;What if you want to proxy legacy classes that do not have interfaces? You can use CGLIB. CGLIB is a powerful, high-performance code generation library. Under the cover, it uses ASM, a small but fast bytecode manipulation framework, to transform existing byte code to generate new classes. CGLIB is faster than the JDK dynamic proxy approach. Essentially, it dynamically generates a subclass to override the non-final methods of the proxied class and wires up hooks that call back to the user-defined interceptors.&lt;br /&gt;&lt;br /&gt;1. Dynamic proxy using InvocationHandler&lt;br /&gt;&lt;br /&gt;public Object invoke(Object target, Method method, Object[] arguments) { &lt;br /&gt;System.out.println("before method " + method.getName()); &lt;br /&gt;return method.invoke(obj, args); &lt;br /&gt;} &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;2. Java byte-code transformation:&lt;br /&gt;&lt;br /&gt;http://asm.ow2.org/doc/tutorial-annotations.html&lt;br /&gt;&lt;br /&gt;Refere this article : http://today.java.net/pub/a/today/2005/11/01/implement-proxy-based-aop.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-7096969881011143126?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/7096969881011143126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2011/03/how-java-aop-implemented.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/7096969881011143126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/7096969881011143126'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2011/03/how-java-aop-implemented.html' title='How Java AOP implemented'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-1039102718190352204</id><published>2011-03-28T02:54:00.000-07:00</published><updated>2011-03-28T02:55:37.786-07:00</updated><title type='text'>Java classpath discovery</title><content type='html'>Library which allows discovering classes at runtime. In Java one can use &lt;br /&gt;ClassLoader.getResourceAsInputStream(resource);&lt;br /&gt;to load the data from the CLASS_PATH provided that you know the name of the resource. This library allows you to discover what Java packages and classes are available at runtime.&lt;br /&gt; &lt;br /&gt;ClassPathFactory factory = new ClassPathFactory(); &lt;br /&gt;ClassPath classPath = factory.createFromJVM(); &lt;br /&gt;for (String packageName : classPath.listPackages("")) { &lt;br /&gt;  System.out.println(packageName); &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-1039102718190352204?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/1039102718190352204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2011/03/java-classpath-discovery.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/1039102718190352204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/1039102718190352204'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2011/03/java-classpath-discovery.html' title='Java classpath discovery'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-3140033163038003550</id><published>2011-03-28T00:07:00.000-07:00</published><updated>2011-03-28T00:08:24.552-07:00</updated><title type='text'>Catching Exception in Threads</title><content type='html'>Java 5 introduced a new way to catch unexpected exceptions: Thread.UncaughtExceptionHandler. This is an interface with the following API:&lt;br /&gt;public interface UncaughtExceptionHandler {&lt;br /&gt;  void uncaughtException(Thread t, Throwable e);&lt;br /&gt;}&lt;br /&gt;Your job is to write a class that implements this interface. You then register your implementation on a per-thread basis, or globally for every thread. To register your handler for a single thread you do something like this:&lt;br /&gt;Thread.currentThread().setUncaughtExceptionHandler(new MyExceptionHandler());&lt;br /&gt;To register your handler for every thread, do this:&lt;br /&gt;Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler());&lt;br /&gt;Notice that setDefaultUncaughtExceptionHandler(...) is a static method in the Thread class, while setUncaughtExceptionHandler(...) is a non-static method.&lt;br /&gt;&lt;br /&gt;Simple enough. Let’s add an uncaught exception handler.&lt;br /&gt;MyExceptionHandler&lt;br /&gt;Here is a simple uncaught exception handler that shows the exception message in a dialog box.&lt;br /&gt;public class MyExceptionHandler implements Thread.UncaughtExceptionHandler {&lt;br /&gt;&lt;br /&gt;    public void uncaughtException(final Thread t, final Throwable e) {&lt;br /&gt;        if (SwingUtilities.isEventDispatchThread()) {&lt;br /&gt;            showException(t, e);&lt;br /&gt;        } else {&lt;br /&gt;            SwingUtilities.invokeLater(new Runnable() {&lt;br /&gt;                public void run() {&lt;br /&gt;                    showException(t, e);&lt;br /&gt;                }&lt;br /&gt;            });&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void showException(Thread t, Throwable e) {&lt;br /&gt;        String msg = String.format("Unexpected problem on thread %s: %s",&lt;br /&gt;                t.getName(), e.getMessage());&lt;br /&gt;&lt;br /&gt;        logException(t, e);&lt;br /&gt;&lt;br /&gt;        // note: in a real app, you should locate the currently focused frame&lt;br /&gt;        // or dialog and use it as the parent. In this example, I'm just passing&lt;br /&gt;        // a null owner, which means this dialog may get buried behind&lt;br /&gt;        // some other screen.&lt;br /&gt;        JOptionPane.showMessageDialog(null, msg);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void logException(Thread t, Throwable e) {&lt;br /&gt;        // todo: start a thread that sends an email, or write to a log file, or&lt;br /&gt;        // send a JMS message...whatever&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;To use this handler, you must register it. Simply modify the code as follows:&lt;br /&gt;public static void main(String[] args) {&lt;br /&gt;    Thread.setDefaultUncaughtExceptionHandler(new MyExceptionHandler());&lt;br /&gt;&lt;br /&gt;    ...&lt;br /&gt;Now, whenever an “unexpected” exception occurs, MyExceptionHandler kicks in and shows this lovely dialog box:&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-3140033163038003550?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/3140033163038003550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2011/03/catching-exception-in-threads.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/3140033163038003550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/3140033163038003550'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2011/03/catching-exception-in-threads.html' title='Catching Exception in Threads'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-2394267413514562103</id><published>2010-09-24T23:28:00.000-07:00</published><updated>2010-09-24T23:30:53.912-07:00</updated><title type='text'>load() vs get() hibernate</title><content type='html'>Hibernate load vs. Hibernate get Methods&lt;br /&gt;&lt;br /&gt;Well, if you were to compare the load and get methods of the Hibernate Session, you'd think that they looked pretty darned similar; and you'd be correct, but there are subtle and very important differences.&lt;br /&gt;&lt;br /&gt;First of all, the get method hits the database as soon as it is called. So, using the Hibernate Session's get method will always trigger a database hit. On the other hand, the load method only hits the database when a particular field of the entity is accessed. So, if we use the load method to retrieve an entity, but we never actually access any of the fields of that entity, we never actually hit the database. Pretty kewl, eh?&lt;br /&gt;&lt;br /&gt;Well, actually, as kewl as the load method might sound, it actually triggers more problems than it solves, and here's why. If you initialize a JavaBean instance with a load method call, you can only access the properties of that JavaBean, for the first time, within the transactional context in which it was initialized. If you try to access the various properties of the JavaBean after the transaction that loaded it has been committed, you'll get an exception, a LazyInitializationException, as Hibernate no longer has a valid transactional context to use to hit the database.&lt;br /&gt;&lt;br /&gt;So, while this code will work just fine?..&lt;br /&gt;&lt;br /&gt;session.beginTransaction();&lt;br /&gt;User user=(User)session.load(User.class, new Long(1));&lt;br /&gt;System.out.println(user.getPassword());&lt;br /&gt;session.getTransaction().commit();&lt;br /&gt;.. this code will fail ?..&lt;br /&gt;&lt;br /&gt;session.beginTransaction();&lt;br /&gt;User user=(User)session.load(User.class, new Long(1));&lt;br /&gt;session.getTransaction().commit();&lt;br /&gt;System.out.println(user.getPassword());&lt;br /&gt;.. and generate the following error, telling you that since the transaction was committed, there was no valid Session in which a read transaction against the database could be issued:&lt;br /&gt;&lt;br /&gt;org.hibernate.LazyInitializationException: &lt;br /&gt;could not initialize proxy - no Session&lt;br /&gt;&lt;br /&gt;When to use get? When to use load?&lt;br /&gt;&lt;br /&gt;So, after comparing and contrasting the load and get methods, the natural question that arises is "when do I use the get, and when do I use load?" It's a good question.&lt;br /&gt;&lt;br /&gt;For the most part, you'll probably use the get method most often in your code. If you ever want to use the JavaBean that you are retrieving from the database after the database transaction has been committed, you'll want to use the get method, and quite frankly, that tends to be most of the time.&lt;br /&gt;&lt;br /&gt;-- From Hibernate made easy&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-2394267413514562103?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/2394267413514562103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/load-vs-get-hibernate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2394267413514562103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2394267413514562103'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/load-vs-get-hibernate.html' title='load() vs get() hibernate'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-8903060283481168537</id><published>2010-09-22T19:41:00.000-07:00</published><updated>2010-09-22T19:42:26.124-07:00</updated><title type='text'>IN vs EXISTS</title><content type='html'>bY Tome Kyte :&lt;br /&gt;&lt;br /&gt;can you give me some example at which situation&lt;br /&gt;IN is better than exist, and vice versa. &lt;br /&gt;&lt;br /&gt;and we said...&lt;br /&gt;&lt;br /&gt;Well, the two are processed very very differently.&lt;br /&gt;&lt;br /&gt;Select * from T1 where x in ( select y from T2 )&lt;br /&gt;&lt;br /&gt;is typically processed as:&lt;br /&gt;&lt;br /&gt;select * &lt;br /&gt;  from t1, ( select distinct y from t2 ) t2&lt;br /&gt; where t1.x = t2.y;&lt;br /&gt;&lt;br /&gt;The subquery is evaluated, distinct'ed, indexed (or hashed or sorted) and then joined to &lt;br /&gt;the original table -- typically.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As opposed to &lt;br /&gt;&lt;br /&gt;select * from t1 where exists ( select null from t2 where y = x )&lt;br /&gt;&lt;br /&gt;That is processed more like:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   for x in ( select * from t1 )&lt;br /&gt;   loop&lt;br /&gt;      if ( exists ( select null from t2 where y = x.x )&lt;br /&gt;      then &lt;br /&gt;         OUTPUT THE RECORD&lt;br /&gt;      end if&lt;br /&gt;   end loop&lt;br /&gt;&lt;br /&gt;It always results in a full scan of T1 whereas the first query can make use of an index &lt;br /&gt;on T1(x).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, when is where exists appropriate and in appropriate?&lt;br /&gt;&lt;br /&gt;Lets say the result of the subquery&lt;br /&gt;    ( select y from T2 )&lt;br /&gt;&lt;br /&gt;is "huge" and takes a long time.  But the table T1 is relatively small and executing ( &lt;br /&gt;select null from t2 where y = x.x ) is very very fast (nice index on t2(y)).  Then the &lt;br /&gt;exists will be faster as the time to full scan T1 and do the index probe into T2 could be &lt;br /&gt;less then the time to simply full scan T2 to build the subquery we need to distinct on.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lets say the result of the subquery is small -- then IN is typicaly more appropriate.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If both the subquery and the outer table are huge -- either might work as well as the &lt;br /&gt;other -- depends on the indexes and other factors.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-8903060283481168537?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/8903060283481168537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/in-vs-exists.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/8903060283481168537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/8903060283481168537'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/in-vs-exists.html' title='IN vs EXISTS'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-2911339405706419477</id><published>2010-09-21T17:30:00.000-07:00</published><updated>2010-09-21T17:42:22.852-07:00</updated><title type='text'>Producer Consumer using concurrent : by Enno Shioji</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; border-collapse: collapse; font-size: 14px; line-height: 18px; "&gt;&lt;pre class="prettyprint" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;public&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;class&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Main&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;{&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;public&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;static&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;void&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; main&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;String&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[]&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; args&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;){&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="com" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: gray; background-position: initial initial; background-repeat: initial initial; "&gt;//The numbers are just silly tune parameters. Refer to the API.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="com" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: gray; background-position: initial initial; background-repeat: initial initial; "&gt;//The important thing is, we are passing a bounded queue.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;ExecutorService&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; consumer &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;new&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;ThreadPoolExecutor&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="lit" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;1&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;,&lt;/span&gt;&lt;span class="lit" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;4&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;,&lt;/span&gt;&lt;span class="lit" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;30&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;,&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;TimeUnit&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;SECONDS&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;,&lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;new&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;LinkedBlockingQueue&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Runnable&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&gt;(&lt;/span&gt;&lt;span class="lit" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;100&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;));&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="com" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: gray; background-position: initial initial; background-repeat: initial initial; "&gt;//No need to bound the queue for this executor.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="com" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: gray; background-position: initial initial; background-repeat: initial initial; "&gt;//Use utility method instead of the complicated Constructor.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;ExecutorService&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; producer &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Executors&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;newSingleThreadExecutor&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;();&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Runnable&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; produce &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;new&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Produce&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;consumer&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;);&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        producer&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;submit&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;produce&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;);&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;  &lt;br /&gt;    &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;class&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Produce&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;implements&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Runnable&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;{&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;private&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;final&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;ExecutorService&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; consumer&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;;&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;public&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Produce&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;ExecutorService&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; consumer&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;)&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;{&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;this&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;consumer &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; consumer&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;;&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="lit" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;@Override&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;public&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;void&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; run&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;()&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;{ &lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; white-space: normal; "&gt;&lt;pre class="prettyprint" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;    &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;while&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(!&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Thread&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;isInterrupted&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;){&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="com" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: gray; background-position: initial initial; background-repeat: initial initial; "&gt;//do stuff&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;       &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Pancake&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; cake &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Pan&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;cook&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;        &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Runnable&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; consume &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;new&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Consume&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;cake&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;);&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        consumer&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;submit&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;consume&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;);&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    }&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;class&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Consume&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;implements&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Runnable&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;{&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;private&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;final&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Pancake&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; cake&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;;&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;public&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Consume&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;Pancake&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; cake&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;){&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;this&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;cake &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; cake&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;;&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="lit" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;@Override&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;public&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;void&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; run&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;()&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;{&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;        cake&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;eat&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;();&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;&lt;code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-2911339405706419477?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/2911339405706419477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/producer-consumer-using-concurrent-by.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2911339405706419477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2911339405706419477'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/producer-consumer-using-concurrent-by.html' title='Producer Consumer using concurrent : by Enno Shioji'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-7922882276403612977</id><published>2010-09-13T17:20:00.000-07:00</published><updated>2010-09-13T17:23:49.558-07:00</updated><title type='text'>How to work on inherited codebase</title><content type='html'>Good link : &lt;a href="http://stackoverflow.com/questions/215076/whats-the-best-way-to-become-familiar-with-a-large-codebase"&gt;http://stackoverflow.com/questions/215076/whats-the-best-way-to-become-familiar-with-a-large-codebase&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://stackoverflow.com/questions/214605/the-best-way-to-familiarize-yourself-with-an-inherited-codebase"&gt;http://stackoverflow.com/questions/214605/the-best-way-to-familiarize-yourself-with-an-inherited-codebase&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-7922882276403612977?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/7922882276403612977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/how-to-work-on-inherited-codebase.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/7922882276403612977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/7922882276403612977'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/how-to-work-on-inherited-codebase.html' title='How to work on inherited codebase'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-5433139730802711988</id><published>2010-09-12T17:45:00.000-07:00</published><updated>2010-09-12T18:47:02.511-07:00</updated><title type='text'>OOD principles</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;b&gt;All text copied from various sources :&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "&gt;&lt;a href="http://c2.com/cgi/wiki?LiskovSubstitutionPrinciple"&gt;LiskovSubstitutionPrinciple&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Verdana; font-weight: normal; font-size: 13px; color: rgb(34, 34, 34); -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;This principle is just an extension of the Open Close Principle and it means that we must make sure that new derived classes are extending the base classes without changing their behavior. Its corollary not principle.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;b&gt;Dependency Inversion Principle [DIP]&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;All said and done, why is it called Dependency Inversion Principle? The answer is again in thought thinking patterns. In the traditional approach, we start thinking from the high-level modules and cascade down to the lower levels. For example, we initially thought, we need an object to write data to the database and then created another object to write the data to the database and strongly coupled the high-level writer object to the low-level database writer object. This led to the bad design.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;In Dependency Inversion Principle, we started thinking from the low-level modules. We identified that we may need to write to different destinations and thereby may need many &lt;i&gt;Writer&lt;/i&gt; objects in the system. But all of them are writing data to somewhere and abstracted it to the &lt;i&gt;Writer&lt;/i&gt; object. Then we associated this abstraction to the high-level module, the &lt;i&gt;DataWriter&lt;/i&gt;.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&lt;p&gt;Last month, we discussed Liskov’s Substitution Principle (LSP). In this article, we will discuss the abstraction principle. While LSP describes different considerations to be made while creating sub-types in the application architecture, the abstraction is all about the design flexibility. If you are interested in good Object-Oriented design, this article is for you.&lt;/p&gt;&lt;h2&gt;&lt;span class="Apple-style-span" style="font-weight: normal; font-size: 11px; "&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;b&gt;Open Close principle [OCP]&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 17px; font-weight: bold; "&gt;Is it Open or Closed?&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;This is the first question you should ask yourself after you have finished writing your application module. Beware if the answer is &lt;b&gt;closed&lt;/b&gt;. It means you need to take a fresh look at your design. Object Oriented software does not only mean that your application is a combination of several objects but it must satisfy the requirements that the design is flexible, and OPEN for extension. At this point of time, we will define the Open-Closed principle (OCP) formally as:&lt;/p&gt;&lt;p&gt;A software module which should be closed for modification but open for extension.&lt;/p&gt;&lt;p&gt;You may wonder how it is possible to extend an application without modifying it. Precisely, a good OO design gives you this power. Remember, bug fixing your application is not an extension. Think about how Object1 uses Object 2 and Object 2 provides some business logic to Object1. This business logic may be customer specific. To meet different customer needs, if you have to change the business logic embedded in Object 2, your application is violating OCP.&lt;/p&gt;&lt;p&gt;So far so good but the example speaks more than a thousand words and I will present examples to illustrate the points about OCP. If you follow the examples, you should be able to understand and apply OCP in your own application design.&lt;/p&gt;&lt;h2&gt;Strong Coupling&lt;/h2&gt;&lt;p&gt;What it is? It means that one application module is totally dependent on the implementation of another module. This is the first sign of violation of OCP. Consider this example. You are going to design a banking application where a particular loan request is passed through a&lt;i&gt;LoanValidator &lt;/i&gt;to approve the loan request. The &lt;i&gt;LoanValidator&lt;/i&gt; looks to see if the balance is above certain values and then approves the request. Given this problem, one guy comes up with the following classes.&lt;/p&gt;&lt;p&gt;The &lt;i&gt;LoanRequestHandler&lt;/i&gt; can assess a loan request. This class holds the balance and period of existence for a particular bank account. I have simplified all other features that this class should normally bear to represent a physical bank account. But still this is sufficient to make the point.&lt;/p&gt;&lt;p&gt;Listing 1 LoanRequestHandler.java&lt;/p&gt;&lt;pre&gt;public class LoanRequestHandler {   private int balance;  private int period;  /** Creates a new instance of LoanRequestHandler */  public LoanRequestHandler(int balance, int period) {   this.balance = balance;   this.period = period;  }   public void approveLoan(PersonalLoanValidator validator) {   if(validator.isValid(balance))     //sanction the loan     System.out.println("Loan approved...");   else     System.out.println("Sorry not enough balance...");  } } &lt;/pre&gt;&lt;p&gt;This program can tell you if your loan request is approved or not. It uses another object &lt;i&gt;PersonalLoanValidator&lt;/i&gt;  to decide if the loan request is valid or not. The &lt;i&gt;PersonalLoanValidator&lt;/i&gt;  just checks to see if the balance is more than 1000 and approves the loan or else rejects it.&lt;/p&gt;&lt;p&gt;Listing 2 PersonalLoanValidator.java&lt;/p&gt;&lt;pre&gt;public class PersonalLoanValidator {  /** Creates a new instance of PersonalLoanValidator */  public PersonalLoanValidator() {  }   public boolean isValid(int balance) {   if(balance&gt;1000)    return true;   else    return false;  } } &lt;/pre&gt;&lt;h2&gt;Problem&lt;/h2&gt;&lt;p&gt;Do you see the problem with the above design? Probably yes. The &lt;i&gt;LoanRequestHandler &lt;/i&gt;object is strongly coupled with&lt;i&gt;PersonalLoanValidator&lt;/i&gt; object. What happens if the &lt;i&gt;LoanRequestHandler&lt;/i&gt; object should be used to verify a business loan. Certainly, your business logic to approve a business loan will be different and &lt;i&gt;PersonalLoanValidator&lt;/i&gt;  is not capable of handling this business logic.&lt;/p&gt;&lt;p&gt;One solution may to be add another method to the &lt;i&gt;PersonalLoanValidator&lt;/i&gt;  class to verify the business loan approval process. Also we need to modify the &lt;i&gt;LoanRequestHandler&lt;/i&gt; object with an if-else loop to apply different &lt;i&gt;Validator&lt;/i&gt; objects for personal loans and business loans. This means every time the bank decides to provide a different type of loan, we need to make change in the &lt;i&gt;LoanRequestHandler&lt;/i&gt;and &lt;i&gt;PersonalLoanValidator&lt;/i&gt;  objects.&lt;/p&gt;&lt;p&gt;This application is certainly not closed for modification. This is where the OCP comes into the picture. This application has violated the OCP and therefore it is not properly designed.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Single Responsibility principle [SRP]&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-weight: normal; font-size: medium; "&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;b&gt;&lt;pre&gt;  assignToSite(emp, site)  // procedural &lt;p&gt;&lt;/p&gt;   // OOP &lt;p&gt;&lt;/p&gt;   emp.assignToSite(site)   // OO variation 1 &lt;p&gt;&lt;/p&gt;   Or &lt;p&gt;&lt;/p&gt;   site.assignEmp(emp)    // OO variation 2 &lt;p&gt;&lt;/p&gt;   Or &lt;p&gt;&lt;/p&gt;   site.employeeList.add(emp)  // OO variation 3&lt;/pre&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial; font-size: 11px; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-5433139730802711988?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/5433139730802711988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/ood-principles.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5433139730802711988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5433139730802711988'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/ood-principles.html' title='OOD principles'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-6374358041343368997</id><published>2010-09-08T04:08:00.001-07:00</published><updated>2010-09-09T02:34:48.199-07:00</updated><title type='text'>Phase 2 protocol links</title><content type='html'>&lt;div&gt;Truly great article : Mike Spille&lt;/div&gt;&lt;div&gt;http://jroller.com/pyrasun/category/XA&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;http://en.wikipedia.org/wiki/Two_phase_commit&lt;/div&gt;&lt;div&gt;http://www.aurorainfo.com/wp4/index.htm#18&lt;/div&gt;&lt;div&gt;http://www.informit.com/articles/printerfriendly.aspx?p=351607&lt;/div&gt;&lt;div&gt;http://onjava.com/lpt/a/792&lt;/div&gt;&lt;div&gt;http://www.javabeat.net/qna/842-what-is-the-difference-between-jts-and-jta/&lt;/div&gt;&lt;div&gt;http://www.jroller.com/raible/entry/two_phase_commit_in_tomcat&lt;/div&gt;&lt;div&gt;http://static.raibledesigns.com/downloads/howto-tomcat-jotm.html&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Architecture stuff&lt;/div&gt;&lt;div&gt;--------------------&lt;/div&gt;&lt;div&gt;&lt;div&gt;http://www.rationalrose.com/models/architectural_patterns.htm&lt;/div&gt;&lt;div&gt;http://handbookofsoftwarearchitecture.com/index.jsp?page=Main&lt;/div&gt;&lt;div&gt;http://hillside.net/&lt;/div&gt;&lt;div&gt;http://c2.com/cgi/wiki?TimeFrameProcessingArchitecture&lt;/div&gt;&lt;div&gt;http://sourcemaking.com/design_patterns&lt;/div&gt;&lt;div&gt;http://www.oodesign.com/open-close-principle.html&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-6374358041343368997?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/6374358041343368997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/phase-2-protocol-links.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/6374358041343368997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/6374358041343368997'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/phase-2-protocol-links.html' title='Phase 2 protocol links'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-2447602831331810098</id><published>2010-09-05T22:43:00.000-07:00</published><updated>2010-09-05T22:53:53.959-07:00</updated><title type='text'>JNLP web start</title><content type='html'>&lt;div&gt;I found one very nice resource over web by mkyong.&lt;/div&gt;&lt;a href="http://www.mkyong.com/java/java-web-start-jnlp-tutorial-unofficial-guide/"&gt;http://www.mkyong.com/java/java-web-start-jnlp-tutorial-unofficial-guide/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-2447602831331810098?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/2447602831331810098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/jnlp-web-start.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2447602831331810098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2447602831331810098'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/jnlp-web-start.html' title='JNLP web start'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-7594347927637322993</id><published>2010-09-03T05:04:00.001-07:00</published><updated>2010-09-03T05:18:27.867-07:00</updated><title type='text'>Design priciple from "Better fast lighter java"</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: verdana, sans-serif; font-size: 11px; "&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;Not all requirements can or should &lt;a name="bfljava-CHP-6-ITERM-884"&gt;&lt;/a&gt;&lt;a name="bfljava-CHP-6-ITERM-885"&gt;&lt;/a&gt;&lt;a name="simple software"&gt;&lt;/a&gt;be anticipated. Building simple software often means waiting to incorporate future requirements until they're needed. You don't have to completely write off the future, though. By making good decisions, you can make it easy to extend your frameworks in ways you might not have originally intended. You do so by following good design principles:&lt;/p&gt;&lt;a name="bfljava-CHP-6-ITERM-886"&gt;&lt;/a&gt;&lt;a name="bfljava-CHP-6-ITERM-887"&gt;&lt;/a&gt;&lt;a name="bfljava-CHP-6-ITERM-888"&gt;&lt;/a&gt;&lt;dl class="docList" style="font-family: verdana, sans-serif; color: black; font-size: 12px; "&gt;&lt;dt&gt;&lt;br /&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 11px; line-height: 1.2em; "&gt;&lt;i&gt;&lt;span class="docPubcolor" style="color: rgb(53, 66, 120); "&gt;&lt;a name="with the"&gt;&lt;/a&gt;Expose the right methods, with the right granularity&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="should be"&gt;&lt;/a&gt;Methods should be fine-grained and &lt;a name="bfljava-CHP-6-ITERM-886"&gt;&lt;/a&gt;&lt;a name="handle a"&gt;&lt;/a&gt;handle a single concept. If your methods bundle up too many concepts, you won't be able to extend the class by overriding the method.&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;br /&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 11px; line-height: 1.2em; "&gt;&lt;i&gt;&lt;span class="docPubcolor" style="color: rgb(53, 66, 120); "&gt;Use Java interfaces&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="Java interfaces"&gt;&lt;/a&gt;Providing general Java interfaces &lt;a name="bfljava-CHP-6-ITERM-887"&gt;&lt;/a&gt;&lt;a name="bfljava-CHP-6-ITERM-888"&gt;&lt;/a&gt;&lt;a name="the interface"&gt;&lt;/a&gt;separates the interface from implementation details. If you see a service or capability that's buried in a class definition, break it out into a separate interface.&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;br /&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 11px; line-height: 1.2em; "&gt;&lt;i&gt;&lt;span class="docPubcolor" style="color: rgb(53, 66, 120); "&gt;&lt;a name="coupling between"&gt;&lt;/a&gt;Loosen coupling between key concepts&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="good Java"&gt;&lt;/a&gt;This concept always comes up in good Java programming books for a reason. It works.&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;br /&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 11px; line-height: 1.2em; "&gt;&lt;i&gt;&lt;span class="docPubcolor" style="color: rgb(53, 66, 120); "&gt;&lt;a name="and simple"&gt;&lt;/a&gt;Keep designs clear and simple&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="and understand"&gt;&lt;/a&gt;Code that's hard to read and understand will be hard to extend.&lt;/p&gt;&lt;/dd&gt;&lt;dt&gt;&lt;br /&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 11px; line-height: 1.2em; "&gt;&lt;i&gt;&lt;span class="docPubcolor" style="color: rgb(53, 66, 120); "&gt;&lt;a name="code under"&gt;&lt;/a&gt;Publish the code under an open source license&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;&lt;/dt&gt;&lt;dd&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="source that"&gt;&lt;/a&gt;An application with source that can be examined and modified is much easier to extend then a closed-source application.&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-7594347927637322993?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/7594347927637322993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/design-priciple-from-better-fast.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/7594347927637322993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/7594347927637322993'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/09/design-priciple-from-better-fast.html' title='Design priciple from &quot;Better fast lighter java&quot;'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-5621910031466481095</id><published>2010-08-29T06:13:00.000-07:00</published><updated>2010-08-29T06:46:55.254-07:00</updated><title type='text'>Visitor pattern</title><content type='html'>&lt;span class="Apple-style-span"  style=" color: rgb(51, 51, 51); line-height: 24px; font-family:Georgia, 'Lucida Bright', 'Times New Roman', serif;"&gt;&lt;div&gt;Visitor Pattern :&lt;/div&gt;&lt;div&gt;-----------------------&lt;/div&gt;&lt;div&gt;From &lt;span class="Apple-style-span"   style="color: rgb(109, 114, 136);  line-height: normal;  font-family:verdana, sans-serif;font-size:17px;"&gt;&lt;span class="Apple-style-span"  style="color: rgb(0, 0, 0);  font-weight: bold; line-height: 12px; font-size:10px;"&gt;&lt;a href="http://techbus.safaribooksonline.com/0-201-48539-7" title="Java™ Design Patterns: A Tutorial" style="text-decoration: underline; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 51, 153); "&gt;Java™ Design Patterns: A Tutorial&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="color: rgb(109, 114, 136);  line-height: normal;  font-family:verdana, sans-serif;font-size:17px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="color: rgb(109, 114, 136);  line-height: normal;  font-family:verdana, sans-serif;font-size:17px;"&gt;&lt;span class="Apple-style-span"  style="color: rgb(0, 0, 0);  font-weight: bold; line-height: 12px; font-size:10px;"&gt;&lt;a href="http://techbus.safaribooksonline.com/0-201-48539-7" title="Java™ Design Patterns: A Tutorial" style="text-decoration: underline; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 51, 153); "&gt;&lt;/a&gt;&lt;/span&gt;When to Use the Visitor Pattern&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);  line-height: normal;  font-family:verdana, sans-serif;font-size:11px;"&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="You should"&gt;&lt;/a&gt;You should consider using a Visitor pattern when you want to perform an operation on the data contained in a number of objects that have different interfaces. Visitors are also valuable if you must perform a number of unrelated operations on these classes. Visitors are a useful way to add function to class libraries or frameworks for which you either do not have the source or cannot change thesource for other technical (or political) reasons. In these latter cases, you simply subclass the classes of the framework and add the &lt;span class="docEmphasis" style="font-style: italic; "&gt;accept&lt;/span&gt;&lt;a name="each subclass"&gt;&lt;/a&gt; method to each subclass.&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 0);  line-height: normal;  font-family:verdana, sans-serif;font-size:11px;"&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;Let's consider a simple subset of the Employee problem discussed in the Composite pattern. We have a simple Employee object that maintains a record of the employee's name, salary, number of vacation days taken, and number of sick days taken. A simple version of this class is the following:&lt;/p&gt;&lt;div class="docText" style="font-family: verdana, sans-serif; color: black; font-size: 12px; "&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;span class="Apple-style-span" style="line-height: 14px; "&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;public class Employee {     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;private int       &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;sickDays, vacDays;     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;private float     Salary;     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;private String    Name;      &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;public Employee(String name, float salary, int vacdays,&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;int sickdays) &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;{         &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;vacDays = vacdays;         &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;sickDays = sickdays;         &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Salary = salary         &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Name = name;     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;}     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;public String getName() {         &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;return Name;     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;}     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;public int getSickdays() {         &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;return sickDays;     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;}    &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;public int getVacDays() {         &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;return vacDays;     }     &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;public float getSalary() {         return Salary;     }    &lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;public void accept(Visitor v) {         v.visit(this);     }&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;} &lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="codeSegmentsExpansionLinks"&gt;&lt;span class="Apple-style-span" style="line-height: 14px; "&gt;Note that we have included the &lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: 14px; "&gt;&lt;span class="docEmphasis" style="font-style: italic; "&gt;accept&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: 14px; "&gt;&lt;a name="in this"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: 14px; "&gt; method in this class. Now let's suppose that we want to prepare a report of the number of vacation days that all employees have taken so far this year. We could just write some code in the client to sum the results of calls to each Employee's &lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: 14px; "&gt;&lt;span class="docEmphasis" style="font-style: italic; "&gt;getVacDays&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: 14px; "&gt;&lt;a name="we could"&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="line-height: 14px; "&gt;function, or we could put this function into a Visitor.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="our base"&gt;&lt;/a&gt;Since Java is a strongly typed language, our base Visitor class needs to have a suitable abstract &lt;span class="docEmphasis" style="font-style: italic; "&gt;visit&lt;/span&gt;&lt;a name="kind of"&gt;&lt;/a&gt; method for each kind of class in the program. In the following first example of our basic abstract visitor class, we have only Employees.&lt;/p&gt;&lt;div class="docText" style="font-family: verdana, sans-serif; color: black; font-size: 12px; "&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;public abstract class Visitor {     &lt;/pre&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;public abstract void visit(Employee emp);     &lt;/pre&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;public abstract void visit(Boss emp); &lt;/pre&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;} &lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="no indication"&gt;&lt;/a&gt;Notice that there is no indication what the Visitor does with each class in either the client classes or the abstract Visitor class. We can in fact write a whole lot of Visitors that do different things to the classes in our program. The first Visitor that we write sums the vacation data for all employees.&lt;/p&gt;&lt;div class="docText" style="font-family: verdana, sans-serif; color: black; font-size: 12px; "&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;public class VacationVisitor extends Visitor {     &lt;/pre&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;protected int total_days;     &lt;/pre&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;public VacationVisitor() {         total_days = 0;     }     //--------------     &lt;/pre&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;public void visit(Employee emp) {         total_days += emp.getVacDays();      }    //--------------     &lt;/pre&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;public void visit(Boss boss) {         total_days += boss.getVacDays();     }     //--------------     &lt;/pre&gt;&lt;pre style="color: rgb(0, 0, 102); font-family: 'Courier New', Courier, monospace; font-size: 12px; "&gt;public int getTotalDays() {         return total_days;     } }&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.java2s.com/Tutorial/Java/0460__Design-Pattern/Visitoratypeofmultipledispatching.htm"&gt;http://www.java2s.com/Tutorial/Java/0460__Design-Pattern/Visitoratypeofmultipledispatching.htm&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-5621910031466481095?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/5621910031466481095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/visitor-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5621910031466481095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5621910031466481095'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/visitor-pattern.html' title='Visitor pattern'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-4005057435210755087</id><published>2010-08-29T01:34:00.000-07:00</published><updated>2010-08-29T06:13:17.135-07:00</updated><title type='text'>Adaptor vs Bridge pattern</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Georgia, 'Lucida Bright', 'Times New Roman', serif; color: rgb(51, 51, 51); line-height: 24px; "&gt;&lt;h3 style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: Georgia, 'Lucida Bright', 'Times New Roman', serif; vertical-align: baseline; color: rgb(64, 64, 64); line-height: 1.2em; "&gt;&lt;a href="http://sourcemaking.com/design_patterns/adapter/java/2"&gt;http://sourcemaking.com/design_patterns/adapter/java/2&lt;/a&gt;&lt;/h3&gt;&lt;h3 style="margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: normal; font-style: inherit; font-size: 1.5em; font-family: Georgia, 'Lucida Bright', 'Times New Roman', serif; vertical-align: baseline; color: rgb(64, 64, 64); line-height: 1.2em; "&gt;Rules of thumb&lt;/h3&gt;&lt;a id="permalink-11" href="http://sourcemaking.com/design_patterns/adapter#permalink-11" title="Permalink to this place" class="permalink" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: -45px; padding-top: 0px; padding-right: 3px; padding-bottom: 0px; padding-left: 3px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: normal; font-size: 10px; font-family: Luicida, monospace; vertical-align: baseline; color: rgb(221, 221, 221); text-decoration: none; display: block; float: left; outline-width: 0px; outline-style: initial; outline-color: initial; "&gt;11&lt;/a&gt;&lt;ul class="addanchor" style="margin-top: 0px; margin-right: 0px; margin-bottom: 1.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 16px; font-family: inherit; vertical-align: baseline; list-style-type: none; list-style-position: outside; "&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1.5em; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 16px; font-family: inherit; vertical-align: baseline; background-image: url(http://sourcemaking.com/sites/all/themes/sm3/images/ild/dot.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 0.5em; background-repeat: no-repeat no-repeat; "&gt;Adapter makes things work after they’re designed; Bridge makes them work before they are.&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1.5em; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 16px; font-family: inherit; vertical-align: baseline; background-image: url(http://sourcemaking.com/sites/all/themes/sm3/images/ild/dot.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 0.5em; background-repeat: no-repeat no-repeat; "&gt;Bridge is designed up-front to let the abstraction and the implementation vary independently. Adapter is retrofitted to make unrelated classes work together.&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1.5em; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 16px; font-family: inherit; vertical-align: baseline; background-image: url(http://sourcemaking.com/sites/all/themes/sm3/images/ild/dot.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 0.5em; background-repeat: no-repeat no-repeat; "&gt;Adapter provides a different interface to its subject. Proxy provides the same interface. Decorator provides an enhanced interface.&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1.5em; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 16px; font-family: inherit; vertical-align: baseline; background-image: url(http://sourcemaking.com/sites/all/themes/sm3/images/ild/dot.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 0.5em; background-repeat: no-repeat no-repeat; "&gt;Adapter is meant to change the interface of an existing object. Decorator enhances another object without changing its interface. Decorator is thus more transparent to the application than an adapter is. As a consequence, Decorator supports recursive composition, which isn’t possible with pure Adapters.&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 1.5em; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: inherit; font-style: inherit; font-size: 16px; font-family: inherit; vertical-align: baseline; background-image: url(http://sourcemaking.com/sites/all/themes/sm3/images/ild/dot.gif); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: 0px 0.5em; background-repeat: no-repeat no-repeat; "&gt;Facade defines a new interface, whereas Adapter reuses an old interface. Remember that Adapter makes two existing interfaces work together as opposed to defining an entirely new one.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-4005057435210755087?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/4005057435210755087/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/adaptor-vs-bridge-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/4005057435210755087'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/4005057435210755087'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/adaptor-vs-bridge-pattern.html' title='Adaptor vs Bridge pattern'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-8243795443213761592</id><published>2010-08-26T01:02:00.000-07:00</published><updated>2010-08-26T04:23:32.699-07:00</updated><title type='text'>Ordered Message processing</title><content type='html'>&lt;div&gt;&lt;a href="http://forums.sun.com/thread.jspa?threadID=5337515"&gt;http://forums.sun.com/thread.jspa?threadID=5337515&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Get messages in to queue. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Check the version of message. If we receive (Out of sequence) higher version message ahead of original message, Then put same in Delay queue.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If we receive initial message then figure out all higher versions from delay queue and then process it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Resequencer :&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The Resequencer can receive a stream of messages that may not arrive in order. The Resequencer contains in internal buffer to store out-of-sequence messages until a complete sequence is obtained. The in-sequence messages are then published to the output channel. It is important that the output channel is order-preserving so messages are guaranteed to arrive in order at the next component. Like most other routers, a Resequencer usually does not modify the message contents.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;From internet:&lt;/div&gt;&lt;div&gt;----------------------&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The only way to ensure that messages are processed in the same order as they are created is to ensure you only have one Message Producer and one Message Consumer.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Basically the messages will only maintain the order they are put on and taken off the queue, after that its a bun fight as to which Message Consumer runs. If you worried about performance then the only solution is to have multiple message streams, it's probably easier if I give an example.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I once developed an Order processor that required each order for the same customer to be processed sequencially so I create 10 queues (you can have any number) with 10 Message Consumers, one bound to each queue. Unfortunately you can still only have one Message Producer which does a hash on the Customer Id to ensure that all the messages for same Customers went onto the same queue.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-8243795443213761592?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/8243795443213761592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/ordered-message-processing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/8243795443213761592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/8243795443213761592'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/ordered-message-processing.html' title='Ordered Message processing'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-8780006236202703004</id><published>2010-08-26T00:15:00.000-07:00</published><updated>2010-08-26T02:18:45.945-07:00</updated><title type='text'>Customised solution to include non-xa resource on phase 2 protocol [serverside.com]</title><content type='html'>&lt;span class="Apple-style-span"   style="  line-height: 15px; font-family:arial, verdana, helvetica, sans-serif;font-size:13px;"&gt;I got the following solution. I thought this custom solution is better than relying on app servers and different options provided by different&lt;br /&gt;app servers.&lt;br /&gt;&lt;br /&gt;Let us say you have a update method that updates multiple XA resources and one Non-XA resource, I want to commit all or none. I dont&lt;br /&gt;want my Non-XA resource to participate in global transaction, so I will create a method that will do updates to Non-XA resource&lt;br /&gt;and I use the transaction attribute "NotSupported" and I call this method from a method that particpates in transaction. See the&lt;br /&gt;following snippet to understand this.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/* It updates mutliple XA resources and one Non-XA resource. Transaction-attribute can be Requires, Requires-New, Mandatory */&lt;br /&gt;public void boolean update() throws Exception{&lt;br /&gt;boolean commit = true;&lt;br /&gt;try{&lt;br /&gt;commit = updateXA();&lt;br /&gt;if ( false == commit ){&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* It came here means, XA updates are successful */&lt;br /&gt;&lt;br /&gt;/* Now update Non-XA resource */&lt;br /&gt;commit = updateNonXA();&lt;br /&gt;}&lt;br /&gt;catch(Exception e){&lt;br /&gt;commit = false;&lt;br /&gt;throw e;&lt;br /&gt;}&lt;br /&gt;finally{&lt;br /&gt;if( !commit ){&lt;br /&gt;/*rollback the entire transaction that rolls back the resources that participated in transaction.&lt;br /&gt;&lt;br /&gt;In a way it rolls back XA updates if any&lt;br /&gt;&lt;br /&gt;No need to rollback Non-XA updates, if non-xa update went through successfully, we dont come here&lt;br /&gt;&lt;br /&gt;If Non-XA update is not done then we dont roll back its changes, we need only XA changes.*/&lt;br /&gt;ctx.rollbackOnly();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* Do updates to multiple XA resources here&lt;br /&gt;Transaction-attribute must be Mandatory or Requires(we know the caller is running in transaction ;) )*/&lt;br /&gt;public void boolean update() throws Exception{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/* Do updates to single Non-XA resources here&lt;br /&gt;Transaction-attribute must be NotSupported, It should ignore the global transaction */&lt;br /&gt;public void boolean update() throws Exception{&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 15px; font-family:arial, verdana, helvetica, sans-serif;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 15px; font-family:arial, verdana, helvetica, sans-serif;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 15px; font-family:arial, verdana, helvetica, sans-serif;font-size:13px;"&gt;Another good post from Mike&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 15px; font-family:arial, verdana, helvetica, sans-serif;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 15px; font-family:arial, verdana, helvetica, sans-serif;font-size:13px;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; "&gt;&lt;div class="postHeader" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;ul class="postMetaData" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; vertical-align: baseline; list-style-type: none; list-style-position: initial; list-style-image: initial; clear: both; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;li style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; display: inline; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;em style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; font-style: normal; color: rgb(153, 153, 153); text-transform: uppercase; background-position: initial initial; background-repeat: initial initial; "&gt;POSTED BY:&lt;/em&gt; &lt;a href="http://www.theserverside.com/user/userthreads.tss?user_id=2691331" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; text-decoration: none; color: rgb(46, 94, 141); background-position: initial initial; background-repeat: initial initial; "&gt;Mike Spille&lt;/a&gt;&lt;/li&gt; &lt;li style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; display: inline; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;em style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; font-style: normal; color: rgb(153, 153, 153); text-transform: uppercase; background-position: initial initial; background-repeat: initial initial; "&gt;POSTED ON:&lt;/em&gt; August 20 2003 09:55 EDT&lt;/li&gt; &lt;li style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; display: inline; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;a href="http://www.theserverside.com/discussions/thread.tss?thread_id=21014#93024" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; text-decoration: none; color: rgb(46, 94, 141); background-position: initial initial; background-repeat: initial initial; "&gt;in response to Timur Evdokimov&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="postContent" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; vertical-align: baseline; background-position: initial initial; background-repeat: initial initial; "&gt;XA does generally exact a performance penalty. In non-XA operations, typically there's only one commit that does any signficant amount of work - the RDBMS commit. In XA, you end up with each "Resource Manager" (JMS, RDBMS, etc) commiting, and the Transaction Manager (the app server) also having to keep track of transactions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In XA mode, the TM and each RM needs to have a transaction log, and typically the following happens:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   - App or container asks for commit&lt;br /&gt;&lt;br /&gt;   - Foreach Resource:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;      - Call resource prepare - results in "hardening" of data and a disk force&lt;br /&gt;&lt;br /&gt;   - If all resources voted "yes", TM writes a prepared record to its tran log (also a disk force)&lt;br /&gt;&lt;br /&gt;   - Foreach Resource:&lt;br /&gt;&lt;br /&gt;      - Call resource commit - results in a disk force and data is committed&lt;br /&gt;&lt;br /&gt;   - "soft write" by the TM that the commit is complete (e.g. write w/ no disk force).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you have two resources, such as your case (JMS and RDBMS), there are five disk forces involved (2 for JMS, 2 for RDBMS, 1 for TM).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The overhead will vary tremendously depending on the environment you're in and the products you're using, but it's often on the order of 50 milliseconds-100 milliseconds on average.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As an earlier thread on TSS indicated, on the JMS side not all JMS providers disk sync by default - they soft write without guaranteeing that data has been written to disk. This may be why you're not seeing as great of a performance hit - check your JMS providers' docs for details on "disk syncing" or "disk forcing" or "synchronized writes". Note also that some JMS providers don't use a transaction log at all, such as JBoss' JMS provider. And some JMS providers get it partially write - for example, one commercial JMS provider only durably records transactions for persistent messages, and (incorrectly) leaves transactions involving non-persistent messages hanging in the breeze.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For providers which have a log but don't disk force, a hard failure of the server (process or machine) can result in lost transactions. For providers which don't have transaction logs at all, the server can't preserve transactions across startup/shutdown of the JMS server at all.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On the TM side, Websphere versions 4.x and 5.x definitely involve a disk force when all resources are prepared. I don't remember what JBoss does.&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-8780006236202703004?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/8780006236202703004/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/customised-solution-to-include-non-xa.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/8780006236202703004'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/8780006236202703004'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/customised-solution-to-include-non-xa.html' title='Customised solution to include non-xa resource on phase 2 protocol [serverside.com]'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-2597267152619100448</id><published>2010-08-26T00:01:00.001-07:00</published><updated>2010-08-26T00:01:56.590-07:00</updated><title type='text'>Phase 2 protocol</title><content type='html'>&lt;a href="http://www.theserverside.com/discussions/thread.tss?thread_id=21385"&gt;http://www.theserverside.com/discussions/thread.tss?thread_id=21385&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial, verdana, helvetica, sans-serif; font-size: 13px; line-height: 15px; "&gt;&lt;div class="postHeader" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;h4 style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(239, 239, 239); border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 5px; padding-right: 10px; padding-bottom: 5px; padding-left: 10px; vertical-align: baseline; font-weight: bold; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;a name="95346" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; text-decoration: none; color: rgb(0, 0, 0); background-position: initial initial; background-repeat: initial initial; "&gt;XA and NonXA datasource&lt;/a&gt;&lt;span class="goToTop" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 10px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; float: right; font-weight: normal; position: relative; text-transform: uppercase; background-position: initial initial; background-repeat: initial initial; "&gt;[ &lt;a href="http://www.theserverside.com/discussions/thread.tss?thread_id=21385#95297" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 10px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; text-decoration: underline; color: rgb(0, 0, 0); background-position: initial initial; background-repeat: initial initial; "&gt;GO TO TOP&lt;/a&gt; ]&lt;/span&gt;&lt;/h4&gt;&lt;ul class="postMetaData" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 10px; vertical-align: baseline; list-style-type: none; list-style-position: initial; list-style-image: initial; clear: both; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;li style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; display: inline; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;em style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; font-style: normal; color: rgb(153, 153, 153); text-transform: uppercase; background-position: initial initial; background-repeat: initial initial; "&gt;POSTED BY:&lt;/em&gt; &lt;a href="http://www.theserverside.com/user/userthreads.tss?user_id=2691331" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; text-decoration: none; color: rgb(46, 94, 141); background-position: initial initial; background-repeat: initial initial; "&gt;Mike Spille&lt;/a&gt;&lt;/li&gt; &lt;li style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; display: inline; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;em style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; font-style: normal; color: rgb(153, 153, 153); text-transform: uppercase; background-position: initial initial; background-repeat: initial initial; "&gt;POSTED ON:&lt;/em&gt; September 11 2003 17:28 EDT&lt;/li&gt; &lt;li style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 10px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; display: inline; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;a href="http://www.theserverside.com/discussions/thread.tss?thread_id=21385#95297" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 11px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; vertical-align: baseline; text-decoration: none; color: rgb(46, 94, 141); background-position: initial initial; background-repeat: initial initial; "&gt;in response to Majic Robot&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="postContent" style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 13px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; vertical-align: baseline; background-position: initial initial; background-repeat: initial initial; "&gt;An XA transaction, in the most general terms, is a "global transaction" that may span multiple resources. A non-XA transaction always involves just one resource.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;An XA transaction involves a coordinating transaction manager, with one or more databases (or other resources, like JMS) all involved in a single global transaction. Non-XA transactions have no transaction coordinator, and a single resource is doing all its transaction work itself (this is sometimes called local transactions).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;XA transactions come from the X/Open group specification on distributed, global transactions. JTA includes the X/Open XA spec, in modified form.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Most stuff in the world is non-XA - a Servlet or EJB or plain old JDBC in a Java application talking to a single database. XA gets involved when you want to work with multiple resources - 2 or more databases, a database and a JMS connection, all of those plus maybe a JCA resource - all in a single transaction. In this scenario, you'll have an app server like Websphere or Weblogic or JBoss acting as the Transaction Manager, and your various resources (Oracle, Sybase, IBM MQ JMS, SAP, whatever) acting as transaction resources. Your code can then update/delete/publish/whatever across the many resources. When you say "commit", the results are commited across all of the resources. When you say "rollback", _everything_ is rolled back across all resources.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Transaction Manager coordinates all of this through a protocol called Two Phase Commit (2PC). This protocol also has to be supported by the individual resources.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In terms of datasources, an XA datasource is a data source that can participate in an XA global transaction. A non-XA datasource generally can't participate in a global transaction (sort of - some people implement what's called a "last participant" optimization that can let you do this for exactly one non-XA item).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For more details - see the JTA pages on java.sun.com. Look at the XAResource and Xid interfaces in JTA. See the X/Open XA Distributed Transaction specification. Do a google source on "Java JTA XA transaction".&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    -Mike&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-2597267152619100448?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/2597267152619100448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/phase-2-protocol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2597267152619100448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2597267152619100448'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/phase-2-protocol.html' title='Phase 2 protocol'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-2789342070238874834</id><published>2010-08-18T03:10:00.001-07:00</published><updated>2010-08-18T03:10:47.789-07:00</updated><title type='text'>Big O Notation very well explained</title><content type='html'>&lt;a href="http://www.perlmonks.org/?node_id=227909"&gt;http://www.perlmonks.org/?node_id=227909&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-2789342070238874834?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/2789342070238874834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/big-o-notation-very-well-explained.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2789342070238874834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2789342070238874834'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/big-o-notation-very-well-explained.html' title='Big O Notation very well explained'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-2795016901216301252</id><published>2010-08-17T06:33:00.000-07:00</published><updated>2010-08-17T07:44:52.288-07:00</updated><title type='text'>Defining Serializable Fields for a Clas</title><content type='html'>&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;From Other sources&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;a href="http://onjava.com/lpt/a/1184"&gt;http://onjava.com/lpt/a/1184&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;h3 style="font-size: medium; "&gt;How Serialization Detects When a Class Has Changed&lt;/h3&gt;&lt;p style="font-size: medium; "&gt;In order for serialization to gracefully detect when a versioning problem has occurred, it needs to be able to detect when a class has changed. As with all the other aspects of serialization, there is a default way that serialization does this. And there is a way for you to override the default.&lt;/p&gt;&lt;p style="font-size: medium; "&gt;The default involves a hashcode. Serialization creates a single hashcode, of type &lt;code&gt;long&lt;/code&gt;, from the following information:&lt;/p&gt;&lt;ul style="font-size: medium; "&gt;&lt;li&gt;The class name and modifiers&lt;/li&gt;&lt;li&gt;The names of any interfaces the class implements&lt;/li&gt;&lt;li&gt;Descriptions of all methods and constructors except &lt;code&gt;private&lt;/code&gt;methods and constructors&lt;/li&gt;&lt;li&gt;Descriptions of all fields except &lt;code&gt;private&lt;/code&gt;, &lt;code&gt;static&lt;/code&gt;, and &lt;code&gt;private transient&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;h3 style="font-family: 'Times New Roman'; "&gt;Serialization Depends on Reflection&lt;/h3&gt;&lt;p style="font-family: 'Times New Roman'; "&gt;The dependence on reflection is the hardest of these to eliminate. Both serializing and deserializing require the serialization mechanism to discover information about the instance it is serializing. At a minimum, the serialization algorithm needs to find out things such as the value of &lt;code&gt;serialVersionUID&lt;/code&gt;, whether &lt;code&gt;writeObject( )&lt;/code&gt;is implemented, and what the superclass structure is. What's more, using the default serialization mechanism, (or calling &lt;code&gt;defaultWriteObject( )&lt;/code&gt;from within &lt;code&gt;writeObject( )&lt;/code&gt;) will use reflection to discover all the field values. This can be quite slow.&lt;/p&gt;&lt;blockquote style="font-family: 'Times New Roman'; "&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;h3 style="font-size: medium; "&gt;Comparing Externalizable to Serializable&lt;/h3&gt;&lt;p style="font-size: medium; "&gt;Of course, this efficiency comes at a price. &lt;code&gt;Serializable&lt;/code&gt;can be frequently implemented by doing two things: declaring that a class implements the &lt;code&gt;Serializable&lt;/code&gt;interface and adding a zero-argument constructor to the class. Furthermore, as an application evolves, the serialization mechanism automatically adapts. Because the metadata is automatically extracted from the class definitions, application programmers often don't have to do anything except recompile the program.&lt;/p&gt;&lt;p style="font-size: medium; "&gt;On the other hand, &lt;code&gt;Externalizable&lt;/code&gt;isn't particularly easy to do, isn't very flexible, and requires you to rewrite your marshalling and demarshalling code whenever you change your class definitions. However, because it eliminates almost all the reflective calls used by the serialization mechanism and gives you complete control over the marshalling and demarshalling algorithms, it can result in dramatic performance improvements.&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Serialization Fields&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;Default serializable fields of a class are defined to be the non-transient and non-static fields. This default computation can be overridden by declaring a special field in the&lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;code&gt;Serializable&lt;/code&gt;&lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;class,&lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;code&gt;serialPersistentFields&lt;/code&gt;&lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;. This field must be initialized with an array of&lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;code&gt;ObjectStreamField&lt;/code&gt;&lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;objects that list the names and types of the serializable fields. The modifiers for the field are required to be private, static, and final.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'Times New Roman';font-size:medium;"&gt;&lt;p&gt;For example, the following declaration duplicates the default behavior.&lt;/p&gt;&lt;pre&gt;&lt;a name="6853"&gt; &lt;/a&gt;class List implements Serializable {     List next;      private static final ObjectStreamField[] serialPersistentFields                  = {new ObjectStreamField("next", List.class)}; &lt;a name="6854"&gt; &lt;/a&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;In this section, I describe a slightly simplified version of the serialization algorithm. I then proceed to a more complete description of the serialization process in the next section.&lt;/p&gt;&lt;h4 style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;&lt;a name="h413"&gt;&lt;/a&gt;Writing&lt;/h4&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;Because the class descriptions actually contain the metadata, the basic idea behind the serialization algorithm is pretty easy to describe. The only tricky part is handling circular references.&lt;/p&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;The problem is this: suppose instance &lt;code&gt;A&lt;/code&gt;refers to instance &lt;code&gt;B&lt;/code&gt;. And instance &lt;code&gt;B&lt;/code&gt;refers back to instance &lt;code&gt;A&lt;/code&gt;. Completely writing out &lt;code&gt;A&lt;/code&gt;requires you to write out &lt;code&gt;B&lt;/code&gt;. But writing out &lt;code&gt;B&lt;/code&gt;requires you to write out &lt;code&gt;A&lt;/code&gt;. Because you don't want to get into an infinite loop, or even write out an instance or a class description more than once you need to keep track of what's already been written to the stream. (Serialization is a slow process that uses the reflection API quite heavily in addition to the bandwidth)&lt;/p&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;&lt;code&gt;ObjectOutputStream&lt;/code&gt;does this by maintaining a mapping from instances and classes to handles. When &lt;code&gt;writeObject( )&lt;/code&gt;is called with an argument that has already been written to the stream, the handle is written to the stream, and no further operations are necessary.&lt;/p&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;If, however, &lt;code&gt;writeObject( )&lt;/code&gt;is passed an instance that has not yet been written to the stream, two things happen. First, the instance is assigned a reference handle, and the mapping from instance to reference handle is stored by &lt;code&gt;ObjectOutputStream&lt;/code&gt;. The handle that is assigned is the next integer in a sequence.&lt;/p&gt;&lt;blockquote style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;&lt;p&gt;&lt;b&gt;TIP:&lt;/b&gt;   Remember the &lt;code&gt;reset( )&lt;/code&gt;method on &lt;code&gt;ObjectOutputStream&lt;/code&gt;? It clears the mapping and resets the handle counter to 0x7E0000 .RMI also automatically resets its serialization mechanism after every remote method call.&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;Second, the instance data is written out as per the data format described earlier. This can involve some complications if the instance has a field whose value is also a serializable instance. In this case, the serialization of the first instance is suspended, and the second instance is serialized in its place (or, if the second instance has already been serialized, the reference handle for the second instance is written out). After the second instance is fully serialized, serialization of the first instance resumes. The contents of the stream look a little bit like Figure 10-5.&lt;/p&gt;&lt;table width="273" cellpadding="0" cellspacing="10" style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;p class="tiny"&gt;&lt;img src="http://onjava.com/onjava/excerpt/JavaRMI_10/graphics/rmi_1005.gif" width="273" height="261" border="0" alt="Diagram." /&gt;&lt;br /&gt;Figure 10-5. Contents of Serialization's data stream.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h4 style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;&lt;a name="h413"&gt;&lt;/a&gt;Reading&lt;/h4&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;From the description of writing, it's pretty easy to guess most of what happens when &lt;code&gt;readObject( )&lt;/code&gt;is called. Unfortunately, because of versioning issues, the implementation of &lt;code&gt;readObject( )&lt;/code&gt;is actually a little bit more complex than you might guess.&lt;/p&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;When it reads in an instance description, &lt;code&gt;ObjectInputStream&lt;/code&gt;gets the following information:&lt;/p&gt;&lt;ul style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;&lt;li&gt;Descriptions of all the classes involved&lt;/li&gt;&lt;li&gt;The serialization data from the instance&lt;/li&gt;&lt;/ul&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;The problem is that the class descriptions that the instance of &lt;code&gt;ObjectInputStream&lt;/code&gt;reads from the stream may not be equivalent to the class descriptions of the same classes in the local JVM. For example, if an instance is serialized to a file and then read back in three years later, there's a pretty good chance that the class definitions used to serialize the instance have changed.&lt;/p&gt;&lt;p style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;This means that &lt;code&gt;ObjectInputStream&lt;/code&gt;uses the class descriptions in two ways:&lt;/p&gt;&lt;ul style="font-family: 'Times New Roman'; white-space: normal; font-size: medium; "&gt;&lt;li&gt;It uses them to actually pull data from the stream, since the class descriptions completely describe the contents of the stream.&lt;/li&gt;&lt;li&gt;It compares the class descriptions to the classes it has locally and tries to determine if the classes have changed, in which case it throws an exception. If the class descriptions match the local classes, it creates the instance and sets the instance's state appropriately.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="white-space: normal; font-size:medium;"&gt;&lt;span class="Apple-style-span"   style=" -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;  font-family:Verdana, Arial, Helvetica;font-size:small;"&gt;&lt;p&gt;&lt;span class="Apple-style-span"  style="font-family:monospace;"&gt;&lt;span class="Apple-style-span" style=" white-space: pre;"&gt;&lt;span class="Apple-style-span"  style="font-family:Verdana, Arial, Helvetica;"&gt;&lt;span class="Apple-style-span" style=" white-space: normal;"&gt;&lt;b&gt;&lt;u&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;ReadResolve and ReadReplace&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="Apple-style-span"   style=" white-space: normal;  -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family:Verdana, Arial, Helvetica;font-size:small;"&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;color:black;"&gt;One way of eliminating the extra instances and some of the unnecessary heap allocation would be to do something like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;pre&gt;&lt;span style="color:black;"&gt;public class Gender implements Serializable {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;public final static Gender MALE&lt;span style="mso-spacerun:yes"&gt;   &lt;/span&gt;= new Gender("Male");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;public final static Gender FEMALE = new Gender("Female");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;private String name;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;private Gender(String name) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;this.name = name;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;Object writeReplace() throws ObjectStreamException {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;if (this.equals(MALE)) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;      &lt;/span&gt;return SerializedForm.MALE_FORM;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;} else {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;      &lt;/span&gt;return SerializedForm.FEMALE_FORM;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;private static class SerializedForm implements Serializable {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;final static SerializedForm MALE_FORM&lt;span style="mso-spacerun:yes"&gt;   &lt;/span&gt;= new SerializedForm(0);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;final static SerializedForm FEMALE_FORM = new SerializedForm(1);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;private int value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;SerializedForm(int value) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;      &lt;/span&gt;this.value = value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;Object readResolve() throws ObjectStreamException {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;      &lt;/span&gt;if (value == MALE_FORM.value) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;        &lt;/span&gt;return Gender.MALE;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;      &lt;/span&gt;} else {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;        &lt;/span&gt;return Gender.FEMALE;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;      &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="color:black;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span style=" ;font-family:Verdana;color:black;"&gt;This also guarantees that in all cases where&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:Verdana;color:black;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;tt&gt;&lt;span style="font-size:10.0pt;color:black;"&gt;genderInstance.equals(MALE)&lt;/span&gt;&lt;/tt&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:Verdana;color:black;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:Verdana;color:black;"&gt;is true,&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:Verdana;color:black;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;tt&gt;&lt;span style="font-size:10.0pt;color:black;"&gt;genderInstance == Gender.MALE&lt;/span&gt;&lt;/tt&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="font-family:Verdana;color:black;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="font-family:Verdana;color:black;"&gt;is also true.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-2795016901216301252?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/2795016901216301252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/defining-serializable-fields-for-clas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2795016901216301252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2795016901216301252'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/defining-serializable-fields-for-clas.html' title='Defining Serializable Fields for a Clas'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-7969981153130770263</id><published>2010-08-16T05:26:00.001-07:00</published><updated>2010-08-16T05:26:41.077-07:00</updated><title type='text'>Nice blog</title><content type='html'>&lt;a href="http://biese.wordpress.com/2006/10/30/54/"&gt;http://biese.wordpress.com/2006/10/30/54/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-7969981153130770263?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/7969981153130770263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/nice-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/7969981153130770263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/7969981153130770263'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/nice-blog.html' title='Nice blog'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-5991111156513331850</id><published>2010-08-16T02:45:00.001-07:00</published><updated>2010-08-16T02:55:55.327-07:00</updated><title type='text'>jax-rpc vs jax-ws</title><content type='html'>&lt;div&gt;JAX-WS&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;JAX-WS 2.0 is the successor of JAX-RPC 1.1 - the Java API for XML-based Web services. If possible, JAX-WS should be used instead as it is based on the most recent industry standards.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What remains the same?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Before we itemize the differences between JAX-RPC 1.1 and JAX-WS 2.0, we should first discuss what is the same.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* JAX-WS still supports SOAP 1.1 over HTTP 1.1, so interoperability will not be affected. The same messages can still flow across the wire.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* JAX-WS still supports WSDL 1.1, so what you've learned about that specification is still useful. A WSDL 2.0 specification is nearing completion, but it was still in the works at the time that JAX-WS 2.0 was finalized.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What is different?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Jax-RPC is generated at static time where as Jax-ws is dynamic&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* SOAP 1.2&lt;/div&gt;&lt;div&gt;JAX-RPC and JAX-WS support SOAP 1.1. JAX-WS also supports SOAP 1.2.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* XML/HTTP&lt;/div&gt;&lt;div&gt;The WSDL 1.1 specification defined an HTTP binding, which is a means by which you can send XML messages over HTTP without SOAP. JAX-RPC ignored the HTTP binding. JAX-WS adds support for it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* WS-I's Basic Profiles&lt;/div&gt;&lt;div&gt;JAX-RPC supports WS-I's Basic Profile (BP) version 1.0. JAX-WS supports BP 1.1. (WS-I is the Web services interoperability organization.)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* New Java features&lt;/div&gt;&lt;div&gt;o JAX-RPC maps to Java 1.4. JAX-WS maps to Java 5.0. JAX-WS relies on many of the features new in Java 5.0.&lt;/div&gt;&lt;div&gt;o Java EE 5, the successor to J2EE 1.4, adds support for JAX-WS, but it also retains support for JAX-RPC, which could be confusing to today's Web services novices.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* The data mapping model&lt;/div&gt;&lt;div&gt;o JAX-RPC has its own data mapping model, which covers about 90 percent of all schema types. Those that it does not cover are mapped to javax.xml.soap.SOAPElement.&lt;/div&gt;&lt;div&gt;o JAX-WS's data mapping model is JAXB. JAXB promises mappings for all XML schemas.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* The interface mapping model&lt;/div&gt;&lt;div&gt;JAX-WS's basic interface mapping model is not extensively different from JAX-RPC's; however:&lt;/div&gt;&lt;div&gt;o JAX-WS's model makes use of new Java 5.0 features.&lt;/div&gt;&lt;div&gt;o JAX-WS's model introduces asynchronous functionality.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* The dynamic programming model&lt;/div&gt;&lt;div&gt;o JAX-WS's dynamic client model is quite different from JAX-RPC's. Many of the changes acknowledge industry needs:&lt;/div&gt;&lt;div&gt;+ It introduces message-oriented functionality.&lt;/div&gt;&lt;div&gt;+ It introduces dynamic asynchronous functionality.&lt;/div&gt;&lt;div&gt;o JAX-WS also adds a dynamic server model, which JAX-RPC does not have.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* MTOM (Message Transmission Optimization Mechanism)&lt;/div&gt;&lt;div&gt;JAX-WS, via JAXB, adds support for MTOM, the new attachment specification. Microsoft never bought into the SOAP with Attachments specification; but it appears that everyone supports MTOM, so attachment interoperability should become a reality.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;* The handler model&lt;/div&gt;&lt;div&gt;o The handler model has changed quite a bit from JAX-RPC to JAX-WS.&lt;/div&gt;&lt;div&gt;o JAX-RPC handlers rely on SAAJ 1.2. JAX-WS handlers rely on the new SAAJ 1.3 specification.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-5991111156513331850?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/5991111156513331850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/jax-rpc-vs-jax-ws.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5991111156513331850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5991111156513331850'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/jax-rpc-vs-jax-ws.html' title='jax-rpc vs jax-ws'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-3801190245861381525</id><published>2010-08-12T03:37:00.000-07:00</published><updated>2010-08-12T03:42:51.241-07:00</updated><title type='text'>Grid computing vs clouding computing</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Helvetica; color: rgb(65, 65, 65); font-size: 12px; font-weight: bold; line-height: 15px; "&gt;&lt;p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(65, 65, 65); font: normal normal normal 1.25em/1.4em Helvetica; background-position: initial initial; background-repeat: initial initial; "&gt;Grids and current Clouds so far:&lt;br /&gt;- Grid systems are designed for collaborative sharing of resources belonging to different admin domains, while Clouds at the moment expose the resources of one domain to the outside world&lt;br /&gt;- Grid systems support the execution of end-users applications as computational activities; a typical computational activity once accepted by a Grid endpoint, is locally handled by a batch system as a batch job; Clouds are mainly used for the remote deployment of services&lt;br /&gt;– this is an important difference; Grids provide more domain-specific services; Clouds can sit below (the RightGrid can be a typical example of this)&lt;br /&gt;– Grids are moving towards the adoption of virtual machine tecnologies, but the usage pattern will be the same (the submitted job is bound with the execution environment as VM image)&lt;br /&gt;- Grid systems support large set of users organized in virtual organizations (credentials are typically enriched with VO-related information); Cloud systems support individual users (to my knowledge)&lt;/p&gt;&lt;p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(65, 65, 65); font: normal normal normal 1.25em/1.4em Helvetica; background-position: initial initial; background-repeat: initial initial; "&gt;I would not see the size of allocation as a factor for differentiating them.&lt;/p&gt;&lt;p style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 1em; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(65, 65, 65); font: normal normal normal 1.25em/1.4em Helvetica; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Georgia, 'Times New Roman', Times, serif; line-height: 23px; font-size: 14px; "&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; "&gt;ou know, a lot of people really get confused on cloud vs grid. The two are closely related. I always think about it in the terms of virtualization vs grid (since I work for VMware). Grid is great if you have an app that needs a lot of combined compute cycles. Virtualization is great if you have a lot of apps that need a little compute cycles each.&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; "&gt;Now enter cloud. Cloud really encompasses both of these. The point of cloud is you don’t have to care if you have a grid infrastructure underneath or a virtualization infrastruture underneath. All you do is deploy your app to the cloud and let the cloud figure out how to get the app the resources it needs.&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; "&gt;That’s why cloud is the over arching architecture for virtualization or grid or SaaS or PaaS or anything else. All of these can play in the cloud together at the same time. You build your cloud with these blocks as you see fit and based on what you want your cloud to do. Simple as that.&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-3801190245861381525?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/3801190245861381525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/grid-computing-vs-clouding-computing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/3801190245861381525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/3801190245861381525'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/grid-computing-vs-clouding-computing.html' title='Grid computing vs clouding computing'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-5417820863188071206</id><published>2010-08-11T20:13:00.000-07:00</published><updated>2010-08-11T21:09:33.139-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='garbage collection'/><title type='text'>Phantom references</title><content type='html'>&lt;div&gt;Nice article about phantom reference. It was mystery for me since long time.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; color: rgb(51, 51, 51); line-height: 18px; "&gt;&lt;b&gt;WeakReferences &lt;/b&gt;will be enqueued before object is really deleted and reference will become dead beside object stay alive.   Here  &lt;b&gt;PhantomReferences &lt;/b&gt;can help,  Phantom references are enqueued when objects are deleted from memory and &lt;i&gt;get()&lt;/i&gt; method always returns&lt;i&gt;null &lt;/i&gt;to prevent resurrecting object.  So  phantom references are good for determining exactly when object is deleted from memory.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://www.kdgregory.com/index.php?page=java.refobj"&gt;http://www.kdgregory.com/index.php?page=java.refobj&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-5417820863188071206?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/5417820863188071206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/phantom-references.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5417820863188071206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/5417820863188071206'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/phantom-references.html' title='Phantom references'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-2306123919380854682</id><published>2010-08-11T04:17:00.000-07:00</published><updated>2010-08-11T04:18:04.310-07:00</updated><title type='text'>Architectural Decisions</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: verdana, sans-serif; font-size: 11px; "&gt;&lt;h2 class="docSidebarTitle" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 13px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; text-align: center; "&gt;JAD Checklist&lt;/h2&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="iddle1506"&gt;&lt;/a&gt;&lt;a name="iddle2053"&gt;&lt;/a&gt;&lt;a name="is a"&gt;&lt;/a&gt;Here is a quick checklist for how to conduct the JAD sessions to ensure you do not skip any of the most important steps. As you feel more comfortable with this process, feel free to modify this and create your own JAD checklist for your organization to follow:&lt;/p&gt;&lt;div style="font-weight: bold; "&gt;&lt;ol class="docList" type="1" style="font-family: verdana, sans-serif; color: black; font-size: 12px; "&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;Assign participants.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="operations engineer"&gt;&lt;/a&gt;Mandatory. Software engineer, architect, operations engineer (database administrator, systems administrator, and/or network engineer).&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;Optional. Product manager, project manager, quality assurance engineer.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="by component"&gt;&lt;/a&gt;Schedule one or more sessions. Divide sessions by component if possible: database, server, cache, storage, etc.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="by covering"&gt;&lt;/a&gt;Start the session by covering the specifications.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="related to"&gt;&lt;/a&gt;Review the architectural principles related to this session’s component.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="need for"&gt;&lt;/a&gt;Brainstorm approaches. No need for complete detail.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="cons of"&gt;&lt;/a&gt;List pros and cons of each approach.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="multiple sessions"&gt;&lt;/a&gt;If multiple sessions are needed, have someone write down all the ideas and send around to the group.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="Arrive at"&gt;&lt;/a&gt;Arrive at consensus for the design. Use voting, rating, ranking, or any other decision technique that everyone can support.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style="font-weight: normal; "&gt;&lt;p class="docList" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="final documentation"&gt;&lt;/a&gt;Create the final documentation of the design in preparation for the ARB.&lt;/p&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="afraid to"&gt;&lt;/a&gt;Don’t be afraid to modify this checklist as necessary for your organization.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-2306123919380854682?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/2306123919380854682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/architectural-decisions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2306123919380854682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2306123919380854682'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/architectural-decisions.html' title='Architectural Decisions'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-2013481931284942802</id><published>2010-08-11T04:12:00.001-07:00</published><updated>2010-08-11T04:13:19.243-07:00</updated><title type='text'>Architectural Principles</title><content type='html'>&lt;span class="Apple-style-span"   style="  ;font-family:verdana, sans-serif;font-size:11px;"&gt;&lt;h3 class="docSection1Title" id="-100000" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 17px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt; Twelve Architectural Principles&lt;/h3&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="iddle1211"&gt;&lt;/a&gt;&lt;a name="iddle1213"&gt;&lt;/a&gt;&lt;a name="iddle2269"&gt;&lt;/a&gt;&lt;a name="iddle2572"&gt;&lt;/a&gt;&lt;a name="In this"&gt;&lt;/a&gt;In this section, we introduce twelve architectural principles. Many times after engagements, we will “seed” the architectural principle gardens of our clients with our twelve principles and then ask them to run their own process, taking as many of ours as they would like, discarding any that do not work for them, and adding as many as they would like. We only ask that they let us know what they are considering so that we can modify our principles over time if they come up with an especially ingenious or useful principle. The Venn diagram shown in &lt;a class="docLink" href="http://techbus.safaribooksonline.com/9780137031436/firstchapter" style="text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 33, 123); "&gt;Figure 12.3&lt;/a&gt;&lt;a name="principles as"&gt;&lt;/a&gt; depicts our principles as they relate to scalability, availability, and cost. We will discuss each of the principles at a high level and then dig more deeply into those that are identified as having an impact on scalability.&lt;/p&gt;&lt;a name="ch12fig03"&gt;&lt;/a&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 11px; line-height: 1.2em; "&gt;&lt;/p&gt;&lt;center&gt;&lt;h5 class="docFigureTitle" style="font-family: verdana, sans-serif; color: rgb(0, 0, 102); font-size: 12px; font-weight: bold; "&gt;&lt;a name="AKF Architecture"&gt;&lt;/a&gt;Figure 12.3. AKF Architecture Principles&lt;/h5&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;/p&gt;&lt;div class="st1" style="font-family: verdana, sans-serif; color: rgb(51, 51, 204); text-decoration: none; font-size: 9px; "&gt;&lt;a target="_blank" href="http://techbus.safaribooksonline.com/getfile?item=MC84YWRyN2VhcC90YzA5bWlnNDNncjYxczE3LzMzMC5nYnBpaXRnY19zaF9mYmFvYWxqcHRfdDEtLzIz" style="text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 51, 153); "&gt;[View full size image]&lt;/a&gt;&lt;/div&gt;&lt;img border="0" id="" width="500" height="376" src="http://techbus.safaribooksonline.com/getfile?item=MC84YWRyN2VhcC90YzA5bWlnNDNncjYxczE3LzMzMGdicGlpdGNfaHNmX2JvYWpwLmd0MS0vMjM-" alt="" /&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 11px; line-height: 1.2em; "&gt;&lt;/p&gt;&lt;/center&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 11px; line-height: 1.2em; "&gt;&lt;/p&gt;&lt;br /&gt;&lt;a name="ch12lev2sec1"&gt;&lt;/a&gt;&lt;h4 id="title-ID0EMKAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;N+1 Design&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="this principle"&gt;&lt;/a&gt;Simply stated, this principle is the need to ensure that anything you develop has at least one additional instance of that system in the event of failure. Apply the &lt;span class="docEmphasis" style="font-style: italic; "&gt;rule of three&lt;/span&gt; that we will discuss in &lt;a class="docLink" href="http://techbus.safaribooksonline.com/9780137031436/ch32#ch32" style="text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 33, 123); "&gt;Chapter 32&lt;/a&gt;&lt;a name="call"&gt;&lt;/a&gt;, Planning Data Centers, or what we sometimes call &lt;span class="docEmphasis" style="font-style: italic; "&gt;&lt;a name="build one"&gt;&lt;/a&gt;ensuring that you build one for you, one for the customer, and one to fail&lt;/span&gt;&lt;a name="for everything"&gt;&lt;/a&gt;. This principle holds true for everything from large data center design to Web Services implementations.&lt;/p&gt;&lt;a name="ch12lev2sec2"&gt;&lt;/a&gt;&lt;h4 id="title-ID0ECLAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Design for Rollback&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="iddle1200"&gt;&lt;/a&gt;&lt;a name="iddle1204"&gt;&lt;/a&gt;&lt;a name="iddle1212"&gt;&lt;/a&gt;&lt;a name="iddle1287"&gt;&lt;/a&gt;&lt;a name="iddle1483"&gt;&lt;/a&gt;&lt;a name="iddle1773"&gt;&lt;/a&gt;&lt;a name="iddle1774"&gt;&lt;/a&gt;&lt;a name="iddle2563"&gt;&lt;/a&gt;&lt;a name="iddle2564"&gt;&lt;/a&gt;&lt;a name="iddle2829"&gt;&lt;/a&gt;&lt;a name="a critical"&gt;&lt;/a&gt;This is a critical principle for Web services, Web 2.0, or Software as a Service (SaaS) companies. Whatever you build, ensure that it is backward compatible. Make sure that you can roll it back if you find yourself in a position of spending too much time “fixing forward.” Some companies will indicate that they can roll back within a specific window of time, say the first couple of hours. Unfortunately, some of the worst and most disastrous failures don’t show up for a few days, especially when those failures have to do with customer data corruption. In the ideal case, you will also design to allow something to be rolled, pushed, or deployed while your product or platform is still “live.” The rollback process will be covered in more detail in&lt;a class="docLink" href="http://techbus.safaribooksonline.com/9780137031436/ch18#ch18" style="text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 33, 123); "&gt;Chapter 18&lt;/a&gt;, Barrier Conditions and Rollback.&lt;/p&gt;&lt;a name="ch12lev2sec3"&gt;&lt;/a&gt;&lt;h4 id="title-ID0EYOAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Design to Be Disabled&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="very risky"&gt;&lt;/a&gt;When designing systems, especially very risky systems that communicate to other systems or services, design them to be capable of being “marked down” or disabled. This may give you additional time to “fix forward” or ensure that you don’t go down as a result of a bug that introduces strange out of bounds demand characteristics on your system.&lt;/p&gt;&lt;a name="ch12lev2sec4"&gt;&lt;/a&gt;&lt;h4 id="title-ID0EDPAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Design to Be Monitored&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="iddle1198"&gt;&lt;/a&gt;&lt;a name="iddle1207"&gt;&lt;/a&gt;&lt;a name="iddle1209"&gt;&lt;/a&gt;&lt;a name="iddle1216"&gt;&lt;/a&gt;&lt;a name="iddle1219"&gt;&lt;/a&gt;&lt;a name="iddle1230"&gt;&lt;/a&gt;&lt;a name="iddle2194"&gt;&lt;/a&gt;&lt;a name="iddle2228"&gt;&lt;/a&gt;&lt;a name="iddle2229"&gt;&lt;/a&gt;&lt;a name="iddle2260"&gt;&lt;/a&gt;&lt;a name="iddle2650"&gt;&lt;/a&gt;&lt;a name="discussed earlier"&gt;&lt;/a&gt;As we’ve discussed earlier in this book, systems should be designed from the ground up to be monitored. This goes beyond just applying agents to a system to monitor the utilization of CPU, memory, or disk I/O. It also goes beyond simply logging errors. You want your system to identify when it is performing differently than it normally operates in addition to telling you when it is not functioning properly.&lt;/p&gt;&lt;a name="ch12lev2sec5"&gt;&lt;/a&gt;&lt;h4 id="title-ID0ERSAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Design for Multiple Live Sites&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="Many companies"&gt;&lt;/a&gt;Many companies have disaster recovery centers with systems sitting mostly idle or used for QA until such time as they are needed. The primary issue with such solutions is that it takes a significant amount of time to fail over and validate the disaster recovery center in the event of a disaster. A better solution is to be serving traffic out of both sites live, such that the team is comfortable with the operation of both sites. Our rule of three applies here as well and in most cases you can operate three sites live at equal to or lower cost than the operation of a hot site and a cold disaster recovery site. We’ll discuss this topic in greater detail later in the chapter.&lt;/p&gt;&lt;a name="ch12lev2sec6"&gt;&lt;/a&gt;&lt;h4 id="title-ID0E3SAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Use Mature Technologies&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="are buying"&gt;&lt;/a&gt;When you are buying technology, use technology that is proven and that has already had the bugs worked out of it. There are many cases where you might be willing or interested in the vendor promised competitive edge that some new technology offers. Be careful here, because if you become an early adopter of software or systems, you will also be on the leading edge of finding all the bugs with that software or system. If availability and reliability are important to you and your customers, try to be an early majority or late majority adopter of those systems that are critical to the operations of your service, product, or platform.&lt;/p&gt;&lt;a name="ch12lev2sec7"&gt;&lt;/a&gt;&lt;h4 id="title-ID0EHTAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Asynchronous Design&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="systems should"&gt;&lt;/a&gt;Whenever possible, systems should communicate in an asynchronous fashion. Asynchronous systems tend to be more fault tolerant to extreme load and do not easily fall prey to the multiplicative effects of failure that characterize synchronous systems. We will discuss the reasons for this in greater detail in the next section of this chapter.&lt;/p&gt;&lt;a name="ch12lev2sec8"&gt;&lt;/a&gt;&lt;h4 id="title-ID0ESTAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Stateless Systems&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="some systems"&gt;&lt;/a&gt;Although some systems need state, state has a cost in terms of availability, scalability, and overall cost of your system. When you store state, you do so at a cost of memory or disk space and maybe the cost of databases. This results in additional calls that are often made in synchronous fashion, which in turn reduces availability. As state is often costly compared to stateless systems, it increases the &lt;span class="docEmphasis" style="font-style: italic; "&gt;per unit cost&lt;/span&gt;&lt;a name="state whenever"&gt;&lt;/a&gt; of scaling your site. Try to avoid state whenever possible.&lt;/p&gt;&lt;a name="ch12lev2sec9"&gt;&lt;/a&gt;&lt;h4 id="title-ID0EAUAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Scale Out Not Up&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="iddle1201"&gt;&lt;/a&gt;&lt;a name="iddle1202"&gt;&lt;/a&gt;&lt;a name="iddle1205"&gt;&lt;/a&gt;&lt;a name="iddle1214"&gt;&lt;/a&gt;&lt;a name="iddle1218"&gt;&lt;/a&gt;&lt;a name="iddle1280"&gt;&lt;/a&gt;&lt;a name="iddle1322"&gt;&lt;/a&gt;&lt;a name="iddle1377"&gt;&lt;/a&gt;&lt;a name="iddle1587"&gt;&lt;/a&gt;&lt;a name="iddle1925"&gt;&lt;/a&gt;&lt;a name="iddle1926"&gt;&lt;/a&gt;&lt;a name="iddle2581"&gt;&lt;/a&gt;&lt;a name="principle that"&gt;&lt;/a&gt;This is the principle that addresses the need to scale horizontally rather than vertically. Whenever you base the viability of your business on faster, bigger, and more expensive hardware, you define a limit on the growth of your business. That limit may change with time as larger scalable multiprocessor systems or vendor supported distributed systems become available, but you are still implicitly stating that you will grow governed by third-party technologies. When it comes to ensuring that you can meet your shareholder needs, design your systems to be able to be horizontally split in terms of data, transactions, and customers.&lt;/p&gt;&lt;a name="ch12lev2sec10"&gt;&lt;/a&gt;&lt;h4 id="title-ID0E6XAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Design for at Least Two Axes of Scale&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="major system"&gt;&lt;/a&gt;Whenever you design a major system, you should ensure that it is capable of being split on at least two axes of the cube that we introduce in&lt;a class="docLink" href="http://techbus.safaribooksonline.com/9780137031436/ch22#ch22" style="text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 33, 123); "&gt;Chapter 22&lt;/a&gt;&lt;a name="the AKF"&gt;&lt;/a&gt;, Introduction to the AKF Scale Cube, to ensure that you have plenty of room for “surprise” demand. This does not mean that you need to implement those splits on day one, but rather that they are thought through and at least architected so that the long lead time of rearchitecting a system is avoided.&lt;/p&gt;&lt;a name="ch12lev2sec11"&gt;&lt;/a&gt;&lt;h4 id="title-ID0ERYAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Buy When Non Core&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="this a"&gt;&lt;/a&gt;We will discuss this a bit more in &lt;a class="docLink" href="http://techbus.safaribooksonline.com/9780137031436/ch15#ch15" style="text-decoration: none; outline-style: none; outline-width: initial; outline-color: initial; color: rgb(0, 33, 123); "&gt;Chapter 15&lt;/a&gt;&lt;a name="on Core"&gt;&lt;/a&gt;, Focus on Core Competencies: Build Versus Buy. Although we have this identified as a cost initiative, we can make arguments that it affects scalability and availability as well as productivity even though productivity isn’t a theme within our principles. The basic premise is that regardless of how smart you and your team are, you simply aren’t the best at everything. Furthermore, your shareholders really expect you to focus on the things that &lt;span class="docEmphasis" style="font-style: italic; "&gt;really&lt;/span&gt;&lt;a name="create competitive"&gt;&lt;/a&gt; create competitive differentiation and therefore shareholder value. So only build things when you are really good at it &lt;span class="docEmphasis" style="font-style: italic; "&gt;and&lt;/span&gt;&lt;a name="a significant"&gt;&lt;/a&gt; it makes a significant difference in your product, platform, or system.&lt;/p&gt;&lt;a name="ch12lev2sec12"&gt;&lt;/a&gt;&lt;h4 id="title-ID0EHZAI" class="docSection2Title" style="margin-top: 5px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 15px; font-weight: normal; color: rgb(109, 114, 136); font-family: verdana, sans-serif; "&gt;Use Commodity Hardware&lt;/h4&gt;&lt;p class="docText" style="margin-top: 0px; margin-right: 0px; margin-bottom: 12px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 12px; line-height: 1.2em; font-family: verdana, sans-serif; color: black; "&gt;&lt;a name="often get"&gt;&lt;/a&gt;We often get a lot of pushback on this one, but it fits in well with the rest of the principles we’ve outlined. It is similar to our principle of using mature technologies. Hardware, especially servers, moves at a rapid pace toward commoditization characterized by the market buying predominately based on cost. If you can develop your architecture such that you can scale horizontally easily, you should be buying the cheapest hardware you can get your hands on, assuming that the cost of ownership of that hardware (including the cost of handling higher failure rates) is lower than higher end hardware.&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-2013481931284942802?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/2013481931284942802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/from-one-of-book.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2013481931284942802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/2013481931284942802'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/from-one-of-book.html' title='Architectural Principles'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5416346355071142326.post-3238076075092900649</id><published>2010-08-10T18:58:00.000-07:00</published><updated>2010-08-10T20:44:43.600-07:00</updated><title type='text'>Scalability patterns for facebook</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: 14px; color: rgb(38, 38, 38); line-height: 25px; "&gt;&lt;ol&gt;&lt;li&gt;Scaling takes Iteration&lt;/li&gt;&lt;li&gt;Don't Over Design&lt;/li&gt;&lt;li&gt;Choose the right tool for the job, but realize that your choice comes with overhead.&lt;/li&gt;&lt;li&gt;Get the culture right. Move Fast - break things. Huge Impact - small teams. Be bold - innovate.&lt;/li&gt;&lt;li&gt;Get track of all information in plain hashMap ids. keep those ids mapping latest.. At rutime simply build information and data by pulling respective data from meta ids.&lt;/li&gt;&lt;li&gt;No prod join.. If you need any data. simply do multi get on cache and them lookup actual info parallely.&lt;/li&gt;&lt;li&gt;Used NFS to run the files. haystack&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5416346355071142326-3238076075092900649?l=shivnarayan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://shivnarayan.blogspot.com/feeds/3238076075092900649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/scalability-patterns-for-facebook.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/3238076075092900649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5416346355071142326/posts/default/3238076075092900649'/><link rel='alternate' type='text/html' href='http://shivnarayan.blogspot.com/2010/08/scalability-patterns-for-facebook.html' title='Scalability patterns for facebook'/><author><name>Shivnarayan R. Varma</name><uri>http://www.blogger.com/profile/02444625714407103871</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='29' src='http://4.bp.blogspot.com/_b1LSUlnXsFw/TGNDODmStrI/AAAAAAAAB5Y/M8UMDgJx_jw/S220/Shivnarayan.jpg'/></author><thr:total>0</thr:total></entry></feed>
