Package org.apache.ws.util.lock

Examples of org.apache.ws.util.lock.Lock


    {

        LOG.debug( MSG.getMessage( Keys.FINDING_RESOURCE_WITH_KEY, String.valueOf( key ) ) );

        Resource resource = null;
        Lock lock = getLock( key );
        try
        {
            lock.acquire();
        }
        catch ( InterruptedException ie )
        {
            throw new ResourceException( ie );
        }

        try
        {
            resource = get( key );
            if ( m_cache != null )
            {
                m_cache.update( resource );
            }
        }
        finally
        {
            lock.release();
        }

        return resource;
    }
View Full Code Here


        return resource;
    }

    private Lock getLock( ResourceKey key )
    {
        Lock lock;
        Object lockKey = getLookupKey( key );
        lock = m_lockManager.getLock( lockKey );
        return lock;
    }
View Full Code Here

    public void remove( ResourceKey key )
            throws ResourceException
    {

        Resource resource = null;
        Lock lock = getLock( key );
        try
        {
            lock.acquire();
        }
        catch ( InterruptedException ie )
        {
            throw new ResourceException( ie );
        }

        try
        {
            resource = get( key );

            try
            {
                resource.destroy();
            }
            catch ( RuntimeException re )
            {
                throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_DESTROY_RESOURCE, resource, re ) );
            }

            m_resources.remove( getLookupKey( key ) );
            notifyResourceDeletedListeners( resource.getEndpointReference() );

            LOG.debug( MSG.getMessage( Keys.REMOVED_RESOURCE_WITH_KEY, resource.getClass().getName(),
                    String.valueOf( key ) ) );
            if ( m_cache != null )
            {
                m_cache.remove( resource );
            }
        }
        finally
        {
            lock.release();
        }

    }
View Full Code Here

   {

      LOG.debug(MSG.getMessage(Keys.FINDING_RESOURCE_WITH_KEY, String.valueOf(key)));

      Resource resource = null;
      Lock lock = getLock(key);
       try
      {
         lock.acquire(  );
      }
      catch ( InterruptedException e )
      {
         throw new ResourceException( e );
      }

      try
      {
         resource = get( key );
         if ( m_cache != null )
         {
            m_cache.update( resource );
         }
      }
      finally
      {
         lock.release(  );
      }

      return resource;
   }
View Full Code Here

      return resource;
   }

    private Lock getLock(ResourceKey key)
    {
        Lock lock;
        Object lockKey = getLookupKey(key);
        lock = m_lockManager.getLock( lockKey );
        return lock;
    }
View Full Code Here

   public void remove( ResourceKey key )
   throws ResourceException
   {

      Resource resource = null;
      Lock  lock = getLock(key);
       try
      {
         lock.acquire(  );
      }
      catch ( InterruptedException ie )
      {
         throw new ResourceException( ie );
      }

      try
      {
         resource = get( key );

            try
            {
               resource.destroy(  );
            }
            catch ( RuntimeException re )
            {
               throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_DESTROY_RESOURCE, resource, re ));
            }


         m_resources.remove( getLookupKey(key) );

         LOG.debug( MSG.getMessage( Keys.REMOVED_RESOURCE_WITH_KEY, resource.getClass(  ).getName(  ) ,String.valueOf(key) ));
         if ( m_cache != null )
         {
            m_cache.remove( resource );
         }
      }
      finally
      {
         lock.release(  );
      }

      // TODO: send resource-terminated notification
   }
View Full Code Here

   {

      LOG.debug(MSG.getMessage(Keys.FINDING_RESOURCE_WITH_KEY, String.valueOf(key)));

      Resource resource = null;
      Lock lock = getLock(key);
       try
      {
         lock.acquire(  );
      }
      catch ( InterruptedException e )
      {
         throw new ResourceException( e );
      }

      try
      {
         resource = get( key );
         if ( m_cache != null )
         {
            m_cache.update( resource );
         }
      }
      finally
      {
         lock.release(  );
      }

      return resource;
   }
View Full Code Here

      return resource;
   }

    private Lock getLock(ResourceKey key)
    {
        Lock lock;
        Object lockKey = getLookupKey(key);
        lock = m_lockManager.getLock( lockKey );
        return lock;
    }
View Full Code Here

   public void remove( ResourceKey key )
   throws ResourceException
   {

      Resource resource = null;
      Lock  lock = getLock(key);
       try
      {
         lock.acquire(  );
      }
      catch ( InterruptedException ie )
      {
         throw new ResourceException( ie );
      }

      try
      {
         resource = get( key );

            try
            {
               resource.destroy(  );
            }
            catch ( RuntimeException re )
            {
               throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_DESTROY_RESOURCE, resource, re ));
            }


         m_resources.remove( getLookupKey(key) );

         LOG.debug( MSG.getMessage( Keys.REMOVED_RESOURCE_WITH_KEY, resource.getClass(  ).getName(  ) ,String.valueOf(key) ));
         if ( m_cache != null )
         {
            m_cache.remove( resource );
         }
      }
      finally
      {
         lock.release(  );
      }

      // TODO: send resource-terminated notification
   }
View Full Code Here

   public void remove( Object resourceId )
   throws ResourceUnknownException,
          ResourceException
   {
      Resource resource = null;
      Lock     lock = acquireLock( resourceId );
      try
      {
         resource = get( resourceId );

         try
         {
            resource.destroy(  );
         }
         catch ( RuntimeException re )
         {
            throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_DESTROY_RESOURCE, resource, re ) );
         }

         Resource removedResource = (Resource) m_resources.remove( getNonNullKey( resourceId ) );
         if ( removedResource instanceof PropertiesResource )
         {
            notifyResourceDeletedListeners( removedResource );
         }

         LOG.debug( MSG.getMessage( Keys.REMOVED_RESOURCE_WITH_KEY,
                                    resource.getClass(  ).getName(  ),
                                    String.valueOf( resourceId ) ) );
         if ( m_cache != null )
         {
            m_cache.remove( resource );
         }
      }
      finally
      {
         lock.release(  );
      }
   }
View Full Code Here

TOP

Related Classes of org.apache.ws.util.lock.Lock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.