示例#1
0
文件: Logger.java 项目: jjsahalf/Emma
  /**
   * Requiring a context parameter here helps enforce correct push/pop nesting in the caller code.
   *
   * @param ctx [may not be null]
   */
  public static void pop(final Logger ctx) {
    // TODO: add guards for making sure only the pushing thread is allowed to
    // execute this

    final LinkedList stack = (LinkedList) THREAD_LOCAL_STACK.get();

    try {
      final Logger current = (Logger) stack.getLast();
      if (current != ctx) throw new IllegalStateException("invalid context being popped: " + ctx);

      stack.removeLast();
      current.cleanup();
    } catch (NoSuchElementException nsee) {
      throw new IllegalStateException(
          "empty logger context stack on thread [" + Thread.currentThread() + "]: " + nsee);
    }
  }
示例#2
0
      PathEnumerator(final File[] path, final boolean canonical, final IPathHandler handler) {
        m_path = new ArrayList(path.length);
        for (int p = 0; p < path.length; ++p) m_path.add(path[p]);

        m_canonical = canonical;

        if (handler == null) throw new IllegalArgumentException("null input: handler");
        m_handler = handler;

        m_processManifest = true; // TODO

        if (m_processManifest) {
          m_pathSet = new HashSet(path.length);
          for (int p = 0; p < path.length; ++p) {
            m_pathSet.add(path[p].getPath()); // set of [possibly canonical] paths
          }
        } else {
          m_pathSet = null;
        }

        m_log = Logger.getLogger(); // each path enumerator caches its logger at creation time
        m_verbose = m_log.atVERBOSE();
        m_trace1 = m_log.atTRACE1();
      }