Tagged: programming Toggle Comment Threads | Keyboard Shortcuts

  • Subinkrishna Gopi 2:57 pm on March 20, 2010 Permalink |
    Tags: , programming, serialization   

    Today’s read: How Java serialization works ! 

    Have you ever wondered what is happening behind the scenes of Java serialization ? If your answer is YES, this one is for you. This is a really good one. I will recommend all to read this.

    Read the article: http://www.javaworld.com/community/node/2915

    If you are interested in more details, you can read Sun’s Java object serialization specification. You can get the specification from here: http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf

  • Subinkrishna Gopi 11:37 am on February 23, 2010 Permalink |
    Tags: , help, htmlunit, , , , memory leak, programming,   

    HTMLUnit issue 

    We are using HTMLUnit in one of our modules and we use it to crawl through the webpages. But we are facing serious memory leak issues with HTMLUnit. We are unable to kill the JavaScript threads even after the functionality is completed. All my search to fix this issue ended up in one solution,


    But even this did not help us in solving the leak. The method call claims to kill all the running JavaScript threads associated with the WebClient though! If anyone can help us in fixing this, can share their thoughts here. I will update this post as soon as we have a solution.

    Thank you.

    • kkperf 11:28 pm on April 9, 2010 Permalink

      We seem to be running into a similar issue.
      We noticed “leaking windows” – always with a scriptable object tied to it. Here is what we did to confirm this (in addition to heap dump analysis)

      System.out.println(“windows size before closeAllWindows: ” + windows.size());
      System.out.println(“windows size after closeAllWindows: ” + windows.size());

      List windowsAfterClose = webClient.getWebWindows();
      System.out.println(“windowsAfterClose size: ” + windowsAfterClose.size());
      for (WebWindow ww : windowsAfterClose) {
      System.out.println(“Window name: ” + ww.getName());

      This shows that there is 1 window with no name still open.

      Trying to figure out whats going on. I’m going to perhaps end up logging a bug with htmlunit.
      Let me know if you have found a solution to the problem.

    • kswenson 2:53 am on August 3, 2010 Permalink

      I have this exact problem.

      I have iterated through all the of the windows, gotten the ThreadManager, and interrupted all treads managed by those windows.

      Then I close all windows.

      But background JavaScript is still running. Every few seconds it creates a new thread and executes something.

      There is a class JavaScriptBackgroundJob which is running, but this class is not mentioned anywhere in the JavaDoc shipped with the library.

      I would appreciate help from anyone who can tell me how to COMPLETELY shut down all htmlunit processing.

    • Subinkrishna G 12:44 pm on August 4, 2010 Permalink

      We still dont have any solution 😦 I will update this post as soon as I have one.

  • Subinkrishna Gopi 11:46 am on October 29, 2009 Permalink |
    Tags: , , , programming,   

    Coding is fun. Really :D 

    I used to put some stupid test cases to unit-test my code and I usually don’t forget to remove ’em before review. But last time when my customer reviewed my code, he found the following segment at the end of a Java file. He laughed and asked “Is that true Subin?” 😀

    //------------------------ Test methods ---------------------------
    static class TestClass
     public TestClass(String name)
     this.name = name;
     private String name;
     public boolean equals(Object anObject)
     return (true);
     public int hashCode()
     return (1);
    public static void main(String[] args)
     Set<TestClass> aSet = new HashSet<TestClass>();
     aSet.add(new TestClass("Subin "));
     aSet.add(new TestClass("is in "));
     aSet.add(new TestClass("a "));
     aSet.add(new TestClass("big "));
     aSet.add(new TestClass("big "));
     aSet.add(new TestClass("trouble"));
Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc