@Override
    public void logged(final LogEntry entry) {

      if (entry.getLevel() == LogService.LOG_DEBUG) {
        return;
      }
      orderedExecutionQueue.enqueue(
          new Runnable() {

            @Override
            @TaskDescription(ASYNC_TASK_DESCRIPTION)
            public void run() {
              try {
                String exceptionString = "";
                if (entry.getException() != null) {
                  exceptionString = entry.getException().toString();
                }
                externalListener.logged(
                    new SerializableLogEntry(
                        entry.getBundle().getSymbolicName(),
                        entry.getLevel(),
                        entry.getMessage().replaceAll("\n", SerializableLogEntry.RCE_SEPARATOR),
                        entry.getTime(),
                        exceptionString));
              } catch (RemoteOperationException e) {
                final Log localLog = LogFactory.getLog(getClass());
                localLog.error(
                    "Error while forwarding log event to listener "
                        + "(delivery of log events to this receiver will be cancelled): "
                        + e.toString());
                // TODO >7.0.0: these lines should be equivalent, but aren't; investigate why -
                // misc_ro, Nov 2015
                // orderedExecutionQueue.cancelAsync();
                throw new RuntimeException(
                    "Error while forwarding log event to listener"); // workaround to restore
                // behavior
              }
              // the @TaskDescription is not forwarded by AsyncOrderedExecutionQueue, so count a
              // stats event for monitoring - misc_ro
              StatsCounter.count(
                  AsyncOrderedExecutionQueue.STATS_COUNTER_SHARED_CATEGORY_NAME,
                  ASYNC_TASK_DESCRIPTION);
            }
          });
    }
 public void shutdown() {
   orderedExecutionQueue.cancelAsync();
 }