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"); } } } } } } }
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); } } } }
/** * * @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(); } }
/** * 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); } }
public void closeAnalysisKeyspaceSession(@Disposes FileSystem session) { try { session.close(); } catch (IOException e) { logger.warn("Could not close Hadoop file system.", e); } }
public void closeDuctileGraph(@Disposes DuctileGraph ductileGraph) { try { ductileGraph.close(); } catch (IOException e) { logger.warn("Could not close Ductile Graph.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @EvaluatorStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @AnalysisServiceConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closePreferencesStoreSession(@Disposes @PreferencesStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @PluginsDatabaseConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @AccountManagerConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @PasswordStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @SystemMonitorConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession( @Disposes @IntermediateCoCoMoEvaluatorStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @BasicCoCoMoEvaluatorStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @McCabeMetricEvaluatorStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @SLOCEvaluatorStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession(@Disposes @HalsteadMetricEvaluatorStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void closeAnalysisKeyspaceSession( @Disposes @MaintainabilityIndexEvaluatorStoreConnection Connection connection) { try { connection.close(); } catch (SQLException e) { logger.warn("Could not close connection to Phoenix/HBase.", e); } }
public void dispose(@Disposes EntityManager entityManager) { if ( entityManager.isOpen() ) { entityManager.close(); } }
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())); } } }
public void close(@Disposes @Omakase HttpClient httpClient) { httpClient.getConnectionManager().shutdown(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Shutdown Pooled HTTP Client"); } }
/** * 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(); } }
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(); } }
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(); }
/** * 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(); }
/** * 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; } }
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!"); } }
@ApplicationScoped public void commitAndClose(@Disposes EntityManager em) { try { em.close(); } catch (Exception e) { } }
protected void closeEntityManager(@Disposes EntityManager entityManager) { if (entityManager.isOpen()) { entityManager.close(); } closeEntityManagerCount++; }
protected void closeEntityManager(@Disposes @First EntityManager entityManager) { if (entityManager.isOpen()) { entityManager.close(); } closeEntityManagerCount++; }
protected void closeDefaultEntityManager(@Disposes @Default EntityManager entityManager) { if (entityManager.isOpen()) { entityManager.close(); } closeEntityManagerCountDefaultEntityManager++; }
protected void closeFirstEntityManager(@Disposes @First EntityManager entityManager) { if (entityManager.isOpen()) { entityManager.close(); } closeEntityManagerCountFirstEntityManager++; }
protected void closeSecondEntityManager(@Disposes @Second EntityManager entityManager) { if (entityManager.isOpen()) { entityManager.close(); } closeEntityManagerCountSecondEntityManager++; }