Monday, September 29, 2014

Java wait() releases synchronization lock

Threads calling wait() release the synchronization lock on the current instance, i.e. the method with synchronized keyword is allowed to be entered by other threads.
http://tutorials.jenkov.com/java-concurrency/starvation-and-fairness.html

Saturday, May 10, 2014

HTTP POST vs PUSH

It's not as simple as Update vs Create.

According to the HTTP 1.1 specification, GET, HEAD, PUT and DELETE are idempotent, while POST is not.

http://jcalcote.wordpress.com/2008/10/16/put-or-post-the-rest-of-the-story/ Author states that there is no direct mapping between the HTTP and CRUD verb spaces and that a "higher level logic" should be added to complete the transformation.

Sunday, May 4, 2014

readObject and writeObject

Review the nuances of Java serialization, specifically see http://webcache.googleusercontent.com/search?q=cache:Q1Rpg2MReCIJ:www.javablogging.com/what-are-writeobject-and-readobject-customizing-the-serialization-process/+&cd=4&hl=en&ct=clnk&gl=us spells out how readObject and writeObject are called by ObjectOutputStream if present using getPrivateMethod. These are a way to customize serialization. Can call defaultReadObject/defaultWriteObject on ObjectInputStream/ObjectOutputStream before performing custom setup.

Thursday, May 1, 2014

Java vs. C# - Resource Auto Closing

       

            static String readFirstLineFromFile(String path) throws IOException {
              try (BufferedReader br =
                          new BufferedReader(new FileReader(path))) {
                      return br.readLine();
              }
            }
       
 
The above is similar and appears to have the same use case as the C# use statement, in that it allows you to omit the finally block so long as the resource in question implements java.lang.AutoCloseable (Java) vs IDisposeable .NET. The above was new in Java SE 7. ref: http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html

Monday, March 17, 2014

Static Classes in Java and C#

The semantics of them are entirely different. In C# it connotes a utility class; in Java it denotes independence from containing class (top level static classes are not allowed in Java).

See Skeet's answer for details: http://stackoverflow.com/questions/7486012/static-classes-in-java

Monday, April 29, 2013

When to Enable Sticky Sessions

- In case one wants to implement InProc Session state in a web farm scenario ensure we have sticky sessions enabled for the web farm as it involves storing of the session data among processes hosted on multiple servers.

http://blogs.iis.net/webtopics/archive/2009/07/21/in-proc-session-state-management.aspx

Saturday, November 3, 2012

Changing Visual State in Custom Control

Call VisualStateManager.GoToState(control, strStateName, useTransitions)
strStateName is mapped to a TemplateVisualStateAttribute of the control class.