提交 16c09993 authored 作者: Thomas Mueller's avatar Thomas Mueller

Removed unused code and reduce visibility where possible.

上级 32e1650a
......@@ -28,14 +28,14 @@ public abstract class Command implements CommandInterface {
protected final Session session;
/**
* The trace module.
* The last start time.
*/
protected final Trace trace;
protected long startTime;
/**
* The last start time.
* The trace module.
*/
protected long startTime;
private final Trace trace;
/**
* If this query was canceled.
......@@ -46,7 +46,7 @@ public abstract class Command implements CommandInterface {
private boolean canReuse;
public Command(Parser parser, String sql) {
Command(Parser parser, String sql) {
this.session = parser.getSession();
this.sql = sql;
trace = session.getDatabase().getTrace(Trace.COMMAND);
......@@ -127,7 +127,7 @@ public abstract class Command implements CommandInterface {
*
* @throws SQLException if the statement has been canceled
*/
public void checkCanceled() {
protected void checkCanceled() {
if (cancel) {
cancel = false;
throw DbException.get(ErrorCode.STATEMENT_WAS_CANCELED);
......
......@@ -16,7 +16,7 @@ import org.h2.value.Value;
* Represents a single SQL statements.
* It wraps a prepared statement.
*/
public class CommandContainer extends Command {
class CommandContainer extends Command {
private Prepared prepared;
......
......@@ -13,12 +13,12 @@ import org.h2.result.ResultInterface;
/**
* Represents a list of SQL statements.
*/
public class CommandList extends Command {
class CommandList extends Command {
private final Command command;
private final String remaining;
public CommandList(Parser parser, String sql, Command c, String remaining) {
CommandList(Parser parser, String sql, Command c, String remaining) {
super(parser, sql);
this.command = c;
this.remaining = remaining;
......
......@@ -94,7 +94,7 @@ public class Comment extends DbObjectBase {
* @param obj the object
* @return the key name
*/
public static String getKey(DbObject obj) {
static String getKey(DbObject obj) {
return getTypeName(obj.getType()) + " " + obj.getSQL();
}
......
......@@ -284,7 +284,7 @@ public class ConnectionInfo implements Cloneable {
* @param defaultValue the default value
* @return the value
*/
public boolean getProperty(String key, boolean defaultValue) {
boolean getProperty(String key, boolean defaultValue) {
String x = getProperty(key, null);
if (x == null) {
return defaultValue;
......@@ -403,7 +403,7 @@ public class ConnectionInfo implements Cloneable {
* @param defaultValue the default value
* @return the value as a String
*/
public int getProperty(String key, int defaultValue) {
int getProperty(String key, int defaultValue) {
if (SysProperties.CHECK && !isKnownSetting(key)) {
DbException.throwInternalError(key);
}
......
......@@ -309,7 +309,7 @@ public class Database implements DataHandler {
* @return true if the call was successful,
* false if another connection was faster
*/
synchronized boolean reconnectModified(boolean pending) {
private synchronized boolean reconnectModified(boolean pending) {
if (readOnly || lock == null || fileLockMethod != FileLock.LOCK_SERIALIZED) {
return true;
}
......@@ -435,7 +435,7 @@ public class Database implements DataHandler {
* @param name the name of the database (including path)
* @return true if one exists
*/
public static boolean exists(String name) {
static boolean exists(String name) {
return IOUtils.exists(name + Constants.SUFFIX_PAGE_FILE);
}
......@@ -470,7 +470,7 @@ public class Database implements DataHandler {
* @param testHash the hash code
* @return true if the cipher algorithm and the password match
*/
public boolean validateFilePasswordHash(String testCipher, byte[] testHash) {
boolean validateFilePasswordHash(String testCipher, byte[] testHash) {
if (!StringUtils.equals(testCipher, this.cipher)) {
return false;
}
......@@ -919,7 +919,7 @@ public class Database implements DataHandler {
* @return the session
* @throws SQLException if the database is in exclusive mode
*/
public synchronized Session createSession(User user) {
synchronized Session createSession(User user) {
if (exclusiveSession != null) {
throw DbException.get(ErrorCode.DATABASE_IS_IN_EXCLUSIVE_MODE);
}
......@@ -1662,7 +1662,7 @@ public class Database implements DataHandler {
* @param session the session
* @param transaction the name of the transaction
*/
public void prepareCommit(Session session, String transaction) {
void prepareCommit(Session session, String transaction) {
if (readOnly) {
return;
}
......@@ -1676,7 +1676,7 @@ public class Database implements DataHandler {
*
* @param session the session
*/
public void commit(Session session) {
void commit(Session session) {
if (readOnly) {
return;
}
......@@ -1921,7 +1921,7 @@ public class Database implements DataHandler {
* Called after the database has been opened and initialized. This method
* notifies the event listener if one has been set.
*/
public void opened() {
void opened() {
if (eventListener != null) {
eventListener.opened();
}
......
......@@ -15,7 +15,7 @@ import org.h2.message.Trace;
* close a connection. A database closer object only exists if there is no user
* connected to the database.
*/
public class DatabaseCloser extends Thread {
class DatabaseCloser extends Thread {
private final boolean shutdownHook;
private final Trace trace;
......@@ -34,7 +34,7 @@ public class DatabaseCloser extends Thread {
* Stop and disable the database closer. This method is called after the
* database has been closed, or after a session has been created.
*/
public void reset() {
void reset() {
synchronized (this) {
databaseRef = null;
}
......
......@@ -229,7 +229,7 @@ public class Engine implements SessionFactory {
*
* @param name the database name
*/
public void close(String name) {
void close(String name) {
if (jmx) {
try {
Utils.callStaticMethod("org.h2.jmx.DatabaseInfo.unregisterMBean", name);
......
......@@ -19,7 +19,7 @@ public class Mode {
/**
* The name of the default mode.
*/
public static final String REGULAR = "REGULAR";
static final String REGULAR = "REGULAR";
private static final HashMap<String, Mode> MODES = New.hashMap();
......
......@@ -100,7 +100,7 @@ public abstract class RightOwner extends DbObjectBase {
*
* @param table the table
*/
public void revokeRight(Table table) {
void revokeRight(Table table) {
if (grantedRights == null) {
return;
}
......@@ -129,7 +129,7 @@ public abstract class RightOwner extends DbObjectBase {
* @param role the role to revoke
* @throws SQLException if the right has not been granted
*/
public void revokeRole(Role role) {
void revokeRole(Role role) {
if (grantedRoles == null) {
return;
}
......
......@@ -331,7 +331,7 @@ public class Session extends SessionWithState {
*
* @param constraint the constraint
*/
public void removeLocalTempTableConstraint(Constraint constraint) {
void removeLocalTempTableConstraint(Constraint constraint) {
if (localTempTableConstraints != null) {
localTempTableConstraints.remove(constraint.getName());
synchronized (database) {
......@@ -653,7 +653,7 @@ public class Session extends SessionWithState {
*
* @param t the table to unlock
*/
public void unlock(Table t) {
void unlock(Table t) {
locks.remove(t);
}
......@@ -746,7 +746,7 @@ public class Session extends SessionWithState {
* This method is called after the transaction log has written the commit
* entry for this session.
*/
public void setAllCommitted() {
void setAllCommitted() {
firstUncommittedLog = Session.LOG_WRITTEN;
firstUncommittedPos = Session.LOG_WRITTEN;
}
......
......@@ -11,7 +11,7 @@ import java.sql.SQLException;
/**
* A class that implements this interface can create new database sessions.
*/
public interface SessionFactory {
interface SessionFactory {
/**
* Create a new session.
......
......@@ -424,7 +424,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
* @param count the retry count index
* @return true if reconnected
*/
public boolean autoReconnect(int count) {
private boolean autoReconnect(int count) {
if (!isClosed()) {
return false;
}
......
......@@ -15,7 +15,7 @@ import org.h2.value.Value;
/**
* The base class for both remote and embedded sessions.
*/
public abstract class SessionWithState implements SessionInterface {
abstract class SessionWithState implements SessionInterface {
protected ArrayList<String> sessionState;
protected boolean sessionStateChanged;
......
......@@ -87,7 +87,7 @@ public class SettingsBase {
* @param k the key
* @return true if they do
*/
public boolean containsKey(String k) {
protected boolean containsKey(String k) {
return settings.containsKey(k);
}
......
......@@ -35,7 +35,7 @@ public class UndoLog {
*
* @param session the session
*/
public UndoLog(Session session) {
UndoLog(Session session) {
this.database = session.getDatabase();
largeTransactions = database.getSettings().largeTransactions;
}
......@@ -45,7 +45,7 @@ public class UndoLog {
*
* @return the number of rows
*/
public int size() {
int size() {
if (largeTransactions) {
return storedEntries + records.size();
}
......@@ -59,7 +59,7 @@ public class UndoLog {
* Clear the undo log. This method is called after the transaction is
* committed.
*/
public void clear() {
void clear() {
records.clear();
storedEntries = 0;
storedEntriesPos.clear();
......@@ -136,7 +136,7 @@ public class UndoLog {
*
* @param trimToSize if the undo array should shrink to conserve memory
*/
public void removeLast(boolean trimToSize) {
void removeLast(boolean trimToSize) {
int i = records.size() - 1;
UndoLogRecord r = records.remove(i);
if (!r.isStored()) {
......@@ -152,7 +152,7 @@ public class UndoLog {
*
* @param entry the entry
*/
public void add(UndoLogRecord entry) {
void add(UndoLogRecord entry) {
records.add(entry);
if (largeTransactions) {
memoryUndo++;
......
......@@ -44,7 +44,7 @@ public class UndoLogRecord {
* @param op the operation type
* @param row the row that was deleted or inserted
*/
public UndoLogRecord(Table table, short op, Row row) {
UndoLogRecord(Table table, short op, Row row) {
this.table = table;
this.row = row;
this.operation = op;
......@@ -80,7 +80,7 @@ public class UndoLogRecord {
*
* @param session the session
*/
public void undo(Session session) {
void undo(Session session) {
Database db = session.getDatabase();
switch (operation) {
case INSERT:
......@@ -252,7 +252,7 @@ public class UndoLogRecord {
* This method is called after the operation was committed.
* It commits the change to the indexes.
*/
public void commit() {
void commit() {
table.commit(operation, row);
}
......
......@@ -177,7 +177,7 @@ public class User extends RightOwner {
* @param userPasswordHash the password data (the user password hash)
* @return true if the user password hash is correct
*/
public boolean validateUserPasswordHash(byte[] userPasswordHash) {
boolean validateUserPasswordHash(byte[] userPasswordHash) {
if (userPasswordHash.length == 0 && passwordHash.length == 0) {
return true;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论