提交 f2afe926 authored 作者: noelgrandin's avatar noelgrandin

Make fields final where appropriate.

Found by UCDetector, which seems to have gotten smarter recently.
上级 e5692ca7
...@@ -30,9 +30,9 @@ import org.h2.value.ValueBoolean; ...@@ -30,9 +30,9 @@ import org.h2.value.ValueBoolean;
public class ExpressionColumn extends Expression { public class ExpressionColumn extends Expression {
private final Database database; private final Database database;
private String schemaName; private final String schemaName;
private String tableAlias; private final String tableAlias;
private String columnName; private final String columnName;
private ColumnResolver columnResolver; private ColumnResolver columnResolver;
private int queryLevel; private int queryLevel;
private Column column; private Column column;
...@@ -41,6 +41,9 @@ public class ExpressionColumn extends Expression { ...@@ -41,6 +41,9 @@ public class ExpressionColumn extends Expression {
public ExpressionColumn(Database database, Column column) { public ExpressionColumn(Database database, Column column) {
this.database = database; this.database = database;
this.column = column; this.column = column;
this.schemaName = null;
this.tableAlias = null;
this.columnName = null;
} }
public ExpressionColumn(Database database, String schemaName, String tableAlias, String columnName) { public ExpressionColumn(Database database, String schemaName, String tableAlias, String columnName) {
......
...@@ -20,7 +20,7 @@ import org.h2.value.ValueArray; ...@@ -20,7 +20,7 @@ import org.h2.value.ValueArray;
*/ */
public class ExpressionList extends Expression { public class ExpressionList extends Expression {
private Expression[] list; private final Expression[] list;
public ExpressionList(Expression[] list) { public ExpressionList(Expression[] list) {
this.list = list; this.list = list;
......
...@@ -30,7 +30,7 @@ public class JavaAggregate extends Expression { ...@@ -30,7 +30,7 @@ public class JavaAggregate extends Expression {
private final UserAggregate userAggregate; private final UserAggregate userAggregate;
private final Select select; private final Select select;
private Expression[] args; private final Expression[] args;
private int[] argTypes; private int[] argTypes;
private int dataType; private int dataType;
private Connection userConnection; private Connection userConnection;
......
...@@ -26,7 +26,7 @@ public class JavaFunction extends Expression implements FunctionCall { ...@@ -26,7 +26,7 @@ public class JavaFunction extends Expression implements FunctionCall {
private final FunctionAlias functionAlias; private final FunctionAlias functionAlias;
private final FunctionAlias.JavaMethod javaMethod; private final FunctionAlias.JavaMethod javaMethod;
private Expression[] args; private final Expression[] args;
public JavaFunction(FunctionAlias functionAlias, Expression[] args) { public JavaFunction(FunctionAlias functionAlias, Expression[] args) {
this.functionAlias = functionAlias; this.functionAlias = functionAlias;
......
...@@ -73,7 +73,7 @@ public abstract class PageBtree extends Page { ...@@ -73,7 +73,7 @@ public abstract class PageBtree extends Page {
/** /**
* The estimated memory used by this object. * The estimated memory used by this object.
*/ */
private int memoryEstimated; private final int memoryEstimated;
PageBtree(PageBtreeIndex index, int pageId, Data data) { PageBtree(PageBtreeIndex index, int pageId, Data data) {
this.index = index; this.index = index;
......
...@@ -65,7 +65,7 @@ abstract class PageData extends Page { ...@@ -65,7 +65,7 @@ abstract class PageData extends Page {
* The estimated heap memory used by this object, in number of double words * The estimated heap memory used by this object, in number of double words
* (4 bytes each). * (4 bytes each).
*/ */
private int memoryEstimated; private final int memoryEstimated;
PageData(PageDataIndex index, int pageId, Data data) { PageData(PageDataIndex index, int pageId, Data data) {
this.index = index; this.index = index;
......
...@@ -42,7 +42,7 @@ public class PageDataIndex extends PageIndex { ...@@ -42,7 +42,7 @@ public class PageDataIndex extends PageIndex {
private long rowCount; private long rowCount;
private HashSet<Row> delta; private HashSet<Row> delta;
private int rowCountDiff; private int rowCountDiff;
private HashMap<Integer, Integer> sessionRowCount; private final HashMap<Integer, Integer> sessionRowCount;
private int mainIndexColumn = -1; private int mainIndexColumn = -1;
private DbException fastDuplicateKeyException; private DbException fastDuplicateKeyException;
...@@ -65,6 +65,8 @@ public class PageDataIndex extends PageIndex { ...@@ -65,6 +65,8 @@ public class PageDataIndex extends PageIndex {
if (multiVersion) { if (multiVersion) {
sessionRowCount = New.hashMap(); sessionRowCount = New.hashMap();
isMultiVersion = true; isMultiVersion = true;
} else {
sessionRowCount = null;
} }
tableData = table; tableData = table;
this.store = database.getPageStore(); this.store = database.getPageStore();
......
...@@ -35,7 +35,7 @@ public class ScanIndex extends BaseIndex { ...@@ -35,7 +35,7 @@ public class ScanIndex extends BaseIndex {
private ArrayList<Row> rows = New.arrayList(); private ArrayList<Row> rows = New.arrayList();
private final RegularTable tableData; private final RegularTable tableData;
private int rowCountDiff; private int rowCountDiff;
private HashMap<Integer, Integer> sessionRowCount; private final HashMap<Integer, Integer> sessionRowCount;
private HashSet<Row> delta; private HashSet<Row> delta;
private long rowCount; private long rowCount;
...@@ -43,6 +43,8 @@ public class ScanIndex extends BaseIndex { ...@@ -43,6 +43,8 @@ public class ScanIndex extends BaseIndex {
initBaseIndex(table, id, table.getName() + "_DATA", columns, indexType); initBaseIndex(table, id, table.getName() + "_DATA", columns, indexType);
if (database.isMultiVersion()) { if (database.isMultiVersion()) {
sessionRowCount = New.hashMap(); sessionRowCount = New.hashMap();
} else {
sessionRowCount = null;
} }
tableData = table; tableData = table;
} }
......
...@@ -36,7 +36,7 @@ class TreeNode { ...@@ -36,7 +36,7 @@ class TreeNode {
/** /**
* The row. * The row.
*/ */
Row row; final Row row;
TreeNode(Row row) { TreeNode(Row row) {
this.row = row; this.row = row;
......
...@@ -41,10 +41,10 @@ public class ViewIndex extends BaseIndex { ...@@ -41,10 +41,10 @@ public class ViewIndex extends BaseIndex {
private final SmallLRUCache<IntArray, CostElement> costCache = private final SmallLRUCache<IntArray, CostElement> costCache =
SmallLRUCache.newInstance(Constants.VIEW_INDEX_CACHE_SIZE); SmallLRUCache.newInstance(Constants.VIEW_INDEX_CACHE_SIZE);
private boolean recursive; private boolean recursive;
private int[] indexMasks; private final int[] indexMasks;
private String planSQL; private String planSQL;
private Query query; private Query query;
private Session createSession; private final Session createSession;
public ViewIndex(TableView view, String querySQL, ArrayList<Parameter> originalParameters, boolean recursive) { public ViewIndex(TableView view, String querySQL, ArrayList<Parameter> originalParameters, boolean recursive) {
initBaseIndex(view, 0, null, null, IndexType.createNonUnique(false)); initBaseIndex(view, 0, null, null, IndexType.createNonUnique(false));
...@@ -53,6 +53,8 @@ public class ViewIndex extends BaseIndex { ...@@ -53,6 +53,8 @@ public class ViewIndex extends BaseIndex {
this.originalParameters = originalParameters; this.originalParameters = originalParameters;
this.recursive = recursive; this.recursive = recursive;
columns = new Column[0]; columns = new Column[0];
this.createSession = null;
this.indexMasks = null;
} }
public ViewIndex(TableView view, ViewIndex index, Session session, int[] masks) { public ViewIndex(TableView view, ViewIndex index, Session session, int[] masks) {
......
...@@ -67,8 +67,8 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -67,8 +67,8 @@ public class JdbcConnection extends TraceObject implements Connection {
private static boolean keepOpenStackTrace; private static boolean keepOpenStackTrace;
private String url; private final String url;
private String user; private final String user;
// ResultSet.HOLD_CURSORS_OVER_COMMIT // ResultSet.HOLD_CURSORS_OVER_COMMIT
private int holdability = 1; private int holdability = 1;
...@@ -83,7 +83,7 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -83,7 +83,7 @@ public class JdbcConnection extends TraceObject implements Connection {
private String catalog; private String catalog;
private Statement executingStatement; private Statement executingStatement;
private final CompareMode compareMode = CompareMode.getInstance(null, 0); private final CompareMode compareMode = CompareMode.getInstance(null, 0);
private CloseWatcher watcher; private final CloseWatcher watcher;
private int queryTimeoutCache = -1; private int queryTimeoutCache = -1;
/** /**
...@@ -141,6 +141,7 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -141,6 +141,7 @@ public class JdbcConnection extends TraceObject implements Connection {
this.getQueryTimeout = clone.getQueryTimeout; this.getQueryTimeout = clone.getQueryTimeout;
this.getReadOnly = clone.getReadOnly; this.getReadOnly = clone.getReadOnly;
this.rollback = clone.rollback; this.rollback = clone.rollback;
this.watcher = null;
} }
/** /**
...@@ -153,6 +154,7 @@ public class JdbcConnection extends TraceObject implements Connection { ...@@ -153,6 +154,7 @@ public class JdbcConnection extends TraceObject implements Connection {
setTrace(trace, TraceObject.CONNECTION, id); setTrace(trace, TraceObject.CONNECTION, id);
this.user = user; this.user = user;
this.url = url; this.url = url;
this.watcher = null;
} }
private void closeOld() { private void closeOld() {
......
...@@ -20,9 +20,9 @@ public class JdbcXid extends TraceObject implements Xid { ...@@ -20,9 +20,9 @@ public class JdbcXid extends TraceObject implements Xid {
private static final String PREFIX = "XID"; private static final String PREFIX = "XID";
private int formatId; private final int formatId;
private byte[] branchQualifier; private final byte[] branchQualifier;
private byte[] globalTransactionId; private final byte[] globalTransactionId;
JdbcXid(JdbcDataSourceFactory factory, int id, String tid) { JdbcXid(JdbcDataSourceFactory factory, int id, String tid) {
setTrace(factory.getTrace(), TraceObject.XID, id); setTrace(factory.getTrace(), TraceObject.XID, id);
......
...@@ -18,52 +18,52 @@ public class ResultColumn { ...@@ -18,52 +18,52 @@ public class ResultColumn {
/** /**
* The column alias. * The column alias.
*/ */
String alias; final String alias;
/** /**
* The schema name or null. * The schema name or null.
*/ */
String schemaName; final String schemaName;
/** /**
* The table name or null. * The table name or null.
*/ */
String tableName; final String tableName;
/** /**
* The column name or null. * The column name or null.
*/ */
String columnName; final String columnName;
/** /**
* The value type of this column. * The value type of this column.
*/ */
int columnType; final int columnType;
/** /**
* The precision. * The precision.
*/ */
long precision; final long precision;
/** /**
* The scale. * The scale.
*/ */
int scale; final int scale;
/** /**
* The expected display size. * The expected display size.
*/ */
int displaySize; final int displaySize;
/** /**
* True if this is an autoincrement column. * True if this is an autoincrement column.
*/ */
boolean autoIncrement; final boolean autoIncrement;
/** /**
* True if this column is nullable. * True if this column is nullable.
*/ */
int nullable; final int nullable;
/** /**
* Read an object from the given transfer object. * Read an object from the given transfer object.
......
...@@ -28,7 +28,8 @@ public class RowList { ...@@ -28,7 +28,8 @@ public class RowList {
private FileStore file; private FileStore file;
private Data rowBuff; private Data rowBuff;
private ArrayList<Value> lobs; private ArrayList<Value> lobs;
private int memory, maxMemory; private final int maxMemory;
private int memory;
private boolean written; private boolean written;
private boolean readUncached; private boolean readUncached;
...@@ -41,6 +42,8 @@ public class RowList { ...@@ -41,6 +42,8 @@ public class RowList {
this.session = session; this.session = session;
if (session.getDatabase().isPersistent()) { if (session.getDatabase().isPersistent()) {
maxMemory = session.getDatabase().getMaxOperationMemory(); maxMemory = session.getDatabase().getMaxOperationMemory();
} else {
maxMemory = 0;
} }
} }
......
...@@ -17,7 +17,7 @@ public class SimpleRow implements SearchRow { ...@@ -17,7 +17,7 @@ public class SimpleRow implements SearchRow {
private long key; private long key;
private int version; private int version;
private Value[] data; private final Value[] data;
private int memory; private int memory;
public SimpleRow(Value[] data) { public SimpleRow(Value[] data) {
......
...@@ -26,8 +26,8 @@ public class AES implements BlockCipher { ...@@ -26,8 +26,8 @@ public class AES implements BlockCipher {
private static final int[] RT1 = new int[256]; private static final int[] RT1 = new int[256];
private static final int[] RT2 = new int[256]; private static final int[] RT2 = new int[256];
private static final int[] RT3 = new int[256]; private static final int[] RT3 = new int[256];
private int[] encKey = new int[44]; private final int[] encKey = new int[44];
private int[] decKey = new int[44]; private final int[] decKey = new int[44];
private static int rot8(int x) { private static int rot8(int x) {
return (x >>> 8) | (x << 24); return (x >>> 8) | (x << 24);
......
...@@ -44,7 +44,7 @@ import org.h2.value.ValueLobDb; ...@@ -44,7 +44,7 @@ import org.h2.value.ValueLobDb;
*/ */
public class TcpServerThread implements Runnable { public class TcpServerThread implements Runnable {
protected Transfer transfer; protected final Transfer transfer;
private final TcpServer server; private final TcpServer server;
private Session session; private Session session;
private boolean stop; private boolean stop;
......
...@@ -19,18 +19,18 @@ class DbColumn { ...@@ -19,18 +19,18 @@ class DbColumn {
/** /**
* The column name. * The column name.
*/ */
String name; final String name;
/** /**
* The quoted table name. * The quoted table name.
*/ */
String quotedName; final String quotedName;
/** /**
* The data type name (including precision and the NOT NULL flag if * The data type name (including precision and the NOT NULL flag if
* applicable). * applicable).
*/ */
String dataType; final String dataType;
DbColumn(DbContents contents, ResultSet rs) throws SQLException { DbColumn(DbContents contents, ResultSet rs) throws SQLException {
name = rs.getString("COLUMN_NAME"); name = rs.getString("COLUMN_NAME");
......
...@@ -21,22 +21,22 @@ public class DbTableOrView { ...@@ -21,22 +21,22 @@ public class DbTableOrView {
/** /**
* The schema this table belongs to. * The schema this table belongs to.
*/ */
DbSchema schema; final DbSchema schema;
/** /**
* The table name. * The table name.
*/ */
String name; final String name;
/** /**
* The quoted table name. * The quoted table name.
*/ */
String quotedName; final String quotedName;
/** /**
* True if this represents a view. * True if this represents a view.
*/ */
boolean isView; final boolean isView;
/** /**
* The column list. * The column list.
......
...@@ -69,7 +69,7 @@ public class WebApp { ...@@ -69,7 +69,7 @@ public class WebApp {
/** /**
* The web server. * The web server.
*/ */
protected WebServer server; protected final WebServer server;
/** /**
* The session. * The session.
......
...@@ -36,7 +36,7 @@ class WebSession { ...@@ -36,7 +36,7 @@ class WebSession {
/** /**
* The session attribute map. * The session attribute map.
*/ */
HashMap<String, Object> map = New.hashMap(); final HashMap<String, Object> map = New.hashMap();
/** /**
* The current locale. * The current locale.
......
...@@ -35,7 +35,7 @@ import org.h2.util.Utils; ...@@ -35,7 +35,7 @@ import org.h2.util.Utils;
class WebThread extends WebApp implements Runnable { class WebThread extends WebApp implements Runnable {
protected OutputStream output; protected OutputStream output;
protected Socket socket; protected final Socket socket;
private final Thread thread; private final Thread thread;
private InputStream input; private InputStream input;
private int headerBytes; private int headerBytes;
......
...@@ -106,7 +106,7 @@ public class MetaTable extends Table { ...@@ -106,7 +106,7 @@ public class MetaTable extends Table {
private final int type; private final int type;
private final int indexColumn; private final int indexColumn;
private MetaIndex metaIndex; private final MetaIndex metaIndex;
/** /**
* Create a new metadata table. * Create a new metadata table.
...@@ -515,6 +515,7 @@ public class MetaTable extends Table { ...@@ -515,6 +515,7 @@ public class MetaTable extends Table {
if (indexColumnName == null) { if (indexColumnName == null) {
indexColumn = -1; indexColumn = -1;
metaIndex = null;
} else { } else {
indexColumn = getColumn(indexColumnName).getColumnId(); indexColumn = getColumn(indexColumnName).getColumnId();
IndexColumn[] indexCols = IndexColumn.wrap(new Column[] { cols[indexColumn] }); IndexColumn[] indexCols = IndexColumn.wrap(new Column[] { cols[indexColumn] });
......
...@@ -58,7 +58,7 @@ public class RegularTable extends TableBase { ...@@ -58,7 +58,7 @@ public class RegularTable extends TableBase {
private final ArrayList<Index> indexes = New.arrayList(); private final ArrayList<Index> indexes = New.arrayList();
private long lastModificationId; private long lastModificationId;
private boolean containsLargeObject; private boolean containsLargeObject;
private PageDataIndex mainIndex; private final PageDataIndex mainIndex;
private int changesSinceAnalyze; private int changesSinceAnalyze;
private int nextAnalyze; private int nextAnalyze;
private Column rowIdColumn; private Column rowIdColumn;
...@@ -86,6 +86,7 @@ public class RegularTable extends TableBase { ...@@ -86,6 +86,7 @@ public class RegularTable extends TableBase {
data.create, data.session); data.create, data.session);
scanIndex = mainIndex; scanIndex = mainIndex;
} else { } else {
mainIndex = null;
scanIndex = new ScanIndex(this, data.id, IndexColumn.wrap(getColumns()), IndexType.createScan(data.persistData)); scanIndex = new ScanIndex(this, data.id, IndexColumn.wrap(getColumns()), IndexType.createScan(data.persistData));
} }
indexes.add(scanIndex); indexes.add(scanIndex);
......
...@@ -107,7 +107,7 @@ public class Recover extends Tool implements DataHandler { ...@@ -107,7 +107,7 @@ public class Recover extends Tool implements DataHandler {
/** /**
* The count per page type. * The count per page type.
*/ */
int[] pageTypeCount = new int[Page.TYPE_STREAM_DATA + 2]; final int[] pageTypeCount = new int[Page.TYPE_STREAM_DATA + 2];
/** /**
* The number of free pages. * The number of free pages.
......
...@@ -28,13 +28,14 @@ import org.h2.util.Utils; ...@@ -28,13 +28,14 @@ import org.h2.util.Utils;
*/ */
public class Server extends Tool implements Runnable, ShutdownHandler { public class Server extends Tool implements Runnable, ShutdownHandler {
private Service service; private final Service service;
private Server web, tcp, pg; private Server web, tcp, pg;
private ShutdownHandler shutdownHandler; private ShutdownHandler shutdownHandler;
private boolean started; private boolean started;
public Server() { public Server() {
// nothing to do // nothing to do
this.service = null;
} }
/** /**
......
...@@ -26,7 +26,7 @@ import org.h2.util.Utils; ...@@ -26,7 +26,7 @@ import org.h2.util.Utils;
*/ */
public class DbUpgrade { public class DbUpgrade {
private static boolean upgradeClassesPresent; private static final boolean upgradeClassesPresent;
private static boolean scriptInTempDir; private static boolean scriptInTempDir;
private static boolean deleteOldDb; private static boolean deleteOldDb;
......
...@@ -33,9 +33,9 @@ import org.h2.message.DbException; ...@@ -33,9 +33,9 @@ import org.h2.message.DbException;
public class Permutations<T> { public class Permutations<T> {
private final T[] in; private final T[] in;
private T[] out; private final T[] out;
private final int n, m; private final int n, m;
private int[] index; private final int[] index;
private boolean hasNext = true; private boolean hasNext = true;
private Permutations(T[] in, T[] out, int m) { private Permutations(T[] in, T[] out, int m) {
......
...@@ -33,12 +33,12 @@ public class SourceCompiler { ...@@ -33,12 +33,12 @@ public class SourceCompiler {
/** /**
* The class name to source code map. * The class name to source code map.
*/ */
HashMap<String, String> sources = New.hashMap(); final HashMap<String, String> sources = New.hashMap();
/** /**
* The class name to byte code map. * The class name to byte code map.
*/ */
HashMap<String, Class<?>> compiled = New.hashMap(); final HashMap<String, Class<?>> compiled = New.hashMap();
private final String compileDir = Utils.getProperty("java.io.tmpdir", "."); private final String compileDir = Utils.getProperty("java.io.tmpdir", ".");
......
...@@ -36,15 +36,17 @@ public class CompareMode { ...@@ -36,15 +36,17 @@ public class CompareMode {
private static CompareMode lastUsed; private static CompareMode lastUsed;
private static boolean canUseICU4J; private static final boolean canUseICU4J;
static { static {
boolean b = false;
try { try {
Class.forName("com.ibm.icu.text.Collator"); Class.forName("com.ibm.icu.text.Collator");
canUseICU4J = true; b = true;
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
} }
canUseICU4J = b;
} }
private final String name; private final String name;
......
...@@ -38,8 +38,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo ...@@ -38,8 +38,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
private int hash; private int hash;
private LobStorage lobStorage; private LobStorage lobStorage;
private long lobId; private final long lobId;
private byte[] hmac; private final byte[] hmac;
private byte[] small; private byte[] small;
...@@ -60,6 +60,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo ...@@ -60,6 +60,8 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
this.type = type; this.type = type;
this.small = small; this.small = small;
this.precision = precision; this.precision = precision;
this.lobId = 0;
this.hmac = null;
} }
/** /**
......
...@@ -14,8 +14,8 @@ import java.util.HashMap; ...@@ -14,8 +14,8 @@ import java.util.HashMap;
*/ */
public class HtmlConverter { public class HtmlConverter {
private static HashMap<String, Character> charMap = new HashMap<String, Character>(); private static final HashMap<String, Character> charMap = new HashMap<String, Character>();
private static HashMap<Character, String> codeMap = new HashMap<Character, String>(); private static final HashMap<Character, String> codeMap = new HashMap<Character, String>();
private static final String[] CHARS = { "quot:34", "amp:38", "lt:60", "gt:62", "nbsp:160", "iexcl:161", "cent:162", private static final String[] CHARS = { "quot:34", "amp:38", "lt:60", "gt:62", "nbsp:160", "iexcl:161", "cent:162",
"pound:163", "curren:164", "yen:165", "brvbar:166", "sect:167", "uml:168", "copy:169", "ordf:170", "pound:163", "curren:164", "yen:165", "brvbar:166", "sect:167", "uml:168", "copy:169", "ordf:170",
......
...@@ -19,7 +19,7 @@ public class Page { ...@@ -19,7 +19,7 @@ public class Page {
/** /**
* The file name. * The file name.
*/ */
String fileName; final String fileName;
/** /**
* The title of the page. * The title of the page.
......
...@@ -25,7 +25,7 @@ public class Word { ...@@ -25,7 +25,7 @@ public class Word {
/** /**
* The pages map. * The pages map.
*/ */
HashMap<Page, Weight> pages = new HashMap<Page, Weight>(); final HashMap<Page, Weight> pages = new HashMap<Page, Weight>();
private ArrayList<Weight> weightList; private ArrayList<Weight> weightList;
......
...@@ -24,20 +24,22 @@ public class FtpData extends Thread { ...@@ -24,20 +24,22 @@ public class FtpData extends Thread {
private final InetAddress address; private final InetAddress address;
private ServerSocket serverSocket; private ServerSocket serverSocket;
private volatile Socket socket; private volatile Socket socket;
private boolean active; private final boolean active;
private int port; private final int port;
FtpData(FtpServer server, InetAddress address, ServerSocket serverSocket) { FtpData(FtpServer server, InetAddress address, ServerSocket serverSocket) {
this.server = server; this.server = server;
this.address = address; this.address = address;
this.serverSocket = serverSocket; this.serverSocket = serverSocket;
this.port = 0;
this.active = false;
} }
FtpData(FtpServer server, InetAddress address, int port) { FtpData(FtpServer server, InetAddress address, int port) {
this.server = server; this.server = server;
this.address = address; this.address = address;
this.port = port; this.port = port;
active = true; this.active = true;
} }
public void run() { public void run() {
......
...@@ -29,7 +29,7 @@ public class Chunk { ...@@ -29,7 +29,7 @@ public class Chunk {
/** /**
* The chunk id. * The chunk id.
*/ */
int id; final int id;
/** /**
* The start position within the file. * The start position within the file.
......
...@@ -14,7 +14,7 @@ public class CursorPos { ...@@ -14,7 +14,7 @@ public class CursorPos {
/** /**
* The current page. * The current page.
*/ */
public Page page; public final Page page;
/** /**
* The current index. * The current index.
...@@ -24,7 +24,7 @@ public class CursorPos { ...@@ -24,7 +24,7 @@ public class CursorPos {
/** /**
* The position in the parent page, if any. * The position in the parent page, if any.
*/ */
public CursorPos parent; public final CursorPos parent;
public CursorPos(Page page, int index, CursorPos parent) { public CursorPos(Page page, int index, CursorPos parent) {
this.page = page; this.page = page;
......
...@@ -14,7 +14,7 @@ import org.h2.util.New; ...@@ -14,7 +14,7 @@ import org.h2.util.New;
*/ */
public class MVStoreBuilder { public class MVStoreBuilder {
private HashMap<String, Object> config = New.hashMap(); private final HashMap<String, Object> config = New.hashMap();
/** /**
* Use the following file name. If the file does not exist, it is * Use the following file name. If the file does not exist, it is
......
...@@ -272,12 +272,12 @@ public class StreamStore { ...@@ -272,12 +272,12 @@ public class StreamStore {
*/ */
static class Stream extends InputStream { static class Stream extends InputStream {
private StreamStore store; private final StreamStore store;
private byte[] oneByteBuffer; private byte[] oneByteBuffer;
private ByteBuffer idBuffer; private ByteBuffer idBuffer;
private ByteArrayInputStream buffer; private ByteArrayInputStream buffer;
private long skip; private long skip;
private long length; private final long length;
private long pos; private long pos;
Stream(StreamStore store, byte[] id) { Stream(StreamStore store, byte[] id) {
......
...@@ -55,7 +55,7 @@ class Operation implements Token { ...@@ -55,7 +55,7 @@ class Operation implements Token {
DIVIDE("/"), DIVIDE("/"),
MOD("%"); MOD("%");
private String name; private final String name;
Type(String name) { Type(String name) {
this.name = name; this.name = name;
......
...@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong; ...@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong;
public class StatementLogger { public class StatementLogger {
public static boolean logStatements; public static boolean logStatements;
private static PrintWriter out = new PrintWriter(System.out); private static final PrintWriter out = new PrintWriter(System.out);
private static final AtomicLong SELECT_COUNT = new AtomicLong(); private static final AtomicLong SELECT_COUNT = new AtomicLong();
private static final AtomicLong CREATE_COUNT = new AtomicLong(); private static final AtomicLong CREATE_COUNT = new AtomicLong();
private static final AtomicLong INSERT_COUNT = new AtomicLong(); private static final AtomicLong INSERT_COUNT = new AtomicLong();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论