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


Java DubboAppender.doStart方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.common.utils.DubboAppender.doStart方法的典型用法代码示例。如果您正苦于以下问题:Java DubboAppender.doStart方法的具体用法?Java DubboAppender.doStart怎么用?Java DubboAppender.doStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.common.utils.DubboAppender的用法示例。


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

示例1: testReconnectWarnLog

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
 * 重连日志的校验,时间不够shutdown time时,不能有error日志,但必须有一条warn日志
 */
@Test
public void testReconnectWarnLog() throws RemotingException, InterruptedException{
    int port = NetUtils.getAvailablePort();
    DubboAppender.doStart();
    String url = "exchange://127.0.0.2:"+port + "/client.reconnect.test?check=false&"
    +Constants.RECONNECT_KEY+"="+1 ; //1ms reconnect,保证有足够频率的重连
    try{
        Exchangers.connect(url);
    }catch (Exception e) {
        //do nothing
    }
    Thread.sleep(1500);//重连线程的运行
    //时间不够长,不会产生error日志
    Assert.assertEquals("no error message ", 0 , LogUtil.findMessage(Level.ERROR, "client reconnect to "));
    //第一次重连失败就会有warn日志
    Assert.assertEquals("must have one warn message ", 1 , LogUtil.findMessage(Level.WARN, "client reconnect to "));
    DubboAppender.doStop();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:22,代码来源:ClientReconnectTest.java

示例2: testReconnectErrorLog

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
 * 重连日志的校验,不能一直抛出error日志.
 */
@Test
public void testReconnectErrorLog() throws RemotingException, InterruptedException{
    int port = NetUtils.getAvailablePort();
    DubboAppender.doStart();
    String url = "exchange://127.0.0.3:"+port + "/client.reconnect.test?check=false&"
    +Constants.RECONNECT_KEY+"="+1 + //1ms reconnect,保证有足够频率的重连
    "&"+Constants.SHUTDOWN_TIMEOUT_KEY+ "=1";//shutdown时间足够短,确保error日志输出
    try{
        Exchangers.connect(url);
    }catch (Exception e) {
        //do nothing
    }
    Thread.sleep(1500);//重连线程的运行
    Assert.assertEquals("only one error message ", 1 , LogUtil.findMessage(Level.ERROR, "client reconnect to "));
    DubboAppender.doStop();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:20,代码来源:ClientReconnectTest.java

示例3: testClientReconnectMethod

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
   * 测试client重连方法不会导致重连线程失效.
   */
  @Test
  public void testClientReconnectMethod() throws RemotingException, InterruptedException{
      int port = NetUtils.getAvailablePort();
      String url = "exchange://127.0.0.3:"+port + "/client.reconnect.test?check=false&"
      +Constants.RECONNECT_KEY+"="+10 //1ms reconnect,保证有足够频率的重连
      +"&reconnect.waring.period=1";
      DubboAppender.doStart();
      Client client = Exchangers.connect(url);
      try {
	client.reconnect();
} catch (Exception e) {
	//do nothing
}
      Thread.sleep(1500);//重连线程的运行
      Assert.assertTrue("have more then one warn msgs . bug was :" + LogUtil.findMessage(Level.WARN, "client reconnect to "),LogUtil.findMessage(Level.WARN, "client reconnect to ") >1);
      DubboAppender.doStop();
  }
 
开发者ID:flychao88,项目名称:dubbocloud,代码行数:21,代码来源:ClientReconnectTest.java

示例4: testReconnectWaringLog

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
 * 重连日志的校验
 */
@Test
public void testReconnectWaringLog() throws RemotingException, InterruptedException{
    int port = NetUtils.getAvailablePort();
    DubboAppender.doStart();
    String url = "exchange://127.0.0.4:"+port + "/client.reconnect.test?check=false&"
    +Constants.RECONNECT_KEY+"="+1 //1ms reconnect,保证有足够频率的重连
    +"&"+Constants.SHUTDOWN_TIMEOUT_KEY+ "=1"//shutdown时间足够短,确保error日志输出
    +"&reconnect.waring.period=100";//每隔多少warning记录一次
    try{
        Exchangers.connect(url);
    }catch (Exception e) {
        //do nothing
    }
    int count =  0;
    for (int i=0;i<100;i++){
        count =  LogUtil.findMessage(Level.WARN, "client reconnect to ") ; 
        if (count >=1){
            break;
        }
        Thread.sleep(50);//重连线程的运行
    }
    Assert.assertTrue("warning message count must >= 1, real :"+count, count>= 1);
    DubboAppender.doStop();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:28,代码来源:ClientReconnectTest.java

示例5: testClientReconnectMethod

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
   * 测试client重连方法不会导致重连线程失效.
   */
  public void testClientReconnectMethod() throws RemotingException, InterruptedException{
      int port = NetUtils.getAvailablePort();
      String url = "exchange://127.0.0.3:"+port + "/client.reconnect.test?transporter=netty4&check=false&"
      +Constants.RECONNECT_KEY+"="+10 //1ms reconnect,保证有足够频率的重连
      +"&reconnect.waring.period=100";
      DubboAppender.doStart();
      Client client = Exchangers.connect(url);
      try {
	client.reconnect();
} catch (Exception e) {
	//do nothing
}
      Thread.sleep(1500);//重连线程的运行
      Assert.assertTrue("have more then one warn msgs . bug was :" + LogUtil.findMessage(Level.WARN, "client reconnect to "),LogUtil.findMessage(Level.WARN, "client reconnect to ") >1);
      DubboAppender.doStop();
  }
 
开发者ID:QianmiOpen,项目名称:dubbo-remoting-netty4,代码行数:20,代码来源:ClientReconnectTest.java

示例6: testReconnectWarnLog

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
 * 重连日志的校验,时间不够shutdown time时,不能有error日志,但必须有一条warn日志
 */
@Test
public void testReconnectWarnLog() throws RemotingException, InterruptedException {
    int port = NetUtils.getAvailablePort();
    DubboAppender.doStart();
    String url = "exchange://127.0.0.2:" + port + "/client.reconnect.test?check=false&"
            + Constants.RECONNECT_KEY + "=" + 1; //1ms reconnect,保证有足够频率的重连
    try {
        Exchangers.connect(url);
    } catch (Exception e) {
        //do nothing
    }
    Thread.sleep(1500);//重连线程的运行
    //时间不够长,不会产生error日志
    Assert.assertEquals("no error message ", 0, LogUtil.findMessage(Level.ERROR, "client reconnect to "));
    //第一次重连失败就会有warn日志
    Assert.assertEquals("must have one warn message ", 1, LogUtil.findMessage(Level.WARN, "client reconnect to "));
    DubboAppender.doStop();
}
 
开发者ID:hufeng,项目名称:dubbo2.js,代码行数:22,代码来源:ClientReconnectTest.java

示例7: test_multi_destory

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
 * 测试invoker多次destory不会导致计数器多次减少
 */
@Test
public void test_multi_destory(){
    init(0);
    DubboAppender.doStart();
    DubboAppender.clear();
    demoServiceInvoker.destroy();
    demoServiceInvoker.destroy();
    Assert.assertEquals("hello", helloService.hello());
    Assert.assertEquals("should not  warning message", 0, LogUtil.findMessage(errorMsg));
    LogUtil.checkNoError();
    DubboAppender.doStop();
    destoy();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:17,代码来源:ReferenceCountExchangeClientTest.java

示例8: test_counter_error

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
 * 测试计数器错误,调用成功
 */
@Test
public void test_counter_error(){
    init(0);
    DubboAppender.doStart();
    DubboAppender.clear();
    
    ReferenceCountExchangeClient client = getReferenceClient(helloServiceInvoker);
    //close一次,计数器从2减少到1,不能warning
    client.close();
    Assert.assertEquals("hello", helloService.hello());
    Assert.assertEquals("should not warning message", 0, LogUtil.findMessage(errorMsg));
    //计数器错误,调用正常
    client.close();
    Assert.assertEquals("hello", helloService.hello());
    Assert.assertEquals("should warning message", 1, LogUtil.findMessage(errorMsg));
   
    //调用5千次输出一个错误
    Assert.assertEquals("hello", helloService.hello());
    Assert.assertEquals("should warning message", 1, LogUtil.findMessage(errorMsg));
    
    DubboAppender.doStop();
    
    //重新调用一次后status已经是available.
    Assert.assertEquals("client status available", true, helloServiceInvoker.isAvailable());
    
    client.close();
    //client已经被替换为lazyclient lazy client从referenceclientmap中获取,获取到的是上次的client(已经被调用过一次),所以close状态为false
    Assert.assertEquals("client status close", false, client.isClosed());
    Assert.assertEquals("client status close", false, helloServiceInvoker.isAvailable());
    destoy();
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:35,代码来源:ReferenceCountExchangeClientTest.java

示例9: test_multi_destory

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
 * 测试invoker多次destory不会导致计数器多次减少
 */
@Test
public void test_multi_destory() {
    init(0);
    DubboAppender.doStart();
    DubboAppender.clear();
    demoServiceInvoker.destroy();
    demoServiceInvoker.destroy();
    Assert.assertEquals("hello", helloService.hello());
    Assert.assertEquals("should not  warning message", 0, LogUtil.findMessage(errorMsg));
    LogUtil.checkNoError();
    DubboAppender.doStop();
    destoy();
}
 
开发者ID:hufeng,项目名称:dubbo2.js,代码行数:17,代码来源:ReferenceCountExchangeClientTest.java

示例10: test_counter_error

import com.alibaba.dubbo.common.utils.DubboAppender; //导入方法依赖的package包/类
/**
 * 测试计数器错误,调用成功
 */
@Test
public void test_counter_error() {
    init(0);
    DubboAppender.doStart();
    DubboAppender.clear();

    ReferenceCountExchangeClient client = getReferenceClient(helloServiceInvoker);
    //close一次,计数器从2减少到1,不能warning
    client.close();
    Assert.assertEquals("hello", helloService.hello());
    Assert.assertEquals("should not warning message", 0, LogUtil.findMessage(errorMsg));
    //计数器错误,调用正常
    client.close();
    Assert.assertEquals("hello", helloService.hello());
    Assert.assertEquals("should warning message", 1, LogUtil.findMessage(errorMsg));

    //调用5千次输出一个错误
    Assert.assertEquals("hello", helloService.hello());
    Assert.assertEquals("should warning message", 1, LogUtil.findMessage(errorMsg));

    DubboAppender.doStop();

    //重新调用一次后status已经是available.
    Assert.assertEquals("client status available", true, helloServiceInvoker.isAvailable());

    client.close();
    //client已经被替换为lazyclient lazy client从referenceclientmap中获取,获取到的是上次的client(已经被调用过一次),所以close状态为false
    Assert.assertEquals("client status close", false, client.isClosed());
    Assert.assertEquals("client status close", false, helloServiceInvoker.isAvailable());
    destoy();
}
 
开发者ID:hufeng,项目名称:dubbo2.js,代码行数:35,代码来源:ReferenceCountExchangeClientTest.java


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