Skip to Content
Author's profile photo Biplab Ray

Way To Restart WAS Java via code

Applies To : All JDK

Author(s): Biplab Ray

Company: Tata Consultancy Services

Created on:17th February 2015

Author Bio:

Biplab Ray is working for Tata Consultancy Services as an Assistant Consultant and development of SAP EP,

composite applications using CAF, BPM, BRM, WebDynpro for Java. He also works in technologies like Java/

J2EE and has depth understanding on eSOA, Webservice, Enterprise Service, XML.


In many situations, we might require to re-start our server. But to do so, we required SAP Basis support.


Java code would only work on jvm of server instance.

We should know about Heap Memory, below is few information about Heap Memory

Heap Memory:

The JVM has a heap that is the runtime data area from which memory for all class instances and arrays are allocated. It is created at the JVM start-up.

The heap size may be configured with the following VM options:

-Xmx<size> – to set the maximum Java heap size

-Xms<size> – to set the initial Java heap size

By default, the maximum heap size is 64 Mb.

Heap memory for objects is reclaimed by an automatic memory management system which is known as a garbage collector. The heap may be of a fixed size or may be expanded and shrunk, depending on the garbage collector’s strategy.

Advantage :

1. If we restart the JVM, we would get fresh JVM from begin.


1. Create one EJB

2. Write Business Method

3. Expose EJB as webservice

4. Run the webservice to re-start the WAS Java.

Method Implementation :

Public void restartASJava(){



Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Iliya Kuznetsov
      Iliya Kuznetsov

      Hello Biplab.

      Is TransactionAttributeType.REQUIRES_NEW important for that bean?