Java 类javax.enterprise.inject.Disposes 实例源码

项目:tomee    文件:CdiPlugin.java   
private static void validateDisposeMethods(final CdiEjbBean<?> bean) {
    if (!bean.getBeanContext().isLocalbean()) {
        for (final Method m : bean.getBeanContext().getBeanClass().getMethods()) {
            if (m.getDeclaringClass().equals(Object.class)) {
                continue;
            }

            if (m.getParameterTypes().length > 0) {
                for (final Annotation[] a : m.getParameterAnnotations()) {
                    for (final Annotation ann : a) {
                        if (ann.annotationType().equals(Disposes.class) && doResolveViewMethod(bean, m) == null) {
                            throw new WebBeansConfigurationException("@Disposes is forbidden on non business EJB methods");
                        }
                    }
                }
            }
        }
    }
}
项目:deltaspike    文件:InjectableResourceProducer.java   
public void closeInputStream(@Disposes
                             @InjectableResource(resourceProvider = InjectableResourceProvider.class, location = "")
                             InputStream inputStream)
{
    if (inputStream != null)
    {
        try
        {
            inputStream.close();
        }
        catch (IOException e)
        {
            if (logger.isLoggable(Level.FINE))
            {
                logger.log(Level.FINE,"Unable to close input stream ",e);
            }
        }
    }
}
项目:cito    文件:SchedulerProducer.java   
/**
 * 
 * @param scheduler
 */
public void dispose(@Disposes ScheduledExecutorService scheduler) {
    scheduler.shutdown();
    try {
        if (!scheduler.awaitTermination(1, TimeUnit.MINUTES)) {
            this.log.warn("Shutdown did not complete in time!");
        }
    } catch (InterruptedException e) {
        this.log.warn("Shutdown interrupted!", e);
        Thread.currentThread().interrupt();
    }
}
项目:mqtt-camunda-bpm    文件:MqttClientProducer.java   
/**
 * Shuts down the MQTT client.
 * 
 * @param client
 *            client to shut down.
 */
public void destroy(@Disposes MqttClient client) {
    try {
        if (client != null) {
            client.disconnect();
            logger.info("Disconnected from broker: " + broker);
        }
    } catch (MqttException e) {
        logger.error("Error disconnecting", e);
    }
}
项目:Purifinity    文件:FileSystemProducter.java   
public void closeAnalysisKeyspaceSession(@Disposes FileSystem session) {
try {
    session.close();
} catch (IOException e) {
    logger.warn("Could not close Hadoop file system.", e);
}
   }
项目:Purifinity    文件:DuctileGraphProducer.java   
public void closeDuctileGraph(@Disposes DuctileGraph ductileGraph) {
try {
    ductileGraph.close();
} catch (IOException e) {
    logger.warn("Could not close Ductile Graph.", e);
}
   }
项目:Purifinity    文件:EvaluatorStoreConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @EvaluatorStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:AnalysisServiceConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @AnalysisServiceConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:PreferencesStoreConnectionProducer.java   
public void closePreferencesStoreSession(@Disposes @PreferencesStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:PluginsDatabaseConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @PluginsDatabaseConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:AccountManagerConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @AccountManagerConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:PasswordStoreConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @PasswordStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:SystemMonitorConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @SystemMonitorConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:ConnectionProducer.java   
public void closeAnalysisKeyspaceSession(
    @Disposes @IntermediateCoCoMoEvaluatorStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:ConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @BasicCoCoMoEvaluatorStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:ConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @McCabeMetricEvaluatorStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:ConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @SLOCEvaluatorStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:ConnectionProducer.java   
public void closeAnalysisKeyspaceSession(@Disposes @HalsteadMetricEvaluatorStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:Purifinity    文件:ConnectionProducer.java   
public void closeAnalysisKeyspaceSession(
    @Disposes @MaintainabilityIndexEvaluatorStoreConnection Connection connection) {
try {
    connection.close();
} catch (SQLException e) {
    logger.warn("Could not close connection to Phoenix/HBase.", e);
}
   }
项目:parco    文件:EntityManagerProducer.java   
public void dispose(@Disposes EntityManager entityManager) 
{
     if ( entityManager.isOpen() )
     {
          entityManager.close();
     }
}
项目:eclipselink-example    文件:ApplicationManagedEntityManagerProducer.java   
public void dispose(@Disposes EntityManager entityManager) {
    if (log.isTraceEnabled()) {
        log.trace(String.format("[Lifecycle][@Disposes] entityManager=%s", entityManager.toString()));
    }
    if (entityManager.isOpen()) {
        entityManager.close();
        if (log.isTraceEnabled()) {
            log.trace(String.format("[Lifecycle][@Disposes.closed] entityManager=%s", entityManager.toString()));
        }
    }
}
项目:omakase    文件:HttpClientProducer.java   
public void close(@Disposes @Omakase HttpClient httpClient) {
    httpClient.getConnectionManager().shutdown();

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Shutdown Pooled HTTP Client");
    }
}
项目:omakase    文件:HttpClientProducer.java   
public void close(@Disposes @Omakase HttpClient httpClient) {
    httpClient.getConnectionManager().shutdown();

    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Shutdown Pooled HTTP Client");
    }
}
项目:exemplos    文件:EntityManagerProducer.java   
/**
 * Encerra um entityManager ja utilizado pelo sistema
 *
 * @param entityManager o entity manager a ser encerrado
 */
void dispose(@Disposes EntityManager entityManager) {
    if (entityManager.isOpen()) {
        entityManager.clear();
        entityManager.close();
    }
}
项目:exemplos    文件:EntityManagerProducer.java   
/**
 * Encerra um entityManager ja utilizado pelo sistema
 *
 * @param entityManager o entity manager a ser encerrado
 */
void dispose(@Disposes EntityManager entityManager) {
    if (entityManager.isOpen()) {
        entityManager.clear();
        entityManager.close();
    }
}
项目:esb-message-admin    文件:EntityManagerProvider.java   
public void closeEntityManager(@Disposes EntityManager em) {
    /* if running in a lightweight container (such as jetty), commit the
     * transaction and close the EntityManager */
    if (entityManagerFactory != null) {
        em.getTransaction().commit();
        em.close();
    }
}
项目:web-budget    文件:EntityManagerProducer.java   
/**
 * Encerra um entityManager ja utilizado pelo sistema
 *
 * @param entityManager o entity manager a ser encerrado
 */
void dispose(@Disposes EntityManager entityManager) {
    if (entityManager.isOpen()) {
        entityManager.clear();
        entityManager.close();
    }
}
项目:restful-and-beyond-tut2184    文件:LongPersistence.java   
public void cleanEM(@Disposes EntityManager entityManager) {
    logger.info("Disposing an entity manager "+entityManager);
    EntityTransaction et = entityManager.getTransaction();
    if(et.getRollbackOnly()) {
        et.rollback();
    }
    else {
        et.commit();
    }
    entityManager.close();
}
项目:restful-and-beyond-tut2184    文件:ShortPersistence.java   
public void cleanEM(@Disposes EntityManager entityManager) {
    logger.info("Disposing an entity manager "+entityManager);
    EntityTransaction et = entityManager.getTransaction();
    if(et.getRollbackOnly()) {
        et.rollback();
    }
    else {
        et.commit();
    }
    entityManager.close();
}
项目:ViTA    文件:Model.java   
/**
 * Closes the given EntityManager when it is disposed.
 *
 * @param instance - the instance of EntityManager to be disposed
 */
@Override
public void dispose(@Disposes EntityManager instance) {
  if (!instance.isOpen()) {
    return;
  }

  instance.close();
}
项目:web-budget    文件:EntityManagerProducer.java   
/**
 * Encerra um entityManager ja utilizado pelo sistema
 *
 * @param entityManager o entity manager a ser encerrado
 */
void dispose(@Disposes EntityManager entityManager) {
    if (entityManager.isOpen()) {
        entityManager.clear();
        entityManager.close();
    }
}
项目:jbromo    文件:CdiEntityManagerProducer.java   
/**
 * Close the entity manager.
 *
 * @param entityManager
 *            the manager to close.
 */
protected void closeEntityManager(
        @Disposes final EntityManager entityManager) {
    log.info("Closing an entity manager.");
    if (entityManager != null && entityManager.isOpen()) {
        entityManager.close();
    }
    if (this.entityManager == entityManager) {
        this.entityManager = null;
    }
}
项目:tomee    文件:LogFactory.java   
public void closeLogHandler(@Disposes LogHandler handler) {
    switch (type) {
        case 1:
            System.out.println("Closing File handler!");
            break;
        case 2:
            System.out.println("Closing DB handler!");
            break;
        case 3:
        default:
            System.out.println("Closing Console handler!");
    }
}
项目:dtgov    文件:ApplicationScopedProducer.java   
@ApplicationScoped
public void commitAndClose(@Disposes EntityManager em) {
    try {
        em.close();
    } catch (Exception e) {

    }
}
项目:deltaspike    文件:TestEntityManagerProducer.java   
protected void closeEntityManager(@Disposes EntityManager entityManager)
{
    if (entityManager.isOpen())
    {
        entityManager.close();
    }
    closeEntityManagerCount++;
}
项目:deltaspike    文件:TestEntityManagerProducer.java   
protected void closeEntityManager(@Disposes @First EntityManager entityManager)
{
    if (entityManager.isOpen())
    {
        entityManager.close();
    }
    closeEntityManagerCount++;
}
项目:deltaspike    文件:TestEntityManagerProducer.java   
protected void closeEntityManager(@Disposes EntityManager entityManager)
{
    if (entityManager.isOpen())
    {
        entityManager.close();
    }
    closeEntityManagerCount++;
}
项目:deltaspike    文件:TestEntityManagerProducer.java   
protected void closeDefaultEntityManager(@Disposes @Default EntityManager entityManager)
{
    if (entityManager.isOpen())
    {
        entityManager.close();
    }
    closeEntityManagerCountDefaultEntityManager++;
}
项目:deltaspike    文件:TestEntityManagerProducer.java   
protected void closeFirstEntityManager(@Disposes @First EntityManager entityManager)
{
    if (entityManager.isOpen())
    {
        entityManager.close();
    }
    closeEntityManagerCountFirstEntityManager++;
}
项目:deltaspike    文件:TestEntityManagerProducer.java   
protected void closeSecondEntityManager(@Disposes @Second EntityManager entityManager)
{
    if (entityManager.isOpen())
    {
        entityManager.close();
    }
    closeEntityManagerCountSecondEntityManager++;
}