Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000308 [Resin] minor always 07-12-05 00:00 11-30-05 14:43
Reporter ferg View Status public  
Assigned To
Priority urgent Resolution fixed  
Status closed   Product Version 3.0.14
Summary 0000308: EnvironmentLogger.removeHandle
Description RSN-351
(rep by Fiaz Hossain)

2. Envoronment Logger should implement removeHandler(). Priority Medium. I had previously sent his to you earlier. The EnvironmentLogger needs to be able to remove a handler cleanly just as it supports addHandler. This is also used by out new Monitoring and Management framework.
 
Additional Information
Attached Files

- Relationships

- Notes
(0000348)
ferg
07-12-05 00:00

File: com.caucho.log.EnvironmentLogger.java. Needs the following code added to it.
  /**
   * Remove a handler.
   */
  public synchronized void removeHandler(Handler handler)
  {
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
 
    for (int i = _loaders.size() - 1; i >= 0; i--) {
      SoftReference<ClassLoader> ref = _loaders.get(i);
      ClassLoader refLoader = ref.get();
 
      if (refLoader == null)
        _loaders.remove(i);
 
      if (isParentLoader(loader, refLoader))
        removeHandler(handler, refLoader);
    }
 
    HandlerEntry ownHandlers = _ownHandlers.get();
    if (ownHandlers != null) {
        ownHandlers.removeHandler(handler);
    }
  }
 
  private void removeHandler(Handler handler, ClassLoader loader)
  {
    ArrayList<Handler> handlers = new ArrayList<Handler>();
 
    for (ClassLoader ptr = loader; ptr != null; ptr = ptr.getParent()) {
      Handler []localHandlers = _localHandlers.getLevel(ptr);
 
      if (localHandlers != null) {
        for (int i = 0; i < localHandlers.length; i++) {
          if (!localHandlers[i].equals(handler)) {
                          int p = handlers.indexOf(localHandlers[i]);
           
                          if (p < 0) {
                            handlers.add(localHandlers[i]);
                          }
                          else {
                            Handler oldHandler = handlers.get(p);
           
                            if (localHandlers[i].getLevel().intValue()
                                    < oldHandler.getLevel().intValue()) {
                              handlers.set(p, localHandlers[i]);
                            }
                          }
          }
        }
      }
    }
 
    if (handlers.size() > 0) {
        Handler []newHandlers = new Handler[handlers.size()];
        handlers.toArray(newHandlers);
        _localHandlers.set(newHandlers);
    } else {
            _localHandlers.remove();
    }
 
    if (handler.getLevel().intValue() <= _level)
      doSetLevel(getLevel());
  }
 
(0000349)
ferg
07-12-05 00:00

server/025k
 

- Issue History
Date Modified Username Field Change
07-12-05 00:00 ferg New Issue
11-30-05 00:00 administrator Fixed in Version  => 3.0.15
11-30-05 14:43 ferg Status resolved => closed


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker