** Always use static keyword very carefully , since it can cause problem during parallel execution
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Memory Leak : In Java, when a developer wants to create and use a new object using, e.g. new Integer(5), he doesn't have to allocate memory – this is being taken care of by the Java Virtual Machine (JVM). During the life of the application JVM periodically checks which objects in memory are still being used and which are not. Unused objects can be discarded and memory reclaimed and reused again. This process is called garbage collection and the corresponding piece of JVM is called Garbage Collector, or GC.
Java’s automatic memory management relies on GC which periodically looks for unused objects and removes them. And here hides the dragon. Simplifying a bit, we can say that a memory leak in Java is a situation where some objects are not used by application any more, but GC fails to recognize them as unused. As a result, these objects remain in memory indefinitely reducing the amount of memory available to the application.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
A heap dump is a snapshot of the memory of a Java process. The snapshot contains information about the Java objects and classes in the heap at the moment the snapshot is triggered.
In order to solve memory leak heap dump is taken in below order.
Step1: Start application let it take load for few minutes and then take heap dump
Step2: Take heap dump before application crashes
Step3: Analyse heap dumps
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
A Java thread dump is a way of finding out what every thread in the JVM is doing at a particular point in time. This is especially useful if your Java application sometimes seems to hang when running under load, as an analysis of the dump will show where the threads are stuck.VisualVM is one of the best ways to visualise all the threads in your process
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
what is serialization in Java and use of trancient modifier in it?
Serialization is a mechanism of converting state of object into byte stream.At the time of serialization, if we don’t want to save value of a particular variable in a file, then we use transient keyword. When JVM comes across transient keyword, it ignores original value of the variable and save default value of that variable data type.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Is it possible to run java file , after moving from 32 bit system to 64 bit system?
Absolutely Yes. Java byte code is independent from 32-bit or 64-bit systems. That's why it is said about Java write once and run it any where.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
what is out of memory in java
Usually, this error is thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Example of dead/unreachable code
void UnreachableCode_method(boolean b)
{
if(b)
{
return;
}
else
{
return;
}
System.out.println("Unreachable Statement"); //Compile Time Error : Unreachable Code
}
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AjaxElementLocatorFactory:
One of the key benifit of using PageFactory pattern is AjaxElementLocatorFactory class.It is working on lazy loading concept, i.e. a timeout for a WebElement will be assigned to the Object page class with the help of AjaxElementLocatorFactory .
e.g.
AjaxElementLocatorFactory fact = new AjaxElementLocatorFactory(driver, 100);
public HomePage(){
PageFactory.initElements(fact,this);
}
here HomePage() is a constructor
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
No comments:
Post a Comment