Added closes to connections in RepositoryBase that use DataSource.

This commit is contained in:
Jonathan Williams 2015-03-06 04:12:46 -08:00
parent c15c6e2dd8
commit 90dbd64b17
1 changed files with 31 additions and 1 deletions

View File

@ -161,6 +161,16 @@ public abstract class RepositoryBase implements Listener
e.printStackTrace();
}
}
try
{
if (DataSource != null)
_connection.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
return affectedRows;
@ -203,6 +213,16 @@ public abstract class RepositoryBase implements Listener
e.printStackTrace();
}
}
try
{
if (DataSource != null)
_connection.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
@ -240,6 +260,16 @@ public abstract class RepositoryBase implements Listener
e.printStackTrace();
}
}
try
{
if (DataSource != null)
_connection.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
@ -314,7 +344,7 @@ public abstract class RepositoryBase implements Listener
@EventHandler
public void validateConnection(UpdateEvent event)
{
if (event.getType() != UpdateType.MIN_02)
if (event.getType() != UpdateType.MIN_02 || DataSource != null)
return;
Bukkit.getScheduler().runTaskAsynchronously(Plugin, new Runnable()