Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlo Barbara carlo-rtr

View GitHub Profile
View gist:7371834
package com.rtr.services.example;
import java.util.Date;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
@carlo-rtr
carlo-rtr / gist:6076182
Created Jul 25, 2013
java.sql.SQLException: Already closed.
View gist:6076182
org.hibernate.exception.GenericJDBCException: Could not close connection
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) ~[commerce-service-0.1.0-SNAPSHOT.jar:na]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) ~[commerce-service-0.1.0-SNAPSHOT.jar:na]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) ~[commerce-service-0.1.0-SNAPSHOT.jar:na]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.releaseConnection(LogicalConnectionImpl.java:327) ~[commerce-service-0.1.0-SNAPSHOT.jar:na]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.close(LogicalConnectionImpl.java:199) ~[commerce-service-0.1.0-SNAPSHOT.jar:na]
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:141) ~[commerce-service-0.1.0-SNAPSHOT.jar:na]
at org.hibernate.engine.transaction.internal.Trans
@carlo-rtr
carlo-rtr / gist:6074470
Last active Dec 20, 2015
Dropwizard GenericObjectPool configuration
View gist:6074470
/*
Returns the maximum amount of time (in milliseconds) the borrowObject() method should block before throwing an exception when the pool is exhausted and the "when exhausted" action is WHEN_EXHAUSTED_BLOCK.
Defaulted to 1 second by DW
*/
pool.setMaxWait(configuration.getMaxWaitForConnection().toMilliseconds());
/*
Returns the minimum number of objects allowed in the pool before the evictor thread (if active) spawns new objects.
@carlo-rtr
carlo-rtr / DropwizardDAOTest
Created Nov 15, 2012
DAO Testing with Dropwizard hibernate
View DropwizardDAOTest
package com.rtr.infra.wizard.test;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.context.internal.ManagedSessionContext;
import org.junit.After;
import org.junit.Before;
public abstract class DropwizardDAOTest {