[ 来源:http://www.it55.com | 作者: | 时间:2007-12-09 | 收藏 | 推荐 ] 【大 中 小】
/**
* 产生一个XMLRouter的实例
* @return com.web.router.XMLRouter
* @roseuid 3F1618A103BC
*/
public static XMLRouter popInstance() throws RouterException
{
routeIndex ++;
instance = new XMLRouter(routeIndex);
setDefine( instance );
QueueRouter.put(new java/lang/Long.java.html" target="_blank">Long(routeIndex), instance);
return instance;
}
/**
* 清空Hashtable,Vector等
* @roseuid 3F1618B203C1
*/
private static void freeResource() throws java/lang/Exception.java.html" target="_blank">Exception
{
QueuePairFront.clear();
QueuePairBack.clear();
QueueRouter.clear();
QueuePairFront = QueuePairBack = QueueRouter = null;
}
/**
* 清除实例
* @param instanceID
* @throws Exception
*/
public static void removeInstance(XMLRouter instance) throws java/lang/Exception.java.html" target="_blank">Exception
{
instance.clear();
QueueRouter.remove( new java/lang/Long.java.html" target="_blank">Long(instance.getIndex() ) ) ;
}
/**
* Method isNull.
* @return boolean
*/
public static boolean isNull()
{
……
return false;
}
}
XMLRouter
| 以下是引用片段: package com.web.router; import com.web.platform.Exception.RouterException; import com.web.common.*; import java.util.*; import java.lang.reflect.java/lang/reflect/Method.java.html" target="_blank">Method; import java.lang.reflect.java/lang/reflect/Constructor.java.html" target="_blank">Constructor; /** * @author keli * @version 0.0.1 * 平台的关键,路由的类,每个Router将从RouterFactory里读取 * Router存储的树front,和back,routeIndex,目的是为了能在路由 * 之后可以清除申请的对象。 * Router可以实现同步和异步的功能. */ public class XMLRouter { /** * Router存储的树front */ private static java/util/Hashtable.java.html" target="_blank">Hashtable QueuePairFront = null; /** * Router存储的树back */ private static java/util/Hashtable.java.html" target="_blank">Hashtable QueuePairBack = null; /** * 本router的index号码 */ private long routeIndex = 0; /** * router的设置 */ private RouterDefine define = null; /** * 用于判断是路由的起回点 */ private java/lang/String.java.html" target="_blank">String action = ""; /** *此变量只是用于在routeto方法中申请新的class */ private java/lang/String.java.html" target="_blank">String classname = ""; /** */ public XMLRouter(long index) { routeIndex = index; } /** * 路由 * @throws Exception * @roseuid 3F1616BD0186 */ public void routing(Env env) throws RouterException, java/lang/Exception.java.html" target="_blank">Exception { /*如果为起点*/ if( action.equalsIgnoreCase( RouterConstant.CFG_FUNC_ROUTETO ) ) { …… } /*如果为返回点*/ else if( action.equalsIgnoreCase( RouterConstant.CFG_FUNC_ROUTEBACK ) ) { …… } /*否则为错误*/ else throw new RouterException("Set Router action error."); } (编辑:IT资讯之家 www.it55.com) 其它同级分类:
网友评论[以下评论为网友观点,不代表本站。请自觉遵守互联网相关政策法规,所有连带责任均有评论者自负。]图片文章 |