提交 43701f3f authored 作者: Thomas Mueller's avatar Thomas Mueller

Javadocs; lob storage bugfix.

上级 8d9dec61
......@@ -144,7 +144,6 @@ public abstract class Command implements CommandInterface {
private void stop() {
session.endStatement();
session.closeTemporaryResults();
session.setCurrentCommand(null);
if (!isTransactional()) {
session.commit(true);
......
......@@ -584,6 +584,11 @@ public class Session extends SessionWithState {
return undoLog.size() > 0;
}
/**
* Create a savepoint to allow rolling back to this state.
*
* @return the savepoint
*/
public Savepoint setSavepoint() {
Savepoint sp = new Savepoint();
sp.logIndex = undoLog.size();
......@@ -1203,11 +1208,7 @@ public class Session extends SessionWithState {
}
}
/**
* Close all temporary result set. This also deletes all temporary files
* held by the result sets.
*/
public void closeTemporaryResults() {
private void closeTemporaryResults() {
if (temporaryResults != null) {
for (ResultInterface result : temporaryResults) {
result.close();
......@@ -1325,8 +1326,13 @@ public class Session extends SessionWithState {
return startStatement;
}
/**
* Mark the statement as completed. This also close all temporary result
* set, and deletes all temporary files held by the result sets.
*/
public void endStatement() {
startStatement = -1;
closeTemporaryResults();
}
/**
......@@ -1334,7 +1340,15 @@ public class Session extends SessionWithState {
* back to).
*/
public static class Savepoint {
/**
* The undo log index.
*/
int logIndex;
/**
* The transaction savepoint id.
*/
long transactionSavepoint;
}
......
......@@ -145,6 +145,7 @@ public class ConditionInConstantSet extends Condition {
* Add an additional element if possible. Example: given two conditions
* A IN(1, 2) OR A=3, the constant 3 is added: A IN(1, 2, 3).
*
* @param session the session
* @param other the second condition
* @return null if the condition was not added, or the new condition
*/
......
......@@ -101,6 +101,9 @@ public class MVTableEngine implements TableEngine {
return openTables;
}
/**
* Store all pending changes.
*/
public void store() {
if (!store.isReadOnly()) {
store.commit();
......@@ -109,6 +112,9 @@ public class MVTableEngine implements TableEngine {
}
}
/**
* Close the store, without persisting changes.
*/
public void closeImmediately() {
if (store.isClosed()) {
return;
......@@ -123,6 +129,9 @@ public class MVTableEngine implements TableEngine {
}
}
/**
* Close the store. Pending changes are persisted.
*/
public void close() {
if (!store.isReadOnly()) {
store.store();
......
......@@ -248,6 +248,13 @@ public class TransactionStore {
endTransaction(t);
}
/**
* Check whether the given transaction id is still open and contains log
* entries.
*
* @param transactionId the transaction id
* @return true if it is open
*/
boolean isTransactionOpen(long transactionId) {
if (transactionId < firstOpenTransaction) {
return false;
......@@ -267,6 +274,11 @@ public class TransactionStore {
return key != null && key[0] == transactionId;
}
/**
* End this transaction
*
* @param t the transaction
*/
void endTransaction(Transaction t) {
if (t.getStatus() == Transaction.STATUS_PREPARED) {
preparedTransactions.remove(t.getId());
......@@ -308,6 +320,14 @@ public class TransactionStore {
}
}
/**
* Get the set of changed maps.
*
* @param t the transaction
* @param maxLogId the maximum log id
* @param toLogId the minimum log id
* @return the set of changed maps
*/
HashSet<String> getChangedMaps(Transaction t, long maxLogId, long toLogId) {
HashSet<String> set = New.hashSet();
for (long logId = maxLogId - 1; logId >= toLogId; logId--) {
......@@ -363,6 +383,9 @@ public class TransactionStore {
*/
final long transactionId;
/**
* The log id of the last entry in the undo log map.
*/
long logId;
private int status;
......@@ -1012,7 +1035,20 @@ public class TransactionStore {
* value, and the value itself.
*/
static class VersionedValue {
public long transactionId, logId;
/**
* The transaction id.
*/
public long transactionId;
/**
* The log id.
*/
public long logId;
/**
* The value.
*/
public Object value;
}
......
......@@ -62,7 +62,7 @@ public interface LobStorageInterface {
* @param lobId the lob
* @param table the table
*/
void setTable(long lobId, int tableIdSessionVariable);
void setTable(long lobId, int table);
/**
* Delete a LOB from the database.
......
......@@ -142,6 +142,7 @@ public class ValueLob extends Value {
* @param objectId the object id
* @param precision the precision (length in elements)
* @param compression if compression is used
* @param fileName the file name
* @return the value object
*/
public static ValueLob openUnlinked(int type, DataHandler handler,
......@@ -237,7 +238,7 @@ public class ValueLob extends Value {
}
}
public static String getFileNamePrefix(String path, int objectId) {
private static String getFileNamePrefix(String path, int objectId) {
String name;
int f = objectId % SysProperties.LOB_FILES_PER_DIRECTORY;
if (f > 0) {
......@@ -480,7 +481,8 @@ public class ValueLob extends Value {
}
}
public void unlink() {
@Override
public void unlink(DataHandler handler) {
if (linked && fileName != null) {
String temp;
// synchronize on the database, to avoid concurrent temp file
......@@ -751,7 +753,7 @@ public class ValueLob extends Value {
return compression;
}
public static synchronized void deleteFile(DataHandler handler, String fileName) {
private static synchronized void deleteFile(DataHandler handler, String fileName) {
// synchronize on the database, to avoid concurrent temp file creation /
// deletion / backup
synchronized (handler.getLobSyncObject()) {
......
......@@ -203,7 +203,7 @@ public class Doclet {
String name = field.name();
String text = field.commentText();
if (text == null || text.trim().length() == 0) {
addError("Undocumented field (" + clazz.name() + ".java:" + field.position().line() + ") " + name);
addError("Undocumented field (" + getLink(clazz, field.position().line()) + ") " + name);
}
if (text != null && text.startsWith("INTERNAL")) {
continue;
......@@ -315,7 +315,7 @@ public class Doclet {
if (hasComment && !method.commentText().startsWith("[")) {
// [Not supported] and such are not problematic
addError("Undocumented parameter(s) (" +
clazz.name() + ".java:" + method.position().line() + ") " +
getLink(clazz, method.position().line()) + ") " +
name + " documented: " + paramTags.length + " params: "+ params.length);
}
}
......@@ -324,7 +324,7 @@ public class Doclet {
String comment = paramTags[j].parameterComment();
if (comment.trim().length() == 0) {
addError("Undocumented parameter (" +
clazz.name() + ".java:" + method.position().line() + ") " + name + " " + paramName);
getLink(clazz, method.position().line()) + ") " + name + " " + paramName);
}
String p = paramName + " - " + comment;
if (j == 0) {
......@@ -339,7 +339,7 @@ public class Doclet {
String returnComment = returnTags[0].text();
if (returnComment.trim().length() == 0) {
addError("Undocumented return value (" +
clazz.name() + ".java:" + method.position().line() + ") " + name);
getLink(clazz, method.position().line()) + ") " + name);
}
writer.println("<div class=\"item\">" + returnComment + "</div>");
} else if (returnType != null && !returnType.toString().equals("void")) {
......@@ -347,7 +347,7 @@ public class Doclet {
// [Not supported] and such are not problematic
// also not problematic are methods that always throw an exception
addError("Undocumented return value (" +
clazz.name() + ".java:" + method.position().line() + ") " + name + " " + getReturnType(method));
getLink(clazz, method.position().line()) + ") " + name + " " + getReturnType(method));
}
}
if (hasThrowsTag) {
......@@ -363,6 +363,15 @@ public class Doclet {
}
}
private static String getLink(ClassDoc clazz, int line) {
String c = clazz.name();
int x = c.lastIndexOf('.');
if (x >= 0) {
c = c.substring(0, x);
}
return c + ".java:" + line;
}
private String getFieldLink(String text, String constant, ClassDoc clazz, String name) {
String link = constant != null ? constant : name.toLowerCase();
int linkStart = text.indexOf("<code>");
......@@ -431,7 +440,7 @@ public class Doclet {
returnType.toString().equals("boolean");
if (!setterOrGetter) {
addError("Undocumented method " +
" (" + clazz.name() + ".java:" + method.position().line() +") " +
" (" + getLink(clazz, method.position().line()) +") " +
clazz + "." + name + " " + raw);
return true;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论