⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _cache__jsp.java

📁 JSP聊天系统
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/*
 * JSP generated by Resin 2.1.4 (built Fri Aug  2 14:16:52 PDT 2002)
 */

package _admin;
import javax.servlet.*;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import java.util.*;
import java.text.*;
import com.coolservlets.forum.*;
import com.coolservlets.util.*;
import com.coolservlets.forum.database.*;
import com.coolservlets.forum.util.*;
import com.coolservlets.forum.util.admin.*;

public class _cache__jsp extends com.caucho.jsp.JavaPage{
  private boolean _caucho_isDead;
  	
	Runtime runtime = Runtime.getRuntime();

  
  public void
  _jspService(javax.servlet.http.HttpServletRequest request,
              javax.servlet.http.HttpServletResponse response)
    throws java.io.IOException, javax.servlet.ServletException
  {
    com.caucho.jsp.QPageContext pageContext = (com.caucho.jsp.QPageContext) com.caucho.jsp.QJspFactory.create().getPageContext(this, request, response, null, true, 8192, true);
    javax.servlet.jsp.JspWriter out = (javax.servlet.jsp.JspWriter) pageContext.getOut();
    javax.servlet.ServletConfig config = getServletConfig();
    javax.servlet.Servlet page = this;
    javax.servlet.http.HttpSession session = pageContext.getSession();
    javax.servlet.ServletContext application = pageContext.getServletContext();
    response.setContentType("text/html;charset=gb2312");
    request.setCharacterEncoding("GB2312");
    try {
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      
/**
 *	$RCSfile: cache.jsp,v $
 *	$Revision: 1.3.2.1 $
 *	$Date: 2001/05/10 02:06:34 $
 */

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      com.coolservlets.forum.util.admin.AdminBean adminBean;
      synchronized (session) {
        adminBean = (com.coolservlets.forum.util.admin.AdminBean) session.getValue("adminBean");
        if (adminBean == null) {
          adminBean = new com.coolservlets.forum.util.admin.AdminBean();
          session.putValue("adminBean", adminBean);
        }
      }
      pageContext.write(_jsp_string2, 0, _jsp_string2.length);
      	////////////////////////////////
	// Jive authorization check
	
	// check the bean for the existence of an authorization token.
	// Its existence proves the user is valid. If it's not found, redirect
	// to the login page
	Authorization authToken = adminBean.getAuthToken();
	if( authToken == null ) {
		response.sendRedirect( "login.jsp" );
		return;
	}

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      	////////////////////
	// Security check
	
	// make sure the user is authorized to create forums::
	ForumFactory forumFactory = ForumFactory.getInstance(authToken);
	ForumPermissions permissions = forumFactory.getPermissions(authToken);
	boolean isSystemAdmin = permissions.get(ForumPermissions.SYSTEM_ADMIN);
	
	// redirect to error page if we're not a forum admin or a system admin
	if( !isSystemAdmin ) {
		request.setAttribute("Message","No permission to create forums");
		response.sendRedirect("error.jsp");
		return;
	}

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      	/////////////////
	// get parameters
	
	int cacheID = ParamUtils.getIntParameter(request,"cacheID",-1);
	boolean doClear = ParamUtils.getBooleanParameter(request,"doClear");
	boolean doEdit = ParamUtils.getBooleanParameter(request,"doEdit");
	boolean doSave = ParamUtils.getBooleanParameter(request,"doSave");
	int maxSize = ParamUtils.getIntParameter(request,"cacheMaxSize",-1);
	boolean cacheEnabled = ParamUtils.getBooleanParameter(request,"cacheEnabled");
	boolean doCache = ParamUtils.getBooleanParameter(request,"doCache");
	
	DbForumFactory dbForumFactory = null;
	try {
		dbForumFactory = (DbForumFactory)((ForumFactoryProxy)forumFactory).getUnderlyingForumFactory(); 
	} catch (Exception e) { }
	DbCacheManager cacheManager = dbForumFactory.getCacheManager();
	
	// clear the requested cache
	if( doClear ) {
		if( cacheID != -1 ) {
			cacheManager.clear(cacheID);
		}
	}
	
	if( doSave ) {
		if( cacheID != -1 ) {
			Cache cache = cacheManager.getCache(cacheID);
			cache.setMaxSize(maxSize*1024);
		}
	}
	
	// turn the cache on or off
	if( doCache ) {
		cacheManager.setCacheEnabled(cacheEnabled);
	}
	cacheEnabled = cacheManager.isCacheEnabled();

      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string3, 0, _jsp_string3.length);
      	///////////////////////
	// pageTitleInfo variable (used by include/pageTitle.jsp)
	String[] pageTitleInfo = { "缓存" };

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	///////////////////
	// pageTitle include

      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string1, 0, _jsp_string1.length);
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      	if( pageTitleInfo != null ) { 
      pageContext.write(_jsp_string4, 0, _jsp_string4.length);
      	for( int i=0; i<pageTitleInfo.length; i++ ){ 
      pageContext.write(_jsp_string5, 0, _jsp_string5.length);
      out.print(( pageTitleInfo[i] ));
      pageContext.write(_jsp_string5, 0, _jsp_string5.length);
      	if( (i+1)<pageTitleInfo.length ) { 
      pageContext.write(_jsp_string6, 0, _jsp_string6.length);
      	} 
      pageContext.write(_jsp_string7, 0, _jsp_string7.length);
      	} 
      pageContext.write(_jsp_string8, 0, _jsp_string8.length);
      	} 
      pageContext.write(_jsp_string0, 0, _jsp_string0.length);
      pageContext.write(_jsp_string9, 0, _jsp_string9.length);
        DecimalFormat formatter = new DecimalFormat("#.00");
	
      pageContext.write(_jsp_string10, 0, _jsp_string10.length);
      
		Cache cache;
		double memUsed, totalMem, freeMem, hitPercent;
		long hits, misses;
	
      pageContext.write(_jsp_string11, 0, _jsp_string11.length);
       cache = cacheManager.getCache(DbCacheManager.MESSAGE_CACHE); 
      pageContext.write(_jsp_string12, 0, _jsp_string12.length);
       
			memUsed = (double)cache.getSize()/(1024*1024);
			totalMem = (double)cache.getMaxSize()/(1024*1024);
			freeMem = 100 - 100*memUsed/totalMem;
		
      pageContext.write(_jsp_string13, 0, _jsp_string13.length);
      out.print(( formatter.format(totalMem) ));
      pageContext.write(_jsp_string14, 0, _jsp_string14.length);
      out.print(( formatter.format(freeMem)));
      pageContext.write(_jsp_string15, 0, _jsp_string15.length);
      out.print(( cache.getNumElements() ));
      pageContext.write(_jsp_string16, 0, _jsp_string16.length);
       
			hits = cache.getCacheHits();
			misses = cache.getCacheMisses();
			if (hits + misses == 0) { hitPercent = 0.0; }
			else { hitPercent = 100*(double)hits/(hits+misses); }
		
      pageContext.write(_jsp_string17, 0, _jsp_string17.length);
      out.print(( formatter.format(hitPercent)));
      pageContext.write(_jsp_string18, 0, _jsp_string18.length);
      out.print(( hits ));
      pageContext.write(_jsp_string19, 0, _jsp_string19.length);
      out.print(( misses ));
      pageContext.write(_jsp_string20, 0, _jsp_string20.length);
      out.print(( DbCacheManager.MESSAGE_CACHE ));
      pageContext.write(_jsp_string21, 0, _jsp_string21.length);
      out.print(( DbCacheManager.MESSAGE_CACHE ));
      pageContext.write(_jsp_string22, 0, _jsp_string22.length);
      	if( doEdit && cacheID==DbCacheManager.MESSAGE_CACHE ) { 
      pageContext.write(_jsp_string23, 0, _jsp_string23.length);
      out.print(( DbCacheManager.MESSAGE_CACHE ));
      pageContext.write(_jsp_string24, 0, _jsp_string24.length);
      out.print(( cache.getMaxSize()/1024 ));
      pageContext.write(_jsp_string25, 0, _jsp_string25.length);
      	} 
      pageContext.write(_jsp_string26, 0, _jsp_string26.length);
      out.print(( DbCacheManager.THREAD_CACHE ));
      pageContext.write(_jsp_string27, 0, _jsp_string27.length);
       cache = cacheManager.getCache(DbCacheManager.THREAD_CACHE); 
      pageContext.write(_jsp_string28, 0, _jsp_string28.length);
       
			memUsed = (double)cache.getSize()/(1024*1024);
			totalMem = (double)cache.getMaxSize()/(1024*1024);
			freeMem = 100 - 100*memUsed/totalMem;
		
      pageContext.write(_jsp_string13, 0, _jsp_string13.length);
      out.print(( formatter.format(totalMem) ));
      pageContext.write(_jsp_string14, 0, _jsp_string14.length);
      out.print(( formatter.format(freeMem)));
      pageContext.write(_jsp_string15, 0, _jsp_string15.length);
      out.print(( cache.getNumElements() ));
      pageContext.write(_jsp_string16, 0, _jsp_string16.length);
       
			hits = cache.getCacheHits();
			misses = cache.getCacheMisses();
			if (hits + misses == 0) { hitPercent = 0.0; }
			else { hitPercent = 100*(double)hits/(hits+misses); }
		
      pageContext.write(_jsp_string17, 0, _jsp_string17.length);
      out.print(( formatter.format(hitPercent)));
      pageContext.write(_jsp_string18, 0, _jsp_string18.length);
      out.print(( hits ));
      pageContext.write(_jsp_string19, 0, _jsp_string19.length);
      out.print(( misses ));
      pageContext.write(_jsp_string20, 0, _jsp_string20.length);
      out.print(( DbCacheManager.THREAD_CACHE ));
      pageContext.write(_jsp_string21, 0, _jsp_string21.length);
      out.print(( DbCacheManager.THREAD_CACHE ));
      pageContext.write(_jsp_string22, 0, _jsp_string22.length);
      	if( doEdit && cacheID==DbCacheManager.THREAD_CACHE ) { 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -