@Override
  public void start() {
    // cf logback 0.9.17 ?
    //		if (this.layout == null) {
    //			addError("No layout set for the appender named [" + name + "].");
    //			return;
    //		}

    super.start();
  }
示例#2
0
 @Override
 public void stop() {
   super.stop();
   if (null != this.senderPool) {
     this.senderPool.shutdownNow();
     this.senderPool = null;
   }
   if (null != this.connectionFactory) {
     this.connectionFactory.destroy();
   }
   this.retryTimer.cancel();
   this.routingKeyLayout.stop();
 }
 public void stop() {
   if (debug) {
     System.err.println(String.format("%s.stop()", this));
   }
   if (riemannClient != null) {
     try {
       riemannClient.disconnect();
     } catch (IOException ex) {
       // do nothing, it's ok
     }
   }
   super.stop();
 }
示例#4
0
 @Override
 public void start() {
   super.start();
   this.routingKeyLayout.setPattern(
       this.routingKeyLayout
           .getPattern()
           .replaceAll("%property\\{applicationId\\}", this.applicationId));
   this.routingKeyLayout.setContext(getContext());
   this.routingKeyLayout.start();
   this.locationLayout.setContext(getContext());
   this.locationLayout.start();
   this.connectionFactory = new CachingConnectionFactory();
   this.connectionFactory.setHost(this.host);
   this.connectionFactory.setPort(this.port);
   this.connectionFactory.setUsername(this.username);
   this.connectionFactory.setPassword(this.password);
   this.connectionFactory.setVirtualHost(this.virtualHost);
   setUpExchangeDeclaration();
   this.senderPool = Executors.newCachedThreadPool();
   for (int i = 0; i < this.senderPoolSize; i++) {
     this.senderPool.submit(new EventSender());
   }
 }
 public void start() {
   try {
     if (debug) {
       System.err.println(String.format("%s.start()", this));
     }
     SynchronousTransport transport =
         new SimpleUdpTransport(riemannHostname, Integer.parseInt(riemannPort));
     final RiemannClient cli = new RiemannClient(transport);
     riemannClient = cli;
     if (debug) {
       System.err.println(String.format("%s.start: connecting", this));
     }
     riemannClient.connect();
     if (debug) {
       System.err.println(String.format("%s.start: connected", this));
     }
   } catch (IOException ex) {
     if (debug) {
       System.err.println(String.format("%s: Error initializing: %s", this, ex));
     }
     throw new RuntimeException(ex);
   }
   super.start();
 }