BIM项目中一些高可用代码

来源:互联网 发布:ubuntu安装python2.7 编辑:程序博客网 时间:2024/06/06 01:16

1.页面显示内存使用情况


<%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>JVM memory</title></head><body><%double total = (Runtime.getRuntime().totalMemory()) / (1024.0 * 1024);double max = (Runtime.getRuntime().maxMemory()) / (1024.0 * 1024);double free = (Runtime.getRuntime().freeMemory()) / (1024.0 * 1024);out.println("Java 虚拟机试图使用的最大内存量(当前JVM的最大可用内存)maxMemory(): " + max + "MB<br/>");out.println("Java 虚拟机中的内存总量(当前JVM占用的内存总数)totalMemory(): " + total + "MB<br/>");out.println("Java 虚拟机中的空闲内存量(当前JVM空闲内存)freeMemory(): " + free + "MB<br/>");out.println("JVM实际可用内存: " + (max - total + free) + "MB<br/>");%></body></html>

2.通用action配置


<action name="*_*_*_*" class="{1}Action" method="{2}"><result name="success">pages/{3}/{4}.jsp</result><result name="error">pages/{3}/{4}.jsp</result><result name="toquery" type="redirect">{4}.action</result><result name="noprivilege">pages/login/noPrivilege.jsp</result></action><action name="*_*" class="{1}Action" method="{2}"></action><action name="*.*.*" class="{1}Action" method="{2}"><result name="success">pages/{3}.jsp</result><result name="error">pages/{3}.jsp</result><result name="toindex">/pages/login/goPortal.jsp</result></action>


3.ArrayUtil


public static Object[] unionArray(Object[] array1, Object[] array2, Object[] array3){List<Object> tempList = new ArrayList<Object>();for(int i=0; i<array1.length; i++){tempList.add(array1[i]);}for(int i=0; i<array2.length; i++){tempList.add(array2[i]);}for(int i=0; i<array3.length; i++){tempList.add(array3[i]);}return tempList.toArray();}public static Object[] unionArray(Object[] array1, Object[] array2){List<Object> tempList = new ArrayList<Object>();for(int i=0; i<array1.length; i++){tempList.add(array1[i]);}for(int i=0; i<array2.length; i++){tempList.add(array2[i]);}return tempList.toArray();}public static Object[] insertNullObject(Object[] arr){List<Object> objectList = new ArrayList<Object>();for(int i=0; i<arr.length; i++){objectList.add(arr[i]);objectList.add("");}return objectList.toArray();}


原创粉丝点击