当前位置: 首页 > news >正文

做问卷调查的是哪个网站好详情页设计的逻辑框架

做问卷调查的是哪个网站好,详情页设计的逻辑框架,谷歌推广怎么样,qq群网站推广文章目录 attach JVMagent**ArthasBootstrap** arthas-core的启动可以从上一篇做参考 参考 pom#xff0c;即启动是调用的 Arthas 的 main 方法 attach JVM JVM提供了 Java Attach 功能#xff0c;能够让客户端与目标JVM进行通讯从而获取JVM运行时的数据#xff0c;甚至可以… 文章目录 attach JVMagent**ArthasBootstrap** arthas-core的启动可以从上一篇做参考 参考 pom即启动是调用的 Arthas 的 main 方法 attach JVM JVM提供了 Java Attach 功能能够让客户端与目标JVM进行通讯从而获取JVM运行时的数据甚至可以通过Java Attach 加载自定义的代理工具实现AOP、运行时class热更新等功能。 private void attachAgent(Configure configure) throws Exception {VirtualMachineDescriptor virtualMachineDescriptor null;for (VirtualMachineDescriptor descriptor : VirtualMachine.list()) {String pid descriptor.id();if (pid.equals(Long.toString(configure.getJavaPid()))) {virtualMachineDescriptor descriptor;break;}}VirtualMachine virtualMachine null;try {if (null virtualMachineDescriptor) { // 使用 attach(String pid) 这种方式virtualMachine VirtualMachine.attach( configure.getJavaPid());} else {virtualMachine VirtualMachine.attach(virtualMachineDescriptor);}……try {virtualMachine.loadAgent(arthasAgentPath,configure.getArthasCore() ; configure.toString());} catch (IOException e) {}VirtualMachine.list() 相当于 jps 的功能 attach是依靠这条代码 virtualMachine VirtualMachine.attach(virtualMachineDescriptor); 之后就是 loadAgent 并传入 core 和 configure 参数。 agent agent 的代码很简单只有2个类 核心就是 AgentBootstrap 对于 javaagent来说核心的启动入口 public static void premain(String args, Instrumentation inst) {main(args, inst);}public static void agentmain(String args, Instrumentation inst) {main(args, inst);} 神奇不在 arthas-core 里传入的 -core 参数实际上是透传给agent的。整的很绕。 通过 bind 方法进行线程绑定这一步和 arthas-boot 很像。 private static synchronized void main(String args, final Instrumentation inst) {// 尝试判断arthas是否已在运行如果是的话直接就退出try {Class.forName(java.arthas.SpyAPI); // 加载不到会抛异常if (SpyAPI.isInited()) {ps.println(Arthas server already stared, skip attach.);ps.flush();return;}} catch (Throwable e) {// ignore}try {ps.println(Arthas server agent start...);// 传递的args参数分两个部分:arthasCoreJar路径和agentArgs, 分别是Agent的JAR包路径和期望传递到服务端的参数if (args null) {args ;}args decodeArg(args);String arthasCoreJar;final String agentArgs;int index args.indexOf(;);if (index ! -1) {arthasCoreJar args.substring(0, index);agentArgs args.substring(index);} else {arthasCoreJar ;agentArgs args;}File arthasCoreJarFile new File(arthasCoreJar);if (!arthasCoreJarFile.exists()) {ps.println(Can not find arthas-core jar file from args: arthasCoreJarFile);// try to find from arthas-agent.jar directoryCodeSource codeSource AgentBootstrap.class.getProtectionDomain().getCodeSource();if (codeSource ! null) {try {File arthasAgentJarFile new File(codeSource.getLocation().toURI().getSchemeSpecificPart());arthasCoreJarFile new File(arthasAgentJarFile.getParentFile(), ARTHAS_CORE_JAR);if (!arthasCoreJarFile.exists()) {ps.println(Can not find arthas-core jar file from agent jar directory: arthasAgentJarFile);}} catch (Throwable e) {ps.println(Can not find arthas-core jar file from codeSource.getLocation());e.printStackTrace(ps);}}}if (!arthasCoreJarFile.exists()) {return;}/*** Use a dedicated thread to run the binding logic to prevent possible memory leak. #195*/final ClassLoader agentLoader getClassLoader(inst, arthasCoreJarFile);Thread bindingThread new Thread() {Overridepublic void run() {try {bind(inst, agentLoader, agentArgs);} catch (Throwable throwable) {throwable.printStackTrace(ps);}}};bindingThread.setName(arthas-binding-thread);bindingThread.start();bindingThread.join();} catch (Throwable t) {t.printStackTrace(ps);try {if (ps ! System.err) {ps.close();}} catch (Throwable tt) {// ignore}throw new RuntimeException(t);}}ArthasBootstrap bind 有调用了 core 里面 ArthasBootstrap.getInstance private static void bind(Instrumentation inst, ClassLoader agentLoader, String args) throws Throwable {/*** pre* ArthasBootstrap bootstrap ArthasBootstrap.getInstance(inst);* /pre*/Class? bootstrapClass agentLoader.loadClass(ARTHAS_BOOTSTRAP);Object bootstrap bootstrapClass.getMethod(GET_INSTANCE, Instrumentation.class, String.class).invoke(null, inst, args);boolean isBind (Boolean) bootstrapClass.getMethod(IS_BIND).invoke(bootstrap);if (!isBind) {String errorMsg Arthas server port binding failed! Please check $HOME/logs/arthas/arthas.log for more details.;ps.println(errorMsg);throw new RuntimeException(errorMsg);}ps.println(Arthas server already bind.);}而在 ArthasBootstrap中 我们用的 terminal也就是 ShellServer 就在 6. start agent server private ArthasBootstrap(Instrumentation instrumentation, MapString, String args) throws Throwable {this.instrumentation instrumentation;initFastjson();// 1. initSpy()initSpy();// 2. ArthasEnvironmentinitArthasEnvironment(args);String outputPathStr configure.getOutputPath();if (outputPathStr null) {outputPathStr ArthasConstants.ARTHAS_OUTPUT;}outputPath new File(outputPathStr);outputPath.mkdirs();// 3. init loggerloggerContext LogUtil.initLogger(arthasEnvironment);// 4. 增强ClassLoaderenhanceClassLoader();// 5. init beansinitBeans();// 6. start agent serverbind(configure);executorService Executors.newScheduledThreadPool(1, new ThreadFactory() {Overridepublic Thread newThread(Runnable r) {final Thread t new Thread(r, arthas-command-execute);t.setDaemon(true);return t;}});shutdown new Thread(as-shutdown-hooker) {Overridepublic void run() {ArthasBootstrap.this.destroy();}};transformerManager new TransformerManager(instrumentation);Runtime.getRuntime().addShutdownHook(shutdown);}ShellServerImpl 的 bind 这段实现中BuiltinCommandPack 完成了命名的声明并与 cli 输入内容进行命名绑定。并用 Netty 开启server。 /*** Bootstrap arthas server** param configure 配置信息* throws IOException 服务器启动失败*/private void bind(Configure configure) throws Throwable {long start System.currentTimeMillis();if (!isBindRef.compareAndSet(false, true)) {throw new IllegalStateException(already bind);}// init random portif (configure.getTelnetPort() ! null configure.getTelnetPort() 0) {int newTelnetPort SocketUtils.findAvailableTcpPort();configure.setTelnetPort(newTelnetPort);logger().info(generate random telnet port: newTelnetPort);}if (configure.getHttpPort() ! null configure.getHttpPort() 0) {int newHttpPort SocketUtils.findAvailableTcpPort();configure.setHttpPort(newHttpPort);logger().info(generate random http port: newHttpPort);}// try to find appNameif (configure.getAppName() null) {configure.setAppName(System.getProperty(ArthasConstants.PROJECT_NAME,System.getProperty(ArthasConstants.SPRING_APPLICATION_NAME, null)));}try {if (configure.getTunnelServer() ! null) {tunnelClient new TunnelClient();tunnelClient.setAppName(configure.getAppName());tunnelClient.setId(configure.getAgentId());tunnelClient.setTunnelServerUrl(configure.getTunnelServer());tunnelClient.setVersion(ArthasBanner.version());ChannelFuture channelFuture tunnelClient.start();channelFuture.await(10, TimeUnit.SECONDS);}} catch (Throwable t) {logger().error(start tunnel client error, t);}try {ShellServerOptions options new ShellServerOptions().setInstrumentation(instrumentation).setPid(PidUtils.currentLongPid()).setWelcomeMessage(ArthasBanner.welcome());if (configure.getSessionTimeout() ! null) {options.setSessionTimeout(configure.getSessionTimeout() * 1000);}this.httpSessionManager new HttpSessionManager();if (IPUtils.isAllZeroIP(configure.getIp()) StringUtils.isBlank(configure.getPassword())) {// 当 listen 0.0.0.0 时强制生成密码防止被远程连接String errorMsg Listening on 0.0.0.0 is very dangerous! External users can connect to your machine! No password is currently configured. Therefore, a default password is generated, and clients need to use the password to connect!;AnsiLog.error(errorMsg);configure.setPassword(StringUtils.randomString(64));AnsiLog.error(Generated arthas password: configure.getPassword());logger().error(errorMsg);logger().info(Generated arthas password: configure.getPassword());}this.securityAuthenticator new SecurityAuthenticatorImpl(configure.getUsername(), configure.getPassword());shellServer new ShellServerImpl(options);ListString disabledCommands new ArrayListString();if (configure.getDisabledCommands() ! null) {String[] strings StringUtils.tokenizeToStringArray(configure.getDisabledCommands(), ,);if (strings ! null) {disabledCommands.addAll(Arrays.asList(strings));}}BuiltinCommandPack builtinCommands new BuiltinCommandPack(disabledCommands);ListCommandResolver resolvers new ArrayListCommandResolver();resolvers.add(builtinCommands);//worker groupworkerGroup new NioEventLoopGroup(new DefaultThreadFactory(arthas-TermServer, true));// TODO: discover user provided command resolverif (configure.getTelnetPort() ! null configure.getTelnetPort() 0) {logger().info(try to bind telnet server, host: {}, port: {}., configure.getIp(), configure.getTelnetPort());shellServer.registerTermServer(new HttpTelnetTermServer(configure.getIp(), configure.getTelnetPort(),options.getConnectionTimeout(), workerGroup, httpSessionManager));} else {logger().info(telnet port is {}, skip bind telnet server., configure.getTelnetPort());}if (configure.getHttpPort() ! null configure.getHttpPort() 0) {logger().info(try to bind http server, host: {}, port: {}., configure.getIp(), configure.getHttpPort());shellServer.registerTermServer(new HttpTermServer(configure.getIp(), configure.getHttpPort(),options.getConnectionTimeout(), workerGroup, httpSessionManager));} else {// listen local address in VM communicationif (configure.getTunnelServer() ! null) {shellServer.registerTermServer(new HttpTermServer(configure.getIp(), configure.getHttpPort(),options.getConnectionTimeout(), workerGroup, httpSessionManager));}logger().info(http port is {}, skip bind http server., configure.getHttpPort());}for (CommandResolver resolver : resolvers) {shellServer.registerCommandResolver(resolver);}shellServer.listen(new BindHandler(isBindRef));if (!isBind()) {throw new IllegalStateException(Arthas failed to bind telnet or http port! Telnet port: String.valueOf(configure.getTelnetPort()) , http port: String.valueOf(configure.getHttpPort()));}//http api session managersessionManager new SessionManagerImpl(options, shellServer.getCommandManager(), shellServer.getJobController());//http api handlerhttpApiHandler new HttpApiHandler(historyManager, sessionManager);logger().info(as-server listening on network{};telnet{};http{};timeout{};, configure.getIp(),configure.getTelnetPort(), configure.getHttpPort(), options.getConnectionTimeout());// 异步回报启动次数if (configure.getStatUrl() ! null) {logger().info(arthas stat url: {}, configure.getStatUrl());}UserStatUtil.setStatUrl(configure.getStatUrl());UserStatUtil.setAgentId(configure.getAgentId());UserStatUtil.arthasStart();try {SpyAPI.init();} catch (Throwable e) {// ignore}logger().info(as-server started in {} ms, System.currentTimeMillis() - start);} catch (Throwable e) {logger().error(Error during start as-server, e);destroy();throw e;}}参考 https://blog.csdn.net/tianjindong0804/article/details/128423819
http://www.w-s-a.com/news/723322/

相关文章:

  • 做淘宝门头的网站阿里巴巴官网app
  • 安踏网站建设策划方案如何通过域名访问网站
  • 建设网站破解版seo查询 站长之家
  • 太原模板建站平台旅游企业网站建设工作的通知
  • 网站国外建设超级简历模板官网
  • 上海网站建设市场医药网站怎么做
  • 宁夏成城建设集团网站网店美工课本
  • 哪些网站的简历做的比较好政务服务 网站 建设方案
  • 如何建设个人网站凡科怎么样vps安装wordpress后怎样登录
  • 学seo朝阳区seo
  • 网站开发团队成员皮具网站建设
  • 国外外贸需求网站响应式布局网页
  • 手机端便民服务平台网站建设昆明网络哪家好
  • 产品网站建设找哪家舟山信息港
  • 唐山网站建设汉狮怎么样seol英文啥意思
  • 深圳小程序网站开发公司网页制作模板视频教程
  • 电子商务网站开发开题报告wordpress更改后台地址
  • 网站静态前端是什么工作
  • 餐饮门户网站 方案怎么做创业好项目
  • 做百度手机网站推广普通话的宣传标语
  • 记事本可以做网站吗网站服务器是主机吗
  • 手机网站被拦截怎么办怎么解决东营建设信息网网
  • 外贸网站模板免费微信网站开发技术
  • 视频盗版网站怎么做福州网站seo
  • 成都金铭 网站建设做网站包含的技术
  • 长沙的网站建设公司哪家好做网站应选那个主题
  • 公司网站百度搜不到如何自己做一个网站
  • 学生如何建设网站网站开发程序
  • 网站建设公司哪家好 皆来磐石网络网站建设"淘宝网" 在颜色选取和搭配方面有哪些值得学习的地方.
  • 网站如何做移动规则适配北京住房与城乡建设部网站