1. 程式人生 > >java執行時記憶體引數設定

java執行時記憶體引數設定

package com.ibank.web;
import com.tasfe.framework.netty.TasfeApplication;
import com.tasfe.framework.netty.annotation.Env;
import com.tasfe.framework.netty.annotation.NettyBootstrap;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextStartedEvent;
import org.springframework.web.servlet.DispatcherServlet; /** * @author [email protected] * @date 2016年9月15日-下午9:19:23 * @description <code>NettyServerBootstrap</code>伺服器載入程式類,用於排程伺服器啟動介面 * (springApplicationContext = "classpath*:mobanker-*-application.xml",springServletContext = "classpath*:mobanker-*-servlet.xml")
*/ @NettyBootstrap(springApplicationContext = "classpath:/com/ibank/pay/configs/ws/ibank-pay-application.xml", springServletContext = "classpath:/com/ibank/pay/configs/ws/ibank-pay-servlet.xml") @Env(profile = "") public class PayApplication extends DispatcherServlet implements ApplicationListener<ContextStartedEvent> { /**
* 621778 8305100 363014 * * @param args * @description <code>入口程式</code> */ public static void main(String[] args) { System.out.println("Java程序可以向作業系統申請到的最大記憶體:"+(Runtime.getRuntime().maxMemory())/(1024*1024)+"M"); System.out.println("Java程序空閒記憶體:"+(Runtime.getRuntime().freeMemory())/(1024*1024)+"M"); System.out.println("Java程序現在從作業系統那裡已經申請了記憶體:"+(Runtime.getRuntime().totalMemory())/(1024*1024)+"M"); byte[] bys = new byte[1024*1024];//申請1M記憶體 System.out.println("Java程序可以向作業系統申請到的最大記憶體:"+(Runtime.getRuntime().maxMemory())/(1024*1024)+"M"); System.out.println("Java程序空閒記憶體:"+(Runtime.getRuntime().freeMemory())/(1024*1024)+"M"); System.out.println("Java程序現在從作業系統那裡已經申請了記憶體:"+(Runtime.getRuntime().totalMemory())/(1024*1024)+"M"); TasfeApplication.run(PayApplication.class, args); } //@Value("log.home") private String logHome; @Override public void onApplicationEvent(ContextStartedEvent event) { // event.getApplicationContext(); // 配置中心讀取log配置並存入System //System.setProperty("log_home",logHome); } }