core/src/main/java/org/commonjava/indy/core/expire/TimeoutEventListener.java
public void onExpirationEvent( @Observes final SchedulerEvent event )
    {
        if ( !(event instanceof SchedulerTriggerEvent) || !event.getJobType()
                                                                         .equals( ScheduleManager.CONTENT_JOB_TYPE ) )
        {
            return;
        }

        ContentExpiration expiration;
        try
        {
            expiration = objectMapper.readValue( event.getPayload(), ContentExpiration.class );
        }
        catch ( final IOException e )
        {
            logger.error( "Failed to read ContentExpiration from event payload.", e );
            return;
        }

        final StoreKey key = expiration.getKey();
        final String path = expiration.getPath();
        try
        {
            ArtifactStore store = storeManager.getArtifactStore( key );
            if ( store == null )
            {
                logger.warn( "Store: {} is no longer available. Nothing to do for path: {}", key, path );
            }

            boolean deleted = store == null || contentManager.delete( store, path );

            if ( !deleted )
            {
                logger.error("Failed to delete Transfer for: {} in: {} (for content timeout).", path, key );
            }
            else
            {
                deleteExpiration( key, path );
            }
        }
        catch ( IndyWorkflowException e )
        {
            logger.error(
                    String.format( "Failed to retrieve Transfer for: %s in: %s (for content timeout). Reason: %s", path,
                                   key, e ), e );
        }
        catch ( IndyDataException e )
        {
            scheduleManager.deleteJob( scheduleManager.groupName( key, ScheduleManager.CONTENT_JOB_TYPE ), path );
            logger.error(
                    String.format( "Failed to retrieve ArtifactStore for: %s (for content timeout). Reason: %s", key, e ), e );
        }
    }
public void onExpirationEvent( @Observes final SchedulerEvent event )
    {
        if ( !(event instanceof SchedulerTriggerEvent) || !event.getJobType()
                                                                         .equals( ScheduleManager.CONTENT_JOB_TYPE ) )
        {
            return;
        }

        ContentExpiration expiration;
        try
        {
            expiration = objectMapper.readValue( event.getPayload(), ContentExpiration.class );
        }
        catch ( final IOException e )
        {
            logger.error( "Failed to read ContentExpiration from event payload.", e );
            return;
        }

        final StoreKey key = expiration.getKey();
        final String path = expiration.getPath();
        try
        {
            ArtifactStore store = storeManager.getArtifactStore( key );
            if ( store == null )
            {
                logger.warn( "Store: {} is no longer available. Nothing to do for path: {}", key, path );
            }

            boolean deleted = store == null || contentManager.delete( store, path );

            if ( !deleted )
            {
                logger.error("Failed to delete Transfer for: {} in: {} (for content timeout).", path, key );
            }
            else
            {
                deleteExpiration( key, path );
            }
        }
        catch ( IndyWorkflowException e )
        {
            logger.error(
                    String.format( "Failed to retrieve Transfer for: %s in: %s (for content timeout). Reason: %s", path,
                                   key, e ), e );
        }
        catch ( IndyDataException e )
        {
            scheduleManager.deleteJob( scheduleManager.groupName( key, ScheduleManager.CONTENT_JOB_TYPE ), path );
            logger.error(
                    String.format( "Failed to retrieve ArtifactStore for: %s (for content timeout). Reason: %s", key, e ), e );
        }
    }
public void onExpirationEvent ( @ Observes final SchedulerEvent event ) { if ( ! ( event instanceof SchedulerTriggerEvent ) || ! event . getJobType ( ) . equals ( ScheduleManager . CONTENT_JOB_TYPE ) ) { return ; } ContentExpiration expiration ; try { expiration = objectMapper . readValue ( event . getPayload ( ) , ContentExpiration . class ) ; } catch ( final IOException e ) { logger . error ( "Failed to read ContentExpiration from event payload." , e ) ; return ; } final StoreKey key = expiration . getKey ( ) ; final String path = expiration . getPath ( ) ; try { ArtifactStore store = storeManager . getArtifactStore ( key ) ; if ( store == null ) { logger . warn ( "Store: {} is no longer available. Nothing to do for path: {}" , key , path ) ; } boolean deleted = store == null || contentManager . delete ( store , path ) ; if ( ! deleted ) { logger . error ( "Failed to delete Transfer for: {} in: {} (for content timeout)." , path , key ) ; } else { deleteExpiration ( key , path ) ; } } catch ( IndyWorkflowException e ) { logger . error ( String . format ( "Failed to retrieve Transfer for: %s in: %s (for content timeout). Reason: %s" , path , key , e ) , e ) ; } catch ( IndyDataException e ) { scheduleManager . deleteJob ( scheduleManager . groupName ( key , ScheduleManager . CONTENT_JOB_TYPE ) , path ) ; logger . error ( String . format ( "Failed to retrieve ArtifactStore for: %s (for content timeout). Reason: %s" , key , e ) , e ) ; } }
private Executor executor;
private Executor executor ;