Tuesday 31 July 2012

Java Interview Questions: - Can you explain blocking Queues in Java?

The java.util.concurrent package contains a set of synchronized Queue interfaces and classes. Blocking Queue extends Queue with operations that wait for the queue to become nonempty when retrieving an element and for space to become available in the queue when storing an element. This interface is implemented by the following classes:
  • LinkedBlockingQueue — an optionally bounded FIFO blocking queue backed by linked nodes
  • ArrayBlockingQueue — a bounded FIFO blocking queue backed by an array
  • PriorityBlockingQueue — an unbounded blocking priority queue backed by a heap
  • DelayQueue — a time-based scheduling queue backed by a heap
  • SynchronousQueue — a simple rendezvous mechanism that uses the BlockingQueue interface
See the following video on Front Controller in Java: -



Click to get Java Interview Questions

Regards,

Get more Java Interview Questions from author’s blog

Saturday 21 July 2012

Java Interview Questions: - Show Passivation and Activation in EJB?

When we are dealing with stateful session beans we need to store the client conversation of the bean so that it can be available in client’s next request. But when we talk about server it has limited resources. If the conversation of the bean is large then the server can run out of resource. So in order to preserve resources EJB server swaps this conversational data in memory to hard disk thus allowing memory to be reclaimed. This process of saving the memory data to hard disk is called as “Passivation”. Now when the client comes back the conversational data is again swapped from the hard disk to the bean. This process is called as “Activation”. The container informs the bean that its about to passivate or activate using the "ejbPassivate()" and "ejbActivate()" methods.

See the following video on Getting started with EJB in Java: -



Click to get Java Interview Questions

Regards,

Get more Java Interview Questions from author's blog

Thursday 19 July 2012

Java Training: -Elaborate JAXR?

JAXR is a standard API used to access XML registries from the JAVA platform. An XML registry is a listing of services available on the Web. JAXR provides APIs for the client applications to query the registries, or publish their own information in them using the registry standards.

It acts as a pluggable layer that allows access to registries implemented on different standards, such as Universal Description Discovery and Integration (UDDI) and Electronic Business using eXtensible Markup Language (ebXML). You can see from the figure below how JAXR API interacts with the respective provider to get data.


Figure: - JAXR architecture
See the following video on Overview and working of Servlets: -



Click to get Java Training

Regards,

Get more Java training stuffs from author's blog

Saturday 14 July 2012

Java Training: -Mention about SOAP?

SOAP is an XML-based protocol that enables software components and applications to communicate with one another. It defines rules to translate application and platform-specific data into the XML format. SOAP allows you to communicate with the Web Service using protocols such as HTTP and Simple Mail Transfer Protocol.

SOAP has three main sections:-

Envelope: Contains elements such as the header and body of the SOAP messaging structure. It also includes an encodingStyle attribute that specifies the representation of data in messages.

Header: Encapsulates extended messages without adding or modifying the standard message flow.

Body: Contains Web application-specific data. It defines the purpose of sending the message. The body element should be the first element under the envelope element if there is no header element.

Below is a snippet of a sample SOAP header.

See the following video on Web service in Java: -



Click to get Java Training

Regards,

Get more Java training stuffs from author's blog

Wednesday 11 July 2012

Java Training: - What are the different scopes of an object can have in a JSP page?

There are four scope which an object can have in a JSP page:-

Page Scope

Objects with page scope are accessible only within the page. Data only is valid for the current response. Once the response is sent back to the browser then data is no more valid. Even if request is passed from one page to other the data is lost.

Request Scope

Objects with request scope are accessible from pages processing the same request in which they were created. Once the container has processed the request data is invalid. Even if the request is forwarded to another page, the data is still available though not if a redirect is required.

Session Scope

Objects with session scope are accessible in same session. Session is the time users spend using the application, which ends when they close their browser or when they go to another Web site. So, for example, when users log in, their username could be stored in the session and displayed on every page they access. This data lasts until they leave the Web site or log out.

Application Scope

Application scope objects are basically global object and accessible to all JSP pages which lie in the same application. This creates a global object that's available to all pages. Application scope variables are typically created and populated when an application starts and then used as read-only for the rest of the application.

See the following video on getting started with servlet: -



Click to get Java Training

Regards,

Get more Java training stuffs from author's blog

Wednesday 4 July 2012

Java Training: - What do you mean by four essential properties of a transaction?

A transaction is proper if it fulfils ACID properties. These four properties are as below:-

Atomicity: - This rule states if one part of the transaction fails then the entire transaction should fail.

Consistency: - This rule states that only valid data should be written to database. Any invalid data should roll back the whole transaction. If the transaction executes successfully then it should take database from one state which is consistent to other state which is also consistent.

Isolation: - This rule states that multiple transactions occurring at the same time should not impact each other. If “shiv” and “raju” is withdrawing and depositing money both the transaction should operate in an isolated manner. Isolation ensures that transactions do not affect each other.

Durability: - This rule states that any transaction committed should not be lost. It’s ensured through database backups and transaction logs in database. So that if there is a problem at any point we can restore back to the original state.

See the following video on Service Loader in Java : -



Click to get Java Training

Regards,

Get more Java training stuffs from author's blog