Skip to main content

Home/ Java Development/ Contents contributed and discussions participated by Rinav G

Contents contributed and discussions participated by Rinav G

Rinav G

What kind of woman would your web framework be? - Redcode - 1 views

  •  
    What kind of woman would your web framework be?
Rinav G

Handling null in Java - Redcode - 5 views

  •  
    Handling null in Java
Rinav G

Nimbus Look and Feel - 0 views

  •  
    Nimbus, a cross platform look and feel introduced in the Java SE 6 update 10 release, is drawn with 2D vector graphics and can be rendered at any resolution.
Rinav G

JavaBlogging » What is serialVersionUID? - 2 views

  • private static final long serialVersionUID = 1L
  • and it is still there even after the program finished. Let’s see if we can read that file once again, this time without creating it first.
  • Now, let’s see what happens, when we change the serialVersionUID value and try to deserialize once again our file. Change the line 2 in the class SerializeMe so that serialVersionUID contains now 2 instead of 1:
  • ...13 more annotations...
  • serialVersionUID = 2L;
  • static final
  • Exception in thread "main" java.io.InvalidClassException:
  • As you can see, this time the deserialization didn’t go well. ObjectInputStream complained about the serialVersionUID being changed.
  • How does he know that it changed? If serialVersinUID is static, then it should not have been serialized in the first place, and there should be no information about the previous value 1 during the deserialization, right? Well, serialVersionUID is an exception to the rule that “static fields don’t get serialized”.
  • Moreover, if there is no serialVersionUID officially declared in the class to be serialized, compiler automatically adds it with a value generated based on the fields declared in the class.
  • The deserialization of that object does not necessarily have to occur exactly after serialization. It can occur after a few months or on a completely different JVM
  • there is a chance that the class declaration has changed between serialization and deserialization.
  • It checks if the data read from the input stream is compatible with the current definition of the class.
  • when the visibility of a field changes, the serialVersionUID changes too.
  • sometimes you just want for some reason to forbid deserialization of old serialized objects,
  • you might tend to write it once for every serializable class ( or have it generated by the IDE ) and forget about it. WRONG !!!
  • If you write it once and don’t take care to update it when necessary, you loose all the merits of serialVersionUID.
  •  
    What is serialVersionUID? What is it Used For???
Rinav G

A JSTL primer, Part 2: Getting down to the core - 0 views

  •  
    JSTL in foreach
Rinav G

Building Collaborative CRUD Applications With ICEfaces and NetBeans - 1 views

  •  
    ICEFaces Netbeans Tutorial for creating Database CRUD
Rinav G

UML basics: The sequence diagram - 4 views

  • UML basics: Th
  • UML basics: The sequence diagram
  •  
    UML basics: The sequence diagram
Rinav G

JDBC 4.0 Enhancements in Java SE 6 - 0 views

  • In JDBC 4.0, we no longer need to explicitly load JDBC drivers using Class.forName(). When the method getConnection is called, the DriverManager will attempt to locate a suitable driver from among the JDBC drivers that were loaded at initialization and those loaded explicitly using the same class loader as the current application.
  • Auto-loading of JDBC driver class
  • Service Provider mechanism (SPM).
  • ...4 more annotations...
  • META-INF/services directory.
  • META-INF/services/java.sql.Driver.
  • java.sql.Driver.
  • the META-INF/services/java.sql.Drive
  •  
    JDBC 4.0 Enhancements in Java SE 6 Java Platform, Standard Edition (Java SE) version 6 (code name Mustang), is currently in its second beta release and is scheduled to be delivered in October of this year. Java SE 6 includes several enhancements to the Java Database Connectivity (JDBC) API. These enhancements will be released as JDBC version 4.0. The main objectives of the new JDBC features are to provide a simpler design and better developer experience. This article provides an overview of the JDBC 4.0 enhancements and what benefits they offer to enterprise Java developers. We will explore the new JDBC features with the help of a sample loan processing application using Apache Derby as the back-end database.
Rinav G

Design Patterns: Front Controller - 0 views

  •  
    Many interactive Web applications are composed of brittle collections of interdependent Web pages. Such applications can be hard to maintain and extend. The Front Controller pattern defines a single component that is responsible for processing application requests. A front controller centralizes functions such as view selection, security, and templating, and applies them consistently across all pages or views. Consequently, when the behavior of these functions need to change, only a small part of the application needs to be changed: the controller and its helper classes.
  •  
    Many interactive Web applications are composed of brittle collections of interdependent Web pages. Such applications can be hard to maintain and extend. The Front Controller pattern defines a single component that is responsible for processing application requests. A front controller centralizes functions such as view selection, security, and templating, and applies them consistently across all pages or views. Consequently, when the behavior of these functions need to change, only a small part of the application needs to be changed: the controller and its helper classes.
Rinav G

Java BluePrints : Model-View-Controller- J2EE Patterns - 1 views

  •  
    By applying the Model-View-Controller (MVC) architecture to a JavaTM 2 Platform, Enterprise Edition (J2EETM) application, you separate core business model functionality from the presentation and control logic that uses this functionality. Such separation allows multiple views to share the same enterprise data model, which makes supporting multiple clients easier to implement, test, and maintain.
  •  
    Java BluePrints Model-View-Controller
Rinav G

Overview (Java Platform SE 6) - 0 views

  • Package java.util.concurrent.atomic A small toolkit of classes that support lock-free thread-safe programming on single variables.
  • A small toolkit of classes that support lock-free thread-safe programming on single variables. In essence, the classes in this package extend the notion of volatile values, fields, and array elements to those that also provide an atomic conditional update operation of the form: boolean compareAndSet(expectedValue, updateValue);
  • Atomic classes are not general purpose replacements for java.lang.Integer and related classes. They do not define methods such as hashCode and compareTo. (Because atomic variables are expected to be mutated, they are poor choices for hash table keys.)
  • ...4 more annotations...
  • The specifications of these methods enable implementations to employ efficient machine-level atomic instructions that are available on contemporary processors.
  • java.util.concurrent.atomic Class AtomicInteger java.lang.Object java.lang.Number java.util.concurrent.atomic.AtomicInteger
  • An int value that may be updated atomically. See the java.util.concurrent.atomic package specification for description of the properties of atomic variables. An AtomicInteger is used in applications such as atomically incremented counters, and cannot be used as a replacement for an Integer. However, this class does extend Number to allow uniform access by tools and utilities that deal with numerically-based classes.
  • int incrementAndGet()           Atomically increments by one the current value.
  •  
    Package java.util.concurrent.atomic Description A small toolkit of classes that support lock-free thread-safe programming on single variables. In essence, the classes in this package extend the notion of volatile values, fields, and array elements to those that also provide an atomic conditional update operation of the form: boolean compareAndSet(expectedValue, updateValue);
Rinav G

[JavaSpecialists 177] - Logging Part 3 of 3 - 0 views

  • Writing your own logging framework is the perfect coding crime.
  • Writing your own logging framework is the perfect coding crime
  • Even the Sun engineers fell into this trap. Prior to Java 4, we had a perfectly good logging framework in Log4J. However, instead of adopting this into the standard Java distribution, we ended up with java.util.logging. There are lots of Java logging frameworks available, even meta-logging frameworks like SLF4J and Jakarta Commons. These are supposed to abstract the logging frameworks so you can change the implementation without touching your code.
  • ...5 more annotations...
  • Logging Levels
  • In Log4J for example, we have six default levels, FATAL, ERROR, WARNING, INFO, DEBUG and TRACE.
  • Since it is tricky assigning the correct levels in our code, we should regularly do code reviews with specific emphasis on logging levels.
  • We should be able to adjust the log levels of our individual components at runtime without restarting our application.
  • Silent Operation
  •  
    Writing your own logging framework is the perfect coding crime. If you can convince your manager to put it on the project plan, you are guaranteed to have success. At the end of each day, you will go home feeling happy and satisfied. It will feel like you are doing something creative. You will get the intellectual stimulation without the risk of failure. Even the Sun engineers fell into this trap. Prior to Java 4, we had a perfectly good logging framework in Log4J. However, instead of adopting this into the standard Java distribution, we ended up with java.util.logging. There are lots of Java logging frameworks available, even meta-logging frameworks like SLF4J and Jakarta Commons. These are supposed to abstract the logging frameworks so you can change the implementation without touching your code. http://www.javaspecialists.eu/archive/Issue177.html
1 - 0 of 0
Showing 20 items per page