TomCat Embedded et java opts
Bonjour,
je souhaite donner plus de memory pour mon embedded TomCat sur le niveau du code.
voici comment je demare le serveur:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
public class EmbTomCat {
Tomcat tomcat = null ;
public EmbTomCat() {
}
public Tomcat getTomCat(){
return tomcat ;
}
public void go() throws ServletException, LifecycleException{
tomcat = new Tomcat();
tomcat.setPort(8084);
tomcat.setBaseDir(".");
tomcat.enableNaming();
ContextResource res = new ContextResource();
res.setName("jdbc/blu");
res.setType("javax.sql.DataSource");
res.setAuth("Container");
res.setProperty("username", "ors");
res.setProperty("password", "avanonag");
res.setProperty("driverClassName", "com.mysql.jdbc.Driver");
res.setProperty("url", "jdbc:mysql://localhost:3306/app?characterEncoding=UTF-8");
res.setProperty("maxActive", "10");
res.setProperty("maxIdle", "3");
res.setProperty("maxWait", "10000");
res.setProperty("defaultAutoCommit", "false");
Context ctx = tomcat.addWebapp("/app", "context");
ctx.getNamingResources().addResource(res);
ContextEnvironment ConfigProfile = new ContextEnvironment();
ConfigProfile.setType("java.lang.String");
ConfigProfile.setName("bluConfigProfile");
ConfigProfile.setValue("C:/Config");
ConfigProfile.setOverride(false);
ctx.getNamingResources().addEnvironment(ConfigProfile);
ctx.setDocBase( "C:/blu/bin/app.war" );
tomcat.start();
System.out.println("Server UP: http://localhost:8084/app");
tomcat.getServer().await();
} |
Donc je veux savoir comment passer les argument JAVA_OPTS direct dans le code:
JAVA_OPTS=-Xms124m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m
Merci pour vos reponces.
Soulman