Paul
Paul

Reputation: 1383

Java equivalent of .net recycle

What is the Java equivalent of the .net Recycle for web apps in IIS.

This is when using Java on a linux machine outside of IIS.

Is it just to stop and start the application?

Upvotes: 2

Views: 1491

Answers (2)

avijendr
avijendr

Reputation: 4153

Not really - IIS and JVM work in different ways. When you say recycling in IIS, it's basically restarting the Worker process. Each Web Application deployed to IIS is under an application pool and worker process.

In case of java, it's not like that. The whole App server runs on a jvm and you have different Web applications deployed into the App server which runs within the app server.

You could use DB connection pools or Apache commons pool for pooling (Some of your expensive objects you reuse) which can be refreshed but not exactly in a way like IIS.

Even though this would be a nice feature - in reality if you ever reach a situation of needing to refresh application pool, your code/dll(may be 3rd party) is the culprit. There would definitely be a memory leak which needs to be addressed! Also when you recycle the session state might be lost. Apparently users logged in would get logged out (and if they are in the middle of a transaction they might loose data).So it could lead to a very volatile situation!

Update

You could use stuff like Terracotta which handles memory management.

Upvotes: 3

Andres
Andres

Reputation: 10725

Usually JEE servlet containers offer the option of reloading the application. i.e. Tomcat has a Reload button for each app on the manager console.

It also has a button that triggers a full garbage collection, by the way.

Upvotes: 0

Related Questions