Pages

Tuesday, September 27, 2011

Increasing memory for wsadmin task

Customers use the wsadmin task (ant XML or programatically) to execute the WebSphere command-line administration tool with the specified arguments.

To use this task, add the following to your Ant build.xml  
<taskdef name="wsadmin" classname="com.ibm.websphere.ant.tasks.WsAdmin"/>

WsAdmin ant task supported arbitrary -X arguments to the task's forked JVM  by directly adding them to the build.xml :
<wsadmin script="${basedir}/script.py"> ...
   <arg value="blah" />
   <jvmarg value="-XX:MaxPermSize=128m"/>
</wsadmin>

You can also do this programatically directly by using  WsAdmin task. You will need to setup classpath similar to how it is set for the wsadmin ant task. Modify WAS_HOME/bin/ws_ant.bat/sh script to setup the classpath for your custom task.

WsAdmin task = new WsAdmin();
if (forceConnType != null) {
    System.out.println("forcing connection type to: "+forceConnType);
    task.setConntype(this.forceConnType);
} else {
    task.setConntype(this.conntype);
}            
task.setLang(this.lang);
task.setUser(this.getWasuser());
task.setPassword(this.getWaspassword());
task.setScript(jFile.getAbsolutePath());
if (com.ibm.ws.ant.utils.OsUtils.isSolaris()
           || com.ibm.ws.ant.utils.OsUtils.isHPUX()) {
     //increase permgen space on solaris/hp-ux
     task.createJvmarg().setValue("-XX:MaxPermSize=512M");
}
task.setJvmMaxMemory("1024M");
task.execute();

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.