/** * Increment the lease requests. */ void incrementLeaseRequests() { m_leaseRequestsInstrument.increment(); }
/** * Return a reference of the desired Component * @param component the component */ public void put( final Object component ) { if ( !m_prepared ) { final String message = "You cannot put a component in an uninitialized holder"; throw new IllegalStateException( message ); } if ( m_release.isActive() ) { m_release.increment(); } doPut( component ); }
m_putsInstrument.increment(); m_referencesInstrument.setValue( m_references );
/** * Get an instance of the type of component handled by this handler. * <p> * Subclasses should not extend this method but rather the doGet method below otherwise * reference counts will not be supported. * <p> * This method is not final to make the class backwards compatible. * * @return a <code>Component</code> * @exception Exception if an error occurs */ public Component get() throws Exception { Component component = doGet(); synchronized( m_referenceSemaphore ) { m_references++; } // Notify the instrument manager m_getsInstrument.increment(); m_referencesInstrument.setValue( m_references ); return component; }
m_instrumentRequests.increment();
/** * Get a reference of the desired Component * @return the component */ public Object get() throws Exception { if ( !m_prepared ) { prepareHandler(); } if ( m_disposed ) { final String message = "You cannot get a component from a disposed holder"; throw new IllegalStateException( message ); } if ( m_request.isActive() ) { m_request.increment(); } return doGet(); }
m_instrumentRequests.increment();
/** * Create a new poolable instance by by calling the newInstance method * on the pool's ObjectFactory. * <p> * This is the method to override when you need to enforce creational * policies. * <p> * This method is only called by threads that have m_semaphore locked. */ protected Poolable newPoolable() throws Exception { Object obj = m_factory.newInstance(); // Notify the InstrumentManager m_createsInstrument.increment(); // The size is incremented after this call in case an error is thrown. m_sizeInstrument.setValue( getSize() + 1 ); return (Poolable)obj; }
/** * Disposal of the supplied component instance. * @param component the component to dispose of * @exception Exception if a disposal error occurs */ public final void dispose( final Object component ) throws Exception { if ( getLogger().isDebugEnabled() ) { final String message = "ComponentFactory decommissioning instance of " + getCreatedClass().getName() + "."; getLogger().debug( message ); } if ( getCreatedClass().equals( component.getClass() ) ) { ContainerUtil.shutdown( component ); m_extManager.executeDestructionExtensions( component, m_context ); if ( m_dispose.isActive() ) { m_dispose.increment(); } } else { final String message = "The object given to be disposed does " + "not come from this ObjectFactory"; throw new IllegalArgumentException( message ); } }
m_stateSavesInstrument.increment(); m_stateSaveTimeInstrument.setValue( (int)( System.currentTimeMillis() - now ) );
m_putsInstrument.increment(); m_readySizeInstrument.setValue( readySize );
m_registrationsInstrument.increment();
/** * Called when an object is being removed permanently from the pool. * This is the method to override when you need to enforce destructional * policies. * <p> * This method is only called by threads that have m_semaphore locked. * * @param poolable Poolable to be completely removed from the pool. */ protected void removePoolable( Poolable poolable ) { try { m_factory.decommission( poolable ); // Notify the InstrumentManager m_decommissionsInstrument.increment(); m_sizeInstrument.setValue( getSize() ); } catch( Exception e ) { if( getLogger().isDebugEnabled() ) { getLogger().debug( "Error decommissioning object", e ); } } }