When a java-rmi stub object become invalid.
1-After link between client and server broken.(Is stub is valid after connection reestablish or it is still need to refresh)
2-After a specific timeout.
I want to get stubs ones and store them on application scope.
Neither. It becomes invalid when the corresponding remote object is unexported, which can only happen if the remote object is unexported, either explicitly or as a result of local garbage-collection. Local GC in turn can only happen after Distributed Garbage Collection (DGC) has occurred, which means that for each client of the remote object, either it has allowed its stub to be locally GC'd in its own JVM or it has become disconnected from the network path to the remote object's host for long enough for DGC expiry to take effect, which takes a configurable time which by default is (was?) 10 minutes.