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

View File

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