This commit is contained in:
Ammar Askar
2012-11-07 18:28:03 +05:00
parent 6fb7077826
commit cf0688050f
5 changed files with 17 additions and 19 deletions

View File

@@ -38,7 +38,7 @@ public class DumpedLogImporter implements Runnable
for (final File sqlFile : imports) {
getLogger().info("Trying to import " + sqlFile.getName() + " ...");
final BufferedReader reader = new BufferedReader(new FileReader(sqlFile));
String line = null;
String line;
while ((line = reader.readLine()) != null)
try {
st.execute(line);

View File

@@ -544,7 +544,6 @@ public final class QueryParams implements Cloneable
value += args.get(j) + " ";
}
continue;
} else {
// The value ends with a double quote

View File

@@ -141,7 +141,7 @@ public class WorldEditor implements Runnable
if (!block.setTypeId(0))
throw new WorldEditorException(block.getTypeId(), 0, block.getLocation());
} else if (ca != null && (type == 23 || type == 54 || type == 61 || type == 62)) {
int leftover = 0;
int leftover;
try {
leftover = modifyContainer(state, new ItemStack(ca.itemType, -ca.itemAmount, (short)0, ca.itemData));
if (leftover > 0)

View File

@@ -28,10 +28,9 @@ import java.util.concurrent.locks.ReentrantLock;
public class MySQLConnectionPool implements Closeable
{
private final static int poolsize = 10;
private final static int poolSize = 10;
private final static long timeToLive = 300000;
private final Vector<JDCConnection> connections;
private final ConnectionReaper reaper;
private final String url, user, password;
private final Lock lock = new ReentrantLock();
@@ -40,9 +39,9 @@ public class MySQLConnectionPool implements Closeable
this.url = url;
this.user = user;
this.password = password;
connections = new Vector<JDCConnection>(poolsize);
reaper = new ConnectionReaper();
reaper.start();
connections = new Vector<JDCConnection>(poolSize);
ConnectionReaper reaper = new ConnectionReaper();
new Thread(reaper, "MySQL Connection Reaper Thread - LogBlock").start();
}
@Override
@@ -95,7 +94,7 @@ public class MySQLConnectionPool implements Closeable
lock.unlock();
}
private class ConnectionReaper extends Thread
private class ConnectionReaper implements Runnable
{
@Override
public void run() {
@@ -112,14 +111,14 @@ public class MySQLConnectionPool implements Closeable
private class JDCConnection implements Connection
{
private final Connection conn;
private boolean inuse;
private boolean inUse;
private long timestamp;
private int networkTimeout;
private String schema;
JDCConnection(Connection conn) {
this.conn = conn;
inuse = false;
inUse = false;
timestamp = 0;
networkTimeout = 30;
schema = "default";
@@ -132,12 +131,12 @@ public class MySQLConnectionPool implements Closeable
@Override
public void close() {
inuse = false;
inUse = false;
try {
if (!conn.getAutoCommit())
conn.setAutoCommit(true);
} catch (final SQLException ex) {
connections.remove(conn);
connections.remove(this);
terminate();
}
}
@@ -407,7 +406,7 @@ public class MySQLConnectionPool implements Closeable
}
boolean inUse() {
return inuse;
return inUse;
}
boolean isValid() {
@@ -419,9 +418,9 @@ public class MySQLConnectionPool implements Closeable
}
synchronized boolean lease() {
if (inuse)
if (inUse)
return false;
inuse = true;
inUse = true;
timestamp = System.currentTimeMillis();
return true;
}

View File

@@ -118,10 +118,10 @@ public class Utils
if (s == null || s.length == 0)
return "";
final int len = s.length;
final StringBuffer buffer = new StringBuffer(s[0]);
final StringBuilder builder = new StringBuilder(s[0]);
for (int i = 1; i < len; i++)
buffer.append(delimiter).append(s[i]);
return buffer.toString();
builder.append(delimiter).append(s[i]);
return builder.toString();
}
public static class ExtensionFilenameFilter implements FilenameFilter