当前位置: 首页>>代码示例>>Java>>正文


Java Configure类代码示例

本文整理汇总了Java中scouter.server.Configure的典型用法代码示例。如果您正苦于以下问题:Java Configure类的具体用法?Java Configure怎么用?Java Configure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Configure类属于scouter.server包,在下文中一共展示了Configure类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import scouter.server.Configure; //导入依赖的package包/类
public void run() {
	while (true) {
		ThreadUtil.sleep(5000);
		try {
			File root = new File(Configure.getInstance().plugin_dir);
			reloadIfModified(root);
		} catch (Throwable t) {
			t.printStackTrace();
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:PlugInLoader.java

示例2: process

import scouter.server.Configure; //导入依赖的package包/类
public void process(Pack pack) {
    try {
        method.invoke(object, pack);
    } catch (Throwable t) {
        Logger.println("G003", "[Plugin invoke fail]" + object.getClass() + " " + method + " " + t);
        if(Configure.getInstance()._trace) {
            t.printStackTrace();
        }
    }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:11,代码来源:PluginInvocation.java

示例3: loadPlugins

import scouter.server.Configure; //导入依赖的package包/类
public static void loadPlugins() {
    Set<String> classNames = new Scanner("scouter.plugin.server").process();

    Iterator<String> itr = classNames.iterator();

    while (itr.hasNext()) {
        try {
            Class c = Class.forName(itr.next());
            if (!Modifier.isPublic(c.getModifiers()))
                continue;

            Method[] m = c.getDeclaredMethods();
            for (int i = 0; i < m.length; i++) {
                ServerPlugin annotation = m[i].getAnnotation(ServerPlugin.class);
                if (annotation == null)
                    continue;

                String pluginPoint = annotation.value();
                List<PluginInvocation> pluginList = pluginMap.get(pluginPoint);

                if(pluginList == null) {
                    pluginList = new ArrayList<PluginInvocation>();
                    pluginMap.put(pluginPoint, pluginList);
                }

                Logger.println("[BuiltInPlugin]" + c.getName() + "=>" + m[i].getName());
                pluginList.add(new PluginInvocation(c.newInstance(), m[i]));
            }
        } catch (Throwable t) {
            Logger.println("Server Plugin Load Error");
            if(Configure.getInstance()._trace) {
                t.printStackTrace();
            }
        }
    }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:37,代码来源:BuiltInPluginManager.java

示例4: run

import scouter.server.Configure; //导入依赖的package包/类
public void run() {
	while (true) {
		ThreadUtil.sleep(5000);
		try {
			File root = new File(Configure.getInstance().plugin_dir);
			if (root != null && root.canRead()) {
				checkModified(root);
				checkNewRule(root);
			}
		} catch (Throwable t) {
			t.printStackTrace();
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:15,代码来源:AlertRuleLoader.java

示例5: getContentsOfFile

import scouter.server.Configure; //导入依赖的package包/类
private String getContentsOfFile(String counterName, String fileSuffix) {
	String contents = "";
	try {
		File ruleFile = new File(Configure.getInstance().plugin_dir + "/" + counterName + fileSuffix);
		if (ruleFile.canRead()) {
			contents = new String(FileUtil.readAll(ruleFile));
		}
	} catch (Throwable t) {
		t.printStackTrace();
	}
	return contents;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:13,代码来源:AlertRuleLoader.java

示例6: write

import scouter.server.Configure; //导入依赖的package包/类
static public void write(long time, String objName, String filename, long fileSize, InputStream in) throws IOException{
String path  = getDBPath(time, objName);
      if (Configure.getInstance().log_udp_batch) {
          Logger.println(new StringBuilder(100).append("Batch stack path: ").append(path).toString());
      }		
      File f = new File(path);
      if (!f.exists()) {
          f.mkdirs();
      }		
      if (!f.exists()) {
      	throw new IOException("can't create path:" + path);
      }

      BufferedOutputStream out = null;
      try {
      	out = new BufferedOutputStream(new FileOutputStream(new File(new StringBuilder(100).append(path).append('/').append(filename).append(".zip").toString())));
      	int totalSize = 0;
      	int readSize;
      	byte [] buffer = new byte[1024];
      	while((readSize = in.read(buffer)) != -1){
      		out.write(buffer, 0, readSize);
      		totalSize += readSize;
      		if(totalSize == fileSize){
      			break;
      		}
      	}
      }finally{
      	if(out != null){
      		try{out.close(); }catch(Exception ex){}
      	}
      }
  }
 
开发者ID:scouter-project,项目名称:scouter,代码行数:33,代码来源:BatchZipDB.java

示例7: run

import scouter.server.Configure; //导入依赖的package包/类
public void run() {
	if (Configure.getInstance()._compress_write_thread != old_block_thread) {
		ExecutorService oldExec = exec;
		exec = Executors.newFixedThreadPool(Configure.getInstance()._compress_write_thread);
		old_block_thread = Configure.getInstance()._compress_write_thread;
		oldExec.shutdown();
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:9,代码来源:IOChannel.java

示例8: process

import scouter.server.Configure; //导入依赖的package包/类
public void process(InputStream in, OutputStream out) throws IOException{
	long startTime = DataUtil.readLong(in);
	String objName = DataUtil.readText(in);
	String filename = DataUtil.readText(in);
	long fileSize = DataUtil.readLong(in);
	
       if (Configure.getInstance().log_udp_batch) {
           Logger.println(new StringBuilder(100).append("Batch stack file: ").append(objName).append('(').append(startTime).append(") - ").append(filename).toString());
       }		
	BatchZipDB.write(startTime, objName, filename, fileSize, in);
	out.write(TcpFlag.OK);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:13,代码来源:TcpSendStack.java

示例9: makeReqCommand

import scouter.server.Configure; //导入依赖的package包/类
static public ReqCommand makeReqCommand(int cmd){
       if (Configure.getInstance().log_udp_batch) {
           Logger.println(new StringBuilder(100).append("Batch CMD: ").append(cmd).toString());
       }
	switch(cmd){
	case NetCafe.TCP_SEND_STACK:
		return new TcpSendStack();
	}
	return null;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:11,代码来源:ReqCommandFactory.java

示例10: load

import scouter.server.Configure; //导入依赖的package包/类
public static void load() {
	String pkg = Scanner.cutOutLast(ServiceHandlingProxy.class.getName(), ".");
	Set<String> classes = new Scanner(pkg).process(ServiceHandlingProxy.class.getClassLoader());
	Set<String> custom = new Scanner(System.getProperty("scouter.handler")).process();
	classes.addAll(custom);
	Iterator<String> itr = classes.iterator();
	while (itr.hasNext()) {
		try {
			Class c = Class.forName(itr.next());
			if (Modifier.isPublic(c.getModifiers()) == false) {
				continue;
			}
			try {
				Method[] m = c.getDeclaredMethods();
				for (int i = 0; i < m.length; i++) {
					ServiceHandler mapAn = (ServiceHandler) m[i].getAnnotation(ServiceHandler.class);
					if (mapAn == null)
						continue;
					String key = mapAn.value();
					Invocation news = new Invocation(c.newInstance(), m[i]);
					Invocation olds = handlers.get(key);
					if (olds != null) {
						Logger.println("Warning duplicated Handler key=" + key + " old=" + olds + " new=" + news);
					} else {
						if (Configure.getInstance().log_service_handler_list) {
							Logger.println("ServiceHandler " + key + "=>" + news);
						}
					}
					handlers.put(key, news);
				}
			} catch (Exception x) {
				x.printStackTrace();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:39,代码来源:ServiceHandlingProxy.java

示例11: setLocation

import scouter.server.Configure; //导入依赖的package包/类
public void setLocation(XLogPack p) {
	if (Configure.getInstance().geoip_enabled) {
		GeoIpUtil.setNationAndCity(p);
	}
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:6,代码来源:IXLog.java

示例12: saveRuleContents

import scouter.server.Configure; //导入依赖的package包/类
/**
 * save rule file
 * @param counterName
 * @return
 */
public boolean saveRuleContents(String counterName, String contents) {
	File ruleFile = new File(Configure.getInstance().plugin_dir + "/" + counterName + ALERT_FILE_SUFFIX);
	return FileUtil.saveText(ruleFile, contents);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:AlertRuleLoader.java

示例13: saveConfigContents

import scouter.server.Configure; //导入依赖的package包/类
/**
 * save config file
 * @param counterName
 * @return
 */
public boolean saveConfigContents(String counterName, String contents) {
	File confFile = new File(Configure.getInstance().plugin_dir + "/" + counterName + CONF_FILE_SUFFIX);
	return FileUtil.saveText(confFile, contents);
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:10,代码来源:AlertRuleLoader.java


注:本文中的scouter.server.Configure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。