本文整理了Java中org.h2.value.Value.remove()
方法的一些代码示例,展示了Value.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.remove()
方法的具体详情如下:
包路径:org.h2.value.Value
类名称:Value
方法名:remove
[英]Remove the underlying resource, if any. For values that are kept fully in memory this method has no effect.
[中]删除基础资源(如果有)。对于完全保存在内存中的值,此方法无效。
代码示例来源:origin: com.h2database/h2
@Override
public void setValue(Value newValue, boolean closeOld) {
if (closeOld && value != null) {
value.remove();
}
value = newValue;
}
代码示例来源:origin: com.h2database/h2
/**
* Set the value of the given variable for this session.
*
* @param name the name of the variable (may not be null)
* @param value the new value (may not be null)
*/
public void setVariable(String name, Value value) {
initVariables();
modificationId++;
Value old;
if (value == ValueNull.INSTANCE) {
old = variables.remove(name);
} else {
// link LOB values, to make sure we have our own object
value = value.copy(database,
LobStorageFrontend.TABLE_ID_SESSION_VARIABLE);
old = variables.put(name, value);
}
if (old != null) {
// remove the old value (in case it is a lob)
old.remove();
}
}
代码示例来源:origin: com.h2database/h2
private void endTransaction() {
if (removeLobMap != null && removeLobMap.size() > 0) {
if (database.getMvStore() == null) {
// need to flush the transaction log, because we can't unlink
// lobs if the commit record is not written
database.flush();
}
for (Value v : removeLobMap.values()) {
v.remove();
}
removeLobMap = null;
}
unlockAll();
}
代码示例来源:origin: com.h2database/h2
private void removeTemporaryLobs(boolean onTimeout) {
if (SysProperties.CHECK2) {
if (this == getDatabase().getLobSession()
&& !Thread.holdsLock(this) && !Thread.holdsLock(getDatabase())) {
throw DbException.throwInternalError();
}
}
if (temporaryLobs != null) {
for (Value v : temporaryLobs) {
if (!v.isLinkedToTable()) {
v.remove();
}
}
temporaryLobs.clear();
}
if (temporaryResultLobs != null && !temporaryResultLobs.isEmpty()) {
long keepYoungerThan = System.nanoTime() -
TimeUnit.MILLISECONDS.toNanos(database.getSettings().lobTimeout);
while (!temporaryResultLobs.isEmpty()) {
TimeoutValue tv = temporaryResultLobs.getFirst();
if (onTimeout && tv.created >= keepYoungerThan) {
break;
}
Value v = temporaryResultLobs.removeFirst().value;
if (!v.isLinkedToTable()) {
v.remove();
}
}
}
}
代码示例来源:origin: com.h2database/h2
@Override
public void close() {
if (session == null || session.isClosed()) {
return;
}
synchronized (session) {
session.traceOperation("COMMAND_CLOSE", id);
for (Transfer transfer : transferList) {
try {
transfer.writeInt(SessionRemote.COMMAND_CLOSE).writeInt(id);
} catch (IOException e) {
trace.error(e, "close");
}
}
}
session = null;
try {
for (ParameterInterface p : parameters) {
Value v = p.getParamValue();
if (v != null) {
v.remove();
}
}
} catch (DbException e) {
trace.error(e, "close");
}
parameters.clear();
}
代码示例来源:origin: com.h2database/h2
@Override
public Value copy(DataHandler database, int tableId) {
if (small == null) {
return handler.getLobStorage().copyLob(this, tableId, getPrecision());
} else if (small.length > database.getMaxLengthInplaceLob()) {
LobStorageInterface s = database.getLobStorage();
Value v;
if (type == Value.BLOB) {
v = s.createBlob(getInputStream(), getPrecision());
} else {
v = s.createClob(getReader(), getPrecision());
}
Value v2 = v.copy(database, tableId);
v.remove();
return v2;
}
return this;
}
代码示例来源:origin: com.eventsourcing/h2
@Override
public void setValue(Value newValue, boolean closeOld) {
if (closeOld && value != null) {
value.remove();
}
value = newValue;
}
代码示例来源:origin: org.wowtools/h2
@Override
public void setValue(Value newValue, boolean closeOld) {
if (closeOld && value != null) {
value.remove();
}
value = newValue;
}
代码示例来源:origin: com.eventsourcing/h2
/**
* Set the value of the given variable for this session.
*
* @param name the name of the variable (may not be null)
* @param value the new value (may not be null)
*/
public void setVariable(String name, Value value) {
initVariables();
modificationId++;
Value old;
if (value == ValueNull.INSTANCE) {
old = variables.remove(name);
} else {
// link LOB values, to make sure we have our own object
value = value.copy(database,
LobStorageFrontend.TABLE_ID_SESSION_VARIABLE);
old = variables.put(name, value);
}
if (old != null) {
// remove the old value (in case it is a lob)
old.remove();
}
}
代码示例来源:origin: org.wowtools/h2
private void endTransaction() {
if (removeLobMap != null && removeLobMap.size() > 0) {
if (database.getMvStore() == null) {
// need to flush the transaction log, because we can't unlink
// lobs if the commit record is not written
database.flush();
}
for (Value v : removeLobMap.values()) {
v.remove();
}
removeLobMap = null;
}
unlockAll();
}
代码示例来源:origin: com.eventsourcing/h2
private void endTransaction() {
if (removeLobMap != null && removeLobMap.size() > 0) {
if (database.getMvStore() == null) {
// need to flush the transaction log, because we can't unlink
// lobs if the commit record is not written
database.flush();
}
for (Value v : removeLobMap.values()) {
v.remove();
}
removeLobMap = null;
}
unlockAll();
}
代码示例来源:origin: org.wowtools/h2
/**
* Set the value of the given variable for this session.
*
* @param name the name of the variable (may not be null)
* @param value the new value (may not be null)
*/
public void setVariable(String name, Value value) {
initVariables();
modificationId++;
Value old;
if (value == ValueNull.INSTANCE) {
old = variables.remove(name);
} else {
// link LOB values, to make sure we have our own object
value = value.copy(database,
LobStorageFrontend.TABLE_ID_SESSION_VARIABLE);
old = variables.put(name, value);
}
if (old != null) {
// remove the old value (in case it is a lob)
old.remove();
}
}
代码示例来源:origin: org.wowtools/h2
private void removeTemporaryLobs(boolean onTimeout) {
if (SysProperties.CHECK2) {
if (this == getDatabase().getLobSession()
&& !Thread.holdsLock(this) && !Thread.holdsLock(getDatabase())) {
throw DbException.throwInternalError();
}
}
if (temporaryLobs != null) {
for (Value v : temporaryLobs) {
if (!v.isLinkedToTable()) {
v.remove();
}
}
temporaryLobs.clear();
}
if (temporaryResultLobs != null && temporaryResultLobs.size() > 0) {
long keepYoungerThan = System.currentTimeMillis() -
database.getSettings().lobTimeout;
while (temporaryResultLobs.size() > 0) {
TimeoutValue tv = temporaryResultLobs.getFirst();
if (onTimeout && tv.created >= keepYoungerThan) {
break;
}
Value v = temporaryResultLobs.removeFirst().value;
if (!v.isLinkedToTable()) {
v.remove();
}
}
}
}
代码示例来源:origin: com.eventsourcing/h2
private void removeTemporaryLobs(boolean onTimeout) {
if (SysProperties.CHECK2) {
if (this == getDatabase().getLobSession()
&& !Thread.holdsLock(this) && !Thread.holdsLock(getDatabase())) {
throw DbException.throwInternalError();
}
}
if (temporaryLobs != null) {
for (Value v : temporaryLobs) {
if (!v.isLinkedToTable()) {
v.remove();
}
}
temporaryLobs.clear();
}
if (temporaryResultLobs != null && temporaryResultLobs.size() > 0) {
long keepYoungerThan = System.currentTimeMillis() -
database.getSettings().lobTimeout;
while (temporaryResultLobs.size() > 0) {
TimeoutValue tv = temporaryResultLobs.getFirst();
if (onTimeout && tv.created >= keepYoungerThan) {
break;
}
Value v = temporaryResultLobs.removeFirst().value;
if (!v.isLinkedToTable()) {
v.remove();
}
}
}
}
代码示例来源:origin: com.eventsourcing/h2
@Override
public void close() {
if (session == null || session.isClosed()) {
return;
}
synchronized (session) {
session.traceOperation("COMMAND_CLOSE", id);
for (Transfer transfer : transferList) {
try {
transfer.writeInt(SessionRemote.COMMAND_CLOSE).writeInt(id);
} catch (IOException e) {
trace.error(e, "close");
}
}
}
session = null;
try {
for (ParameterInterface p : parameters) {
Value v = p.getParamValue();
if (v != null) {
v.remove();
}
}
} catch (DbException e) {
trace.error(e, "close");
}
parameters.clear();
}
代码示例来源:origin: org.wowtools/h2
@Override
public void close() {
if (session == null || session.isClosed()) {
return;
}
synchronized (session) {
session.traceOperation("COMMAND_CLOSE", id);
for (Transfer transfer : transferList) {
try {
transfer.writeInt(SessionRemote.COMMAND_CLOSE).writeInt(id);
} catch (IOException e) {
trace.error(e, "close");
}
}
}
session = null;
try {
for (ParameterInterface p : parameters) {
Value v = p.getParamValue();
if (v != null) {
v.remove();
}
}
} catch (DbException e) {
trace.error(e, "close");
}
parameters.clear();
}
代码示例来源:origin: org.wowtools/h2
@Override
public Value copy(DataHandler database, int tableId) {
if (small == null) {
Value v2 = handler.getLobStorage().copyLob(this, tableId, getPrecision());
return v2;
} else if (small.length > database.getMaxLengthInplaceLob()) {
LobStorageInterface s = database.getLobStorage();
Value v;
if (type == Value.BLOB) {
v = s.createBlob(getInputStream(), getPrecision());
} else {
v = s.createClob(getReader(), getPrecision());
}
Value v2 = v.copy(database, tableId);
v.remove();
return v2;
}
return this;
}
代码示例来源:origin: com.eventsourcing/h2
@Override
public Value copy(DataHandler database, int tableId) {
if (small == null) {
Value v2 = handler.getLobStorage().copyLob(this, tableId, getPrecision());
return v2;
} else if (small.length > database.getMaxLengthInplaceLob()) {
LobStorageInterface s = database.getLobStorage();
Value v;
if (type == Value.BLOB) {
v = s.createBlob(getInputStream(), getPrecision());
} else {
v = s.createClob(getReader(), getPrecision());
}
Value v2 = v.copy(database, tableId);
v.remove();
return v2;
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!