• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.server
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Change
  • Next Change →

Changeset 2597 for trunk/components/blitz/src/ome/services/blitz/impl/ServiceFactoryI.java

Show
Ignore:
Timestamp:
07/05/08 22:16:06 (5 months ago)
Author:
jmoore
Message:

ticket:1018 - Fixing memory leak in solution

  • Added ome/services/messaging.xml to publish messages to child contexts
  • Fixed ordering issues SessionManagerI
  • Also:
    • Using ice_getCommunicator() if ic null in omero.client
    • Catching exceptions on session close in test.integration.library
Files:
1 modified

  • trunk/components/blitz/src/ome/services/blitz/impl/ServiceFactoryI.java (modified) (5 diffs)

Legend:

Unmodified
Added
Removed
  • trunk/components/blitz/src/ome/services/blitz/impl/ServiceFactoryI.java

    r2596 r2597  
    2121import ome.api.JobHandle; 
    2222import ome.api.ServiceInterface; 
    23 import ome.conditions.InternalException; 
    2423import ome.logic.HardWiredInterceptor; 
    2524import ome.services.blitz.fire.AopContextInitializer; 
    … …  
    516515 
    517516        } 
     517 
     518        // All resources cleaned up or not based on the reference count. 
     519        // Now we can remove the current session. If an exception if thrown, 
     520        // there's not much we can do. 
     521        try { 
     522            current.adapter.remove(sessionId(principal.getName())); 
     523        } catch (Throwable t) { 
     524            // FIXME 
     525            log.error("Possible memory leak: can't remove service factory", t); 
     526        } 
     527 
    518528    } 
    519529 
    520530    /** 
    521      * Performs the actual cleanup operation. Since {@link #destroy()} is called 
    522      * non-discriminantly by the router, even when a client has just died, we 
    523      * have this internal method for handling the actual closing of resources. 
     531     * Performs the actual cleanup operation on all the resources shared between 
     532     * this and other {@link ServiceFactoryI} instances in the same 
     533     * {@link Session}. Since {@link #destroy()} is called regardless by the 
     534     * router, even when a client has just died, we have this internal method 
     535     * for handling the actual closing of resources. 
    524536     */ 
    525537    public void doDestroy(Ice.ObjectAdapter adapter) { 
    … …  
    534546        Set<String> ipIds = interactiveSlots.keySet(); 
    535547        for (String id : ipIds) { 
    536             InteractiveProcessorI ip = (InteractiveProcessorI) interactiveSlots 
    537                     .get(id); 
    538             ip.stop(); 
    539             adapter.remove(Ice.Util.stringToIdentity(id)); 
    540             interactiveSlots.remove(id); 
     548            InteractiveProcessorI ip = null; 
     549            try { 
     550                ip = (InteractiveProcessorI) interactiveSlots.get(id); 
     551                ip.stop(); 
     552            } catch (Exception e) { 
     553                log.error("Error stopping interactive processor: " + ip); 
     554            } finally { 
     555                adapter.remove(Ice.Util.stringToIdentity(id)); 
     556                interactiveSlots.remove(id); 
     557            } 
    541558        } 
    542559 
    … …  
    568585        } 
    569586 
    570         // All resources cleaned up to the best of our ability, 
    571         // now we can remove the current session. If an exception if thrown, 
    572         // there's not much we can do. 
    573         try { 
    574             adapter.remove(sessionId(principal.getName())); 
    575         } catch (Throwable t) { 
    576             // FIXME 
    577             InternalException ie = new InternalException(t.getMessage()); 
    578             ie.setStackTrace(t.getStackTrace()); 
    579         } 
    580587    } 
    581588 
    … …  
    710717            if (null == already) { 
    711718                current.adapter.add(servant, id); 
     719                if (log.isInfoEnabled()) { 
     720                    log.info("Created servant:" + servantString(id, servant)); 
     721                } 
    712722            } else { 
    713723                current.adapter.remove(id); 
    714724                current.adapter.add(servant, id); 
    715             } 
    716             if (log.isInfoEnabled()) { 
    717                 log.info("Created servant:" + servantString(id, servant)); 
     725                if (already.hashCode() != servant.hashCode()) { 
     726                    log.info(String.format("Replacing %s with %s", 
     727                            servantString(id, already), servantString(id, 
     728                                    servant))); 
     729                } 
    718730            } 
    719731        } catch (Exception e) { 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/