Thread: [Joafip-svn] SF.net SVN: joafip:[2912] trunk/joafip/src
Brought to you by:
luc_peuvrier
|
From: <luc...@us...> - 2011-10-02 08:33:41
|
Revision: 2912
http://joafip.svn.sourceforge.net/joafip/?rev=2912&view=rev
Author: luc_peuvrier
Date: 2011-10-02 08:33:34 +0000 (Sun, 02 Oct 2011)
Log Message:
-----------
problems with static field modified when persisted
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/StoreSynchro.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
Added Paths:
-----------
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticField.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticFieldMap.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSaveWithStatic.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-02 08:33:41
|
Revision: 2912
http://joafip.svn.sourceforge.net/joafip/?rev=2912&view=rev
Author: luc_peuvrier
Date: 2011-10-02 08:33:34 +0000 (Sun, 02 Oct 2011)
Log Message:
-----------
problems with static field modified when persisted
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/StoreSynchro.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
Added Paths:
-----------
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticField.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticFieldMap.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSaveWithStatic.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/StoreSynchro.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/StoreSynchro.java 2011-10-01 17:08:48 UTC (rev 2911)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/StoreSynchro.java 2011-10-02 08:33:34 UTC (rev 2912)
@@ -42,6 +42,8 @@
public StoreSynchro() { // NOPMD
super();
+ // FIXMELUC _____________________for test
+ Thread.dumpStack();
}
public void setPersistenceId(final int persistenceId) {
@@ -60,7 +62,6 @@
/* a not valid identifier value when access session is closed */
fileAccessSessionIdentifier = -1;
}
-
return persistenceId | fileAccessSessionIdentifier;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java 2011-10-01 17:08:48 UTC (rev 2911)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java 2011-10-02 08:33:34 UTC (rev 2912)
@@ -425,8 +425,9 @@
queueSize = 0;
queueNumberOfWeakRef = 0;
}
- // static persistence information live with file persistence
- // staticStateMap.clear();
+ // FIXMELUC ____________________static persistence information live
+ // with file persistence
+ staticStateMap.clear();
// checkNullFieldError();
}
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-01 17:08:48 UTC (rev 2911)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-02 08:33:34 UTC (rev 2912)
@@ -1248,8 +1248,8 @@
objectAndPersistInfo
.setDataRecordIdentifier(dataRecordIdentifier);
objectAndPersistInfo.setReplacementDefList(replacementDef);
- objectInputStatic.setObjectState(objectAndPersistInfo, binary,
- offset);
+ objectInputStatic.setObjectStaticState(objectAndPersistInfo,
+ binary, offset);
// not a new object to add to storage, created reading in
// storage
objectAndPersistInfo.setNewObject(false);
Added: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticField.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticField.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticField.java 2011-10-02 08:33:34 UTC (rev 2912)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.service.rel400;
+
+import java.util.Map;
+
+import net.sf.joafip.StorableClass;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@StorableClass
+public class PersistableWithStaticField {
+
+ private static final PersistableWithStaticField EMPTY = new PersistableWithStaticField(
+ "");
+
+ private static Map<String, PersistableWithStaticField> map;
+
+ static {
+ map = new PersistableWithStaticFieldMap();
+ map.put(EMPTY.getKey(), EMPTY);
+ }
+
+ private final String key;
+
+ public PersistableWithStaticField(final String key) {
+ super();
+ this.key = key;
+ }
+
+ public String getKey() {
+ return key;
+ }
+}
Added: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticFieldMap.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticFieldMap.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/PersistableWithStaticFieldMap.java 2011-10-02 08:33:34 UTC (rev 2912)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.service.rel400;
+
+import net.sf.joafip.StorableClass;
+import net.sf.joafip.StoreNotUseStandardSerialization;
+import net.sf.joafip.java.util.PTreeMap;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@StoreNotUseStandardSerialization
+@StorableClass
+public class PersistableWithStaticFieldMap extends
+ PTreeMap<String, PersistableWithStaticField> {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4317793725458311008L;
+
+}
Added: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSaveWithStatic.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSaveWithStatic.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSaveWithStatic.java 2011-10-02 08:33:34 UTC (rev 2912)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.service.rel400;
+
+import net.sf.joafip.AbstractDeleteFileTestCase;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.StorableAccess;
+import net.sf.joafip.TestException;
+import net.sf.joafip.service.FilePersistenceBuilder;
+import net.sf.joafip.service.FilePersistenceClassNotFoundException;
+import net.sf.joafip.service.FilePersistenceDataCorruptedException;
+import net.sf.joafip.service.FilePersistenceException;
+import net.sf.joafip.service.FilePersistenceInvalidClassException;
+import net.sf.joafip.service.FilePersistenceNotSerializableException;
+import net.sf.joafip.service.FilePersistenceTooBigForSerializationException;
+import net.sf.joafip.service.IExclusiveDataAccessSession;
+import net.sf.joafip.service.IFilePersistence;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+@StorableAccess
+public class TestAutoSaveWithStatic extends AbstractDeleteFileTestCase {
+
+ public TestAutoSaveWithStatic() throws TestException {
+ super();
+ }
+
+ public TestAutoSaveWithStatic(final String name) throws TestException {
+ super(name);
+ }
+
+ @SuppressWarnings("PMD")
+ public void test() throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceTooBigForSerializationException {
+ createFilePersistence();
+ // second failed before correction
+ createFilePersistence();
+ }
+
+ private void createFilePersistence() throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceTooBigForSerializationException {
+ final FilePersistenceBuilder builder = new FilePersistenceBuilder();
+ builder.setPathName(path.getAbsolutePath());
+ builder.setProxyMode(true);
+ builder.setRemoveFiles(true);
+ final IFilePersistence filePersistence = builder.build();
+ filePersistence.storedStaticField(PersistableWithStaticField.class);
+ final IExclusiveDataAccessSession session = filePersistence
+ .createExclusiveDataAccessSession();
+ session.open();
+ session.close();
+ filePersistence.close();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-14 06:00:37
|
Revision: 2918
http://joafip.svn.sourceforge.net/joafip/?rev=2918&view=rev
Author: luc_peuvrier
Date: 2011-10-14 06:00:31 +0000 (Fri, 14 Oct 2011)
Log Message:
-----------
direct access field access control ok
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/StackElement.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ForTestCheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/TestCheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ToCheckClass.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-14 06:00:38
|
Revision: 2918
http://joafip.svn.sourceforge.net/joafip/?rev=2918&view=rev
Author: luc_peuvrier
Date: 2011-10-14 06:00:31 +0000 (Fri, 14 Oct 2011)
Log Message:
-----------
direct access field access control ok
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/StackElement.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ForTestCheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/TestCheckMethodVisitor.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ToCheckClass.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java 2011-10-12 03:04:21 UTC (rev 2917)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/OpcodeNode.java 2011-10-14 06:00:31 UTC (rev 2918)
@@ -38,6 +38,8 @@
@NotStorableClass
public class OpcodeNode {
+ private static final String TAB = " ";
+
protected final static OpcodeInterpreter OPCODE_INTERPRETER = OpcodeInterpreter
.getInstance();
@@ -94,9 +96,20 @@
public void setBeforeExecutionStackElement(
final StackElement beforeExecutionStackElement) {
- assert this.beforeExecutionStackElement == null : "to set to\n"
- + beforeExecutionStackElement + "\n and is\n"
- + this.beforeExecutionStackElement;
+ // stack change accepted
+ // assert this.beforeExecutionStackElement == null
+ // ||
+ // this.beforeExecutionStackElement.equals(beforeExecutionStackElement)
+ // : OPCODE_INTERPRETER
+ // .mnemonic(opcode)
+ // + " line "
+ // + lineNumber
+ // + " @"
+ // + address
+ // + " to set to\n"
+ // + beforeExecutionStackElement
+ // + "\n and is\n"
+ // + this.beforeExecutionStackElement;
this.beforeExecutionStackElement = beforeExecutionStackElement;
}
@@ -137,8 +150,12 @@
@Override
public String toString() {
final StringBuilder stringBuilder = new StringBuilder();
- if (label != null) {
- stringBuilder.append(label.toString());
+ if (label == null) {
+ stringBuilder.append(TAB);
+ } else {
+ final String labelToString = label.toString();
+ stringBuilder.append(labelToString);
+ stringBuilder.append(TAB.substring(labelToString.length()));
}
stringBuilder.append('@');
stringBuilder.append(address);
@@ -159,12 +176,15 @@
stringBuilder.append(' ');
}
stringBuilder.append('\n');
+ stringBuilder.append(TAB);
if (beforeExecutionStackElement == null) {
stringBuilder.append('?');
} else {
stringBuilder.append(beforeExecutionStackElement.toString());
}
- stringBuilder.append("\n=> ");
+ stringBuilder.append('\n');
+ stringBuilder.append(TAB);
+ stringBuilder.append("=> ");
if (afterExecutionStackElement == null) {
stringBuilder.append('?');
} else {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/StackElement.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/StackElement.java 2011-10-12 03:04:21 UTC (rev 2917)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/proxy/StackElement.java 2011-10-14 06:00:31 UTC (rev 2918)
@@ -67,6 +67,37 @@
}
@Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ @SuppressWarnings("PMD")
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ StackElement other = (StackElement) obj;
+ if (type != other.type) {
+ return false;
+ }
+ if (previous == null) {
+ return true;
+ } else {
+ return previous.equals(other.previous);
+ }
+ }
+
+ @Override
public String toString() {
final String typeName;
if (thisReference) {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java 2011-10-12 03:04:21 UTC (rev 2917)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/CheckMethodVisitor.java 2011-10-14 06:00:31 UTC (rev 2918)
@@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -37,6 +38,7 @@
import net.sf.joafip.asm.Opcodes;
import net.sf.joafip.logger.JoafipLogger;
import net.sf.joafip.store.entity.proxy.DirectAccessInfo;
+import net.sf.joafip.store.entity.proxy.EnumStackEltType;
import net.sf.joafip.store.entity.proxy.OpcodeNode;
import net.sf.joafip.store.entity.proxy.OpcodeNodeAloadThis;
import net.sf.joafip.store.entity.proxy.OpcodeNodeDup;
@@ -64,6 +66,9 @@
@NotStorableClass
public class CheckMethodVisitor implements MethodVisitor, Opcodes {
+ private static final StackElement HANDLER_START_STACK_ELEMENT = new StackElement(
+ null, EnumStackEltType.REF);
+
private final static JoafipLogger LOGGER = JoafipLogger
.getLogger(CheckMethodVisitor.class);
@@ -106,6 +111,7 @@
@Override
public void visitEnd() {
+ listener.codeVisisted(methodAbsoluteName);
try {
for (Map.Entry<OpcodeNode, Set<Label>> entry : gotoMap.entrySet()) {
final OpcodeNode opcodeNode = entry.getKey();
@@ -123,9 +129,10 @@
// FIXMELUC _______________________________cas du jsr/ret
- for (OpcodeNode opcodeNode : startOpcodeNode
- .getNextOpcodeNodeList()) {
- check(opcodeNode);
+ final List<OpcodeNode> nextOpcodeNodeList = startOpcodeNode
+ .getNextOpcodeNodeList();
+ for (OpcodeNode opcodeNode : nextOpcodeNodeList) {
+ check(opcodeNode, null);
}
for (Label label : handlerEntrySet) {
@@ -134,9 +141,8 @@
throw new EnhanceException("undefined label "
+ label.toString());
}
- check(handlerOpcode);
+ check(handlerOpcode, HANDLER_START_STACK_ELEMENT);
}
- listener.codeVisisted(methodAbsoluteName);
} catch (Exception exception) {
final String unassembled = listener.unassembled(methodAbsoluteName);
throw new RuntimeEnhanceException(new EnhanceException(
@@ -153,13 +159,14 @@
}
}
- private void check(final OpcodeNode startOpcodeNode)
- throws EnhanceException {
+ private void check(final OpcodeNode startOpcodeNode,
+ final StackElement startStackElement) throws EnhanceException {
final Deque<OpcodeNode> toVisitQue = new LinkedList<OpcodeNode>();
final Deque<StackElement> stackElementQue = new LinkedList<StackElement>();
final Set<OpcodeNode> visited = new HashSet<OpcodeNode>();
OpcodeNode currentOpcodeNode = startOpcodeNode;
- StackElement stackElement = null;
+ StackElement stackElement = startStackElement;
+ visited.add(currentOpcodeNode);
while (currentOpcodeNode != null) {
listener.currentOpcode(currentOpcodeNode);
currentOpcodeNode.setBeforeExecutionStackElement(stackElement);
@@ -173,7 +180,7 @@
toVisitQue.add(next);
stackElementQue.add(stackElement);
}
- // FIXMELUC __________________________stack change
+ // stack change accepted
// else if (stackElement !=
// next.getBeforeExecutionStackElement()) {
// throw new EnhanceException("stack change:\n" + stackElement
@@ -289,7 +296,10 @@
@Override
public void visitJumpInsn(final int opcode, final Label label) {
- // TODO Auto-generated method stub
+ // FIXMELUC ______________________for test
+ if (opcode == JSR) {
+ System.out.println(); // NOPMD
+ }
currentOpcodeNode = new OpcodeNode(opcode, currentAddress++,
currentLineNumber, currentOpcodeNode);
addGoto(currentOpcodeNode, label);
@@ -301,6 +311,7 @@
@Override
public void visitLabel(final Label label) {
+ assert visitedLabel == null;
visitedLabel = label;
}
@@ -355,7 +366,7 @@
@Override
public void visitTryCatchBlock(final Label start, final Label end,
final Label handler, final String type) {
- // TODO Auto-generated method stub
+ handlerEntrySet.add(handler);
}
@Override
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ForTestCheckMethodVisitor.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ForTestCheckMethodVisitor.java 2011-10-12 03:04:21 UTC (rev 2917)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ForTestCheckMethodVisitor.java 2011-10-14 06:00:31 UTC (rev 2918)
@@ -22,9 +22,6 @@
*/
package net.sf.joafip.store.service.bytecode.proxy;
-import net.sf.joafip.store.service.bytecode.proxy.CheckMethodVisitor;
-import net.sf.joafip.store.service.bytecode.proxy.ICheckMethodListener;
-
/**
*
* @author luc peuvrier
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/TestCheckMethodVisitor.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/TestCheckMethodVisitor.java 2011-10-12 03:04:21 UTC (rev 2917)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/TestCheckMethodVisitor.java 2011-10-14 06:00:31 UTC (rev 2918)
@@ -27,6 +27,7 @@
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.util.Set;
import net.sf.joafip.AbstractJoafipTestCase;
import net.sf.joafip.TestException;
@@ -57,6 +58,8 @@
private transient String methodDescriptor;
+ private transient String absoluteMethodName;
+
public TestCheckMethodVisitor() throws TestException {
super();
}
@@ -77,6 +80,7 @@
checkMethodListener = null;// NOPMD
methodName = null;// NOPMD
methodDescriptor = null;// NOPMD
+ absoluteMethodName = null;// NOPMD
super.tearDown();
}
@@ -178,6 +182,14 @@
checkMethodListener.hasDirectAccess());
}
+ public void testWhileNokMethod() throws NoSuchMethodException, IOException,
+ EnhanceException {
+ check("whileNokMethod", new Class[] { ToCheckClass.class });
+ assertTrue("whileNokMethod() must not be ok\n" + directAccess(),
+ checkMethodListener.hasDirectAccess());
+ assertDirectAccess(new int[] { 104 });
+ }
+
public void testWhileMethod() throws NoSuchMethodException, IOException,
EnhanceException {
check("whileMethod", new Class[] { Class.class });
@@ -185,28 +197,77 @@
checkMethodListener.hasDirectAccess());
}
+ public void testTryCatchMethod() throws NoSuchMethodException, IOException,
+ EnhanceException {
+ check("tryCatchMethod", new Class[] { ToCheckClass.class });
+ assertTrue("tryCatchMethod() must not be ok\n" + directAccess(),
+ checkMethodListener.hasDirectAccess());
+ assertDirectAccess(new int[] { 127 });
+ }
+
+ public void testTryCatchNopMethod() throws NoSuchMethodException,
+ IOException, EnhanceException {
+ check("tryCatchNopMethod", new Class[] {});
+ assertFalse("tryCatchNopMethod() must be ok\n" + directAccess(),
+ checkMethodListener.hasDirectAccess());
+ }
+
+ public void testIndirectMethod() throws NoSuchMethodException, IOException,
+ EnhanceException {
+ check("indirectMethod", new Class[] {});
+ assertTrue("indirectMethod() must not be ok\n" + directAccess(),
+ checkMethodListener.hasDirectAccess());
+ assertDirectAccess(new int[] { 142 });
+ }
+
+ public void testFinallyMethod() throws NoSuchMethodException, IOException,
+ EnhanceException {
+ check("finallyMethod", new Class[] { ToCheckClass.class });
+ assertTrue("finallyMethod() must not be ok\n" + directAccess(),
+ checkMethodListener.hasDirectAccess());
+ assertDirectAccess(new int[] { 149 });
+ }
+
+ private void assertDirectAccess(final int[] lineNumbers) {
+ final int numberOfError = lineNumbers.length;
+ final Set<DirectAccessInfo> directAccessSet = checkMethodListener
+ .getDirectAccessSet();
+ assertEquals("bad number of error", numberOfError,
+ directAccessSet.size());
+ for (int lineNumber : lineNumbers) {
+ final DirectAccessInfo key =
+ /**/new DirectAccessInfo(absoluteMethodName, null, lineNumber);// NOPMD
+ assertTrue("expected error " + key, directAccessSet.contains(key));
+ }
+ }
+
private String directAccess() {
final StringBuilder stringBuilder = new StringBuilder();
for (DirectAccessInfo directAccessInfo : checkMethodListener
.getDirectAccessSet()) {
stringBuilder.append(directAccessInfo.toString());
stringBuilder.append('\n');
- stringBuilder.append(checkMethodListener
- .unassembled(directAccessInfo.getMethodAbsoluteName()));
- stringBuilder.append('\n');
+ // stringBuilder.append(checkMethodListener
+ // .unassembled(directAccessInfo.getMethodAbsoluteName()));
+ // stringBuilder.append('\n');
}
return stringBuilder.toString();
}
- private void check(final String name, final Class<?>[] parameterTypes)
+ private void check(final String methodName, final Class<?>[] parameterTypes)
throws NoSuchMethodException, IOException, EnhanceException {
- if (name == null) {
+ if (methodName == null) {
setConstructorTotest(parameterTypes);
} else {
- setMethodTotest(name, parameterTypes);
+ setMethodTotest(methodName, parameterTypes);
}
+ final String toCheckClassName = ToCheckClass.class.getName().replace(
+ '.', '/');
+ absoluteMethodName = toCheckClassName + "#"
+ + (methodName == null ? "<init>" : methodName)
+ + methodDescriptor;
final InputStream inputStream = ClassLoader
- .getSystemResourceAsStream("net/sf/joafip/store/service/bytecode/proxy/ToCheckClass.class");
+ .getSystemResourceAsStream(toCheckClassName + ".class");
final ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
int byteValue;
while ((byteValue = inputStream.read()) != -1) {// NOPMD
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ToCheckClass.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ToCheckClass.java 2011-10-12 03:04:21 UTC (rev 2917)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/bytecode/proxy/ToCheckClass.java 2011-10-14 06:00:31 UTC (rev 2918)
@@ -101,7 +101,7 @@
public void whileNokMethod(final ToCheckClass toCheckClass) {
int count = 0;
while (count < 5) {
- toCheckClass.globalCount++;
+ toCheckClass.globalCount++;// direct access
count++;
}
}
@@ -119,4 +119,34 @@
@SuppressWarnings("PMD")
private void operation(final Class<?> clazz) {
}
+
+ public void tryCatchMethod(final ToCheckClass toCheckClass) {
+ try {
+ operation(getClass());
+ } catch (Exception exception) {
+ toCheckClass.globalCount++;// direct access
+ }
+ }
+
+ public void tryCatchNopMethod() {
+ try {
+ incStaticCount();
+ } catch (Exception exception) {// NOPMD
+ // ignore
+ }
+ operation(getClass());
+ }
+
+ public Class<?> indirectMethod() {
+ final ToCheckClass toCheckClass = this;
+ return toCheckClass.root;// NOPMD
+ }
+
+ public void finallyMethod(final ToCheckClass toCheckClass) {
+ try {
+ operation(getClass());
+ } finally {
+ toCheckClass.globalCount++;// direct access
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-16 10:31:34
|
Revision: 2924
http://joafip.svn.sourceforge.net/joafip/?rev=2924&view=rev
Author: luc_peuvrier
Date: 2011-10-16 10:31:27 +0000 (Sun, 16 Oct 2011)
Log Message:
-----------
substitution management refactoring
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/service/bug/savenum/TestEnumKeptInMemory.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/manager/AbstractBinaryDump.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-16 09:31:31 UTC (rev 2923)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-16 10:31:27 UTC (rev 2924)
@@ -88,7 +88,7 @@
public DataRecordIdentifier dataRecordIdentifier;
/** object substitute, null if none */
- public ObjectAndPersistInfo substituteObjectAndPersistInfo;
+ private ObjectAndPersistInfo substituteObjectAndPersistInfo;
/** substitution of, null is not an object substitution */
private ObjectAndPersistInfo substitutionOfObject;
@@ -307,19 +307,43 @@
/**
* set the substitute object for an object
*
- * @param substituteObject
+ * @param substituteObjectAndPersistInfo
* the substitute object
* @throws ObjectIOException
*/
public void setSubstituteObjectAndPersistInfo(
- final ObjectAndPersistInfo substituteObject)
+ final ObjectAndPersistInfo substituteObjectAndPersistInfo)
throws ObjectIOException {
// ASSERTX
- assert substituteObject.getObject() != null : "no substitution object defined";
- this.substituteObjectAndPersistInfo = substituteObject;
- substituteObject.substitutionOfObject = this;
+ assert substituteObjectAndPersistInfo.getObject() != null : "no substitution object defined";
+ this.substituteObjectAndPersistInfo = substituteObjectAndPersistInfo;
+ substituteObjectAndPersistInfo.substitutionOfObject = this;
}
+ public ObjectAndPersistInfo getSubstituteObjectAndPersistInfo() {
+ return substituteObjectAndPersistInfo;
+ }
+
+ public void clearSubstitution() {
+ if (substitutionOfObject != null) {
+ substitutionOfObject.substituteObjectAndPersistInfo = null;// NOPMD
+ substitutionOfObject = null;// NOPMD
+ }
+ }
+
+ public ObjectAndPersistInfo getSubstitutionOfObject() {
+ return substitutionOfObject;
+ }
+
+ public void setSubstitutionOfObject(
+ final ObjectAndPersistInfo substitutionOfObject) {
+ this.substitutionOfObject = substitutionOfObject;
+ }
+
+ public boolean isSubstituted() {
+ return substituteObjectAndPersistInfo != null;
+ }
+
public void clearSonReadObject() {
sonReadObjectList.clear();
}
@@ -435,13 +459,6 @@
return object != null;
}
- public void clearSubstitution() {
- if (substitutionOfObject != null) {
- substitutionOfObject.substituteObjectAndPersistInfo = null;// NOPMD
- substitutionOfObject = null;// NOPMD
- }
- }
-
public boolean isWeak() {
return weakReference != null;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-16 09:31:31 UTC (rev 2923)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-16 10:31:27 UTC (rev 2924)
@@ -537,7 +537,7 @@
final ClassInfo classInfo = objectAndItsClassInfo.objectClassInfo;
final ClassInfo substituteClassInfo = classInfo
.getSubstituteClassInfo();
- result = objectAndItsClassInfo.substituteObjectAndPersistInfo;
+ result = objectAndItsClassInfo.getSubstituteObjectAndPersistInfo();
if (result == null) {
Class<?> substituteClass;
substituteClass = substituteClassInfo.getObjectClass();
@@ -1015,7 +1015,7 @@
ObjectIODataRecordNotFoundException, ObjectIODataCorruptedException {
// will write original object else will write the substitute
ObjectAndPersistInfo toWriteObjectAndPersistInfo =
- /**/objectAndItsPersistInfo.substituteObjectAndPersistInfo;
+ /**/objectAndItsPersistInfo.getSubstituteObjectAndPersistInfo();
if (toWriteObjectAndPersistInfo == null) {
toWriteObjectAndPersistInfo = objectAndItsPersistInfo;
}
@@ -1138,7 +1138,8 @@
protected ObjectAndPersistInfo substituteObject(
final ObjectAndPersistInfo objectAndPersistInfo)
throws ObjectIOException, ObjectIODataCorruptedException {
- ObjectAndPersistInfo substituteObjectAndPersistInfo = objectAndPersistInfo.substituteObjectAndPersistInfo;
+ ObjectAndPersistInfo substituteObjectAndPersistInfo = objectAndPersistInfo
+ .getSubstituteObjectAndPersistInfo();
if (substituteObjectAndPersistInfo == null) {
final Object object = objectAndPersistInfo.getObject();
final ClassInfo classInfo = objectAndPersistInfo.objectClassInfo;
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-10-16 09:31:31 UTC (rev 2923)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-10-16 10:31:27 UTC (rev 2924)
@@ -194,7 +194,7 @@
throws ObjectIOException {
// will write original object else will write the substitute
ObjectAndPersistInfo toWriteObjectAndItsClassInfo =
- /**/objectAndPersistInfo.substituteObjectAndPersistInfo;
+ /**/objectAndPersistInfo.getSubstituteObjectAndPersistInfo();
if (toWriteObjectAndItsClassInfo == null) {
toWriteObjectAndItsClassInfo = objectAndPersistInfo;
}
@@ -237,7 +237,7 @@
ObjectIODataRecordNotFoundException, ObjectIOClassNotFoundException {
// will write original object else will write the substitute
ObjectAndPersistInfo toWriteObjectAndItsClassInfo =
- /**/objectAndPersistInfo.substituteObjectAndPersistInfo;
+ /**/objectAndPersistInfo.getSubstituteObjectAndPersistInfo();
if (toWriteObjectAndItsClassInfo == null) {
toWriteObjectAndItsClassInfo = objectAndPersistInfo;
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/bug/savenum/TestEnumKeptInMemory.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/bug/savenum/TestEnumKeptInMemory.java 2011-10-16 09:31:31 UTC (rev 2923)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/bug/savenum/TestEnumKeptInMemory.java 2011-10-16 10:31:27 UTC (rev 2924)
@@ -61,7 +61,7 @@
}
@Override
- protected void setUp() throws Exception {
+ protected void setUp() throws Exception { // NOPMD
super.setUp();
createFilePersistence();
}
@@ -157,7 +157,8 @@
dataAccessSession.open();
bobContainer = (BobContainer) dataAccessSession.getObject("key");
- assertEquals(BAD_VALUE, EnumOrderType.BOX, bobContainer.getObject1());
+ final Object object1 = bobContainer.getObject1();
+ assertEquals(BAD_VALUE, EnumOrderType.BOX, object1);
assertEquals(BAD_VALUE, EnumStrategy.ALL_TYPES,
bobContainer.getObject2());
bobContainer.setObject1(EnumOrderType.DRAWING_ORDER_CONTAINER);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/manager/AbstractBinaryDump.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/manager/AbstractBinaryDump.java 2011-10-16 09:31:31 UTC (rev 2923)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/manager/AbstractBinaryDump.java 2011-10-16 10:31:27 UTC (rev 2924)
@@ -245,7 +245,7 @@
assertNull("reference change list must be undefined",
objectAndItsPersistInfo.referenceChangeList);
assertNull("subsititute object must not be defined",
- objectAndItsPersistInfo.substituteObjectAndPersistInfo);
+ objectAndItsPersistInfo.getSubstituteObjectAndPersistInfo());
assertEquals("son wrote list must be cleared", 0,
objectAndItsPersistInfo.sonWroteObjectArray.length);
assertNull("serialized form must be cleared",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-16 10:31:34
|
Revision: 2924
http://joafip.svn.sourceforge.net/joafip/?rev=2924&view=rev
Author: luc_peuvrier
Date: 2011-10-16 10:31:27 +0000 (Sun, 16 Oct 2011)
Log Message:
-----------
substitution management refactoring
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/service/bug/savenum/TestEnumKeptInMemory.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/manager/AbstractBinaryDump.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-17 04:43:28
|
Revision: 2927
http://joafip.svn.sourceforge.net/joafip/?rev=2927&view=rev
Author: luc_peuvrier
Date: 2011-10-17 04:43:22 +0000 (Mon, 17 Oct 2011)
Log Message:
-----------
substitution management refactoring
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/AbstractDeepCopy.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/DeepCopier.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/IDeepCopyServiceDelegate.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/ToProxyDeepCopier.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java
Added Paths:
-----------
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-17 04:43:29
|
Revision: 2927
http://joafip.svn.sourceforge.net/joafip/?rev=2927&view=rev
Author: luc_peuvrier
Date: 2011-10-17 04:43:22 +0000 (Mon, 17 Oct 2011)
Log Message:
-----------
substitution management refactoring
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/AbstractDeepCopy.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/DeepCopier.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/IDeepCopyServiceDelegate.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/ToProxyDeepCopier.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java
Added Paths:
-----------
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -237,9 +237,6 @@
private final Map<Integer, Map<Integer, Deque<ClassReplacementDef>>> conversionMap =
/**/new TreeMap<Integer, Map<Integer, Deque<ClassReplacementDef>>>();
- /** true if this is a class of object kept in memory */
- private boolean keptInMemory;
-
private AbstractConverter binaryConverter;
/** binary form size, -1 for unknown size */
@@ -657,7 +654,7 @@
|| stringType || storeNotLazy
|| storeSerializeAndGZippedInOneRecord
|| storeSerializeAndZippedInOneRecord
- || storeSerializeInOneRecord || keptInMemory;
+ || storeSerializeInOneRecord;
}
private void initializeFieldInfo() throws ClassInfoException {
@@ -1456,8 +1453,6 @@
stringBuilder.append(allDeclaredFieldsForGenericIO);
stringBuilder.append("\nconversionMap=");
stringBuilder.append(conversionMap);
- stringBuilder.append("\nkeptInMemory=");
- stringBuilder.append(keptInMemory);
return stringBuilder.toString();
}
@@ -1587,14 +1582,6 @@
return proxyable;
}
- public void setKeptInMemory() {
- keptInMemory = true;
- }
-
- public boolean isKeptInMemory() {
- return keptInMemory;
- }
-
public void setBinaryConverter(final AbstractConverter binaryConverter) {
this.binaryConverter = binaryConverter;
this.binarySize = binaryConverter.byteSize();
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -74,7 +74,6 @@
import net.sf.joafip.store.service.heaprecordable.HeapRecordableException;
import net.sf.joafip.store.service.heaprecordable.HeapRecordableManager;
import net.sf.joafip.store.service.kept.EnumSubstituteManager;
-import net.sf.joafip.store.service.kept.KeptInMemoryObjectManager;
import net.sf.joafip.store.service.objectio.ObjectIOClassNotFoundException;
import net.sf.joafip.store.service.objectio.ObjectIODataCorruptedException;
import net.sf.joafip.store.service.objectio.ObjectIODataRecordNotFoundException;
@@ -156,9 +155,6 @@
private ConversionManager conversionManager;
- private final KeptInMemoryObjectManager keptInMemorySubstituteObjectManager =
- /**/new KeptInMemoryObjectManager();
-
private final EnumSubstituteManager enumSubstituteManager =
/**/new EnumSubstituteManager();
@@ -582,20 +578,17 @@
public void keptInMemory(final String key, final Object object)
throws StoreException {
final Class<? extends Object> objectClass = object.getClass();
- ClassInfo classInfo;
- try {
- classInfo = classInfoFactory.getNoProxyClassInfo(objectClass);
- } catch (final ClassInfoException exception) {
- throw new StoreException(exception);
- }
- // FIXMELUC ___________________not good classInfo.setKeptInMemory()
- classInfo.setKeptInMemory();
setSubstituteObjectManager(objectClass, KeptInMemoryObjectKey.class,
- keptInMemorySubstituteObjectManager);
- keptInMemorySubstituteObjectManager.addObject(key, object);
+ objectIOManager.getKeptInMemorySubstituteObjectManager());
+ objectIOManager.addObject(key, object);
}
@Override
+ public boolean isKeptInMemory(final Object object) {
+ return objectIOManager.isKeptInMemory(object);
+ }
+
+ @Override
public void referencedByPesistedStaticField(
final Class<?> classHavingStaticFieldReferenced)
throws StoreException {
@@ -632,7 +625,7 @@
@Override
public String keyOfObjectKeptInMemory(final Object object) {
- return keptInMemorySubstituteObjectManager.keyOfObject(object);
+ return objectIOManager.keyOfObject(object);
}
@Override
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/AbstractDeepCopy.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/AbstractDeepCopy.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/AbstractDeepCopy.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -86,6 +86,8 @@
protected transient ClassInfoFactory classInfoFactory;
+ protected transient IDeepCopyServiceDelegate deepCopyServiceDelagate;
+
protected AbstractDeepCopy() {
super();
}
@@ -105,6 +107,7 @@
final boolean forceLoad) throws CopierException {
this.rootSourceObject = rootSourceObject;
this.classInfoFactory = deepCopyServiceDelagate.getClassInfoFactory();
+ this.deepCopyServiceDelagate = deepCopyServiceDelagate;
final IProxyManagerForObjectIO proxyManager2 = deepCopyServiceDelagate
.getProxyManager2();
final Object sourceCopy;
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/DeepCopier.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/DeepCopier.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/DeepCopier.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -81,7 +81,8 @@
@Override
protected boolean mustBeCopied(final Object objectToCopy,
final ClassInfo classInfo) {
- return true ^ (classInfo.isKeptInMemory() || classInfo.isEnumType());
+ return true ^ (deepCopyServiceDelagate.isKeptInMemory(objectToCopy) || classInfo
+ .isEnumType());
}
@Override
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/IDeepCopyServiceDelegate.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/IDeepCopyServiceDelegate.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/IDeepCopyServiceDelegate.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -43,4 +43,6 @@
Object newInstance(Class<?> objectClass);
Object newInstanceNoConstruction(ClassInfo objectClassInfo);
+
+ boolean isKeptInMemory(Object object);
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/ToProxyDeepCopier.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/ToProxyDeepCopier.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/copier/ToProxyDeepCopier.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -167,7 +167,7 @@
protected boolean mustBeCopied(final Object objectToCopy,
final ClassInfo objectToCopyClassInfo) throws CopierException {
try {
- return !(objectToCopyClassInfo.isKeptInMemory()
+ return !(deepCopyServiceDelagate.isKeptInMemory(objectToCopy)
|| objectToCopyClassInfo.isWriteSubstituted()
|| objectToCopyClassInfo.isStoreInOneReccord()
|| objectToCopyClassInfo.isBasicType()
@@ -194,7 +194,7 @@
throw new CopierException("must not copy not loaded proxy");
}
newInstance = sourceObject;
- } else if (sourceObjectClassInfo.isKeptInMemory()
+ } else if (deepCopyServiceDelagate.isKeptInMemory(sourceObject)
|| sourceObjectClassInfo.isSubstituted()
|| sourceObjectClassInfo.isStoreNotLazy()
|| sourceObjectClassInfo.isSubstituted()
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -59,6 +59,10 @@
}
}
+ public boolean isKeptInMemory(final Object object) {
+ return keyByObjectMap.containsKey(object);
+ }
+
public String keyOfObject(final Object object) {
final KeptInMemoryObjectKey keptInMemoryObjectKey = keyByObjectMap
.get(object);
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -43,7 +43,7 @@
*/
@NotStorableClass
public abstract class AbstractObjectIOManagerDelegatingToStateMap extends
- AbstractObjectIOManagerIOForObject {
+ AbstractObjectIOManagerKeptInMemory {
private final ObjectStateMgr objectStateMgr = new ObjectStateMgr();
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -1130,7 +1130,6 @@
return true;
}
- // FIXMELUC ______________________________________substituteObject
protected ObjectAndPersistInfo substituteObject(
final ObjectAndPersistInfo objectAndPersistInfo)
throws ObjectIOException, ObjectIODataCorruptedException {
Added: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java (rev 0)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.store.service.objectio.manager;
+
+import net.sf.joafip.store.service.StoreException;
+import net.sf.joafip.store.service.binary.HelperBinaryConversion;
+import net.sf.joafip.store.service.classinfo.ClassInfoFactory;
+import net.sf.joafip.store.service.kept.KeptInMemoryObjectManager;
+import net.sf.joafip.store.service.objectio.ObjectIOException;
+import net.sf.joafip.store.service.proxy.IProxyManagerForObjectIO;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+public abstract class AbstractObjectIOManagerKeptInMemory extends
+ AbstractObjectIOManagerIOForObject {
+
+ private final KeptInMemoryObjectManager keptInMemorySubstituteObjectManager =
+ /**/new KeptInMemoryObjectManager();
+
+ public AbstractObjectIOManagerKeptInMemory(
+ final int currentDataModelIdentifier,
+ final IClassNameManager classNameManager, final boolean proxyMode,
+ final ClassInfoFactory classInfoFactory,
+ final HelperBinaryConversion helperBinaryConversion,
+ final IProxyManagerForObjectIO proxyManager2)
+ throws ObjectIOException {
+ super(currentDataModelIdentifier, classNameManager, proxyMode,
+ classInfoFactory, helperBinaryConversion, proxyManager2);
+ }
+
+ public KeptInMemoryObjectManager getKeptInMemorySubstituteObjectManager() {
+ return keptInMemorySubstituteObjectManager;
+ }
+
+ public void addObject(final String key, final Object object)
+ throws StoreException {
+ keptInMemorySubstituteObjectManager.addObject(key, object);
+ }
+
+ public String keyOfObject(final Object object) {
+ return keptInMemorySubstituteObjectManager.keyOfObject(object);
+ }
+
+ public Object originalObject(final Object substitute)
+ throws ObjectIOException {
+ return keptInMemorySubstituteObjectManager.originalObject(substitute);
+ }
+
+ public Object substituteObject(final Object originalObject)
+ throws ObjectIOException {
+ return keptInMemorySubstituteObjectManager
+ .substituteObject(originalObject);
+ }
+
+ @Override
+ public boolean isKeptInMemory(final Object object) {
+ return keptInMemorySubstituteObjectManager.isKeptInMemory(object);
+ }
+}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -54,7 +54,7 @@
*/
@NotStorableClass
public class SerializerObjectIOManager extends
- AbstractObjectIOManagerIOForObject {
+ AbstractObjectIOManagerKeptInMemory {
private static final String MUST_NOT_BE_CALLED = "must not be called";
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -331,4 +331,9 @@
throws ObjectIOException {
// no implementation
}
+
+ @Override
+ public boolean isKeptInMemory(final Object object) {
+ return false;
+ }
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java 2011-10-17 03:49:21 UTC (rev 2926)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java 2011-10-17 04:43:22 UTC (rev 2927)
@@ -535,4 +535,9 @@
throws ObjectIOException {
// no implementation
}
+
+ @Override
+ public boolean isKeptInMemory(final Object object) {
+ return false;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-18 02:55:34
|
Revision: 2929
http://joafip.svn.sourceforge.net/joafip/?rev=2929&view=rev
Author: luc_peuvrier
Date: 2011-10-18 02:55:27 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
some instances of same class can be kept in memory and other not
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel300/TestKeptInMemory.java
Added Paths:
-----------
trunk/joafip/src/test/java/net/sf/joafip/entity/rel300/
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java 2011-10-17 08:46:43 UTC (rev 2928)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java 2011-10-18 02:55:27 UTC (rev 2929)
@@ -79,15 +79,8 @@
return originalObject;
}
- public Object substituteObject(final Object originalObject)
- throws ObjectIOException {
- final KeptInMemoryObjectKey substitute = keyByObjectMap
- .get(originalObject);
- if (substitute == null) {
- throw new ObjectIOException("no substitute for original object "
- + identityString(originalObject));
- }
- return substitute;
+ public Object substituteObject(final Object originalObject) {
+ return keyByObjectMap.get(originalObject);
}
private String identityString(final Object object) {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-17 08:46:43 UTC (rev 2928)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-18 02:55:27 UTC (rev 2929)
@@ -512,19 +512,20 @@
public DataRecordIdentifier getDataRecordIdentifierAssociatedToObject(
final ObjectAndPersistInfo objectAndPersistInfo)
throws ObjectIOException, ObjectIODataCorruptedException {
- final ObjectAndPersistInfo substituteObjectAndPersistInfo;
+ ObjectAndPersistInfo substituteObjectAndPersistInfo;
final ClassInfo classInfo = objectAndPersistInfo.objectClassInfo;
- if (classInfo.isKeptInMemory()) {
- substituteObjectAndPersistInfo = keptInMemorysubstituteObject(objectAndPersistInfo);
- } else if (classInfo.isSubstituted()) {
- substituteObjectAndPersistInfo = substituteObject(objectAndPersistInfo);
- } else if (classInfo.isWriteSubstituted()) {
+ if (classInfo.isWriteSubstituted()) {
substituteObjectAndPersistInfo = substituteForWrite(objectAndPersistInfo);
} else {
- substituteObjectAndPersistInfo = objectAndPersistInfo;
+ substituteObjectAndPersistInfo = keptInMemorysubstituteObject(objectAndPersistInfo);
+ if (substituteObjectAndPersistInfo == null) {
+ substituteObjectAndPersistInfo = substituteObject(objectAndPersistInfo);
+ if (substituteObjectAndPersistInfo == null) {
+ substituteObjectAndPersistInfo = objectAndPersistInfo;
+ }
+ }
}
- return localGetDataRecordIdentifierAssociatedToObject(
- /**/substituteObjectAndPersistInfo);
+ return localGetDataRecordIdentifierAssociatedToObject(substituteObjectAndPersistInfo);
}
public ObjectAndPersistInfo substituteForWrite(
@@ -1097,7 +1098,6 @@
ObjectIODataRecordNotFoundException,
ObjectIOClassNotFoundException, ObjectIODataCorruptedException,
ObjectIOTooBigForSerializationException {
- final ClassInfo classInfo = objectAndPersistInfo.objectClassInfo;
/*
* tested by store saver, can prepare write of not storable but will not
* be write
@@ -1107,26 +1107,17 @@
// + objectAndPersistInfo.toString());
// }
// final Object object = objectAndPersistInfo.getObject();
- // ASSERTX
- final ClassInfo toWriteClassInfo;
- final ObjectAndPersistInfo toWriteObjectAndPersistInfo;
- if (classInfo.isKeptInMemory()) {
- toWriteObjectAndPersistInfo = keptInMemorysubstituteObject(objectAndPersistInfo);
- toWriteClassInfo = toWriteObjectAndPersistInfo.objectClassInfo;
- } else if (classInfo.isSubstituted()) {
- // write substitute object
- final ObjectAndPersistInfo substituteObjectAndPersistInfo =
+ ObjectAndPersistInfo toWriteObjectAndPersistInfo;
+ toWriteObjectAndPersistInfo = keptInMemorysubstituteObject(objectAndPersistInfo);
+ if (toWriteObjectAndPersistInfo == null) {
+ toWriteObjectAndPersistInfo =
/**/substituteObject(objectAndPersistInfo);
- toWriteClassInfo = substituteObjectAndPersistInfo.objectClassInfo;
- toWriteObjectAndPersistInfo = substituteObjectAndPersistInfo;
-
- } else {
- // write original object
- toWriteClassInfo = classInfo;
- toWriteObjectAndPersistInfo = objectAndPersistInfo;
+ if (toWriteObjectAndPersistInfo == null) {
+ toWriteObjectAndPersistInfo = objectAndPersistInfo;
+ }
}
-
+ final ClassInfo toWriteClassInfo = toWriteObjectAndPersistInfo.objectClassInfo;
assert assertWritable(toWriteObjectAndPersistInfo);
final Object object = toWriteObjectAndPersistInfo.getObject();
final IObjectOutput objectOutput;
@@ -1150,21 +1141,27 @@
protected ObjectAndPersistInfo substituteObject(
final ObjectAndPersistInfo objectAndPersistInfo)
throws ObjectIOException, ObjectIODataCorruptedException {
- ObjectAndPersistInfo substituteObjectAndPersistInfo = objectAndPersistInfo
- .getSubstituteObjectAndPersistInfo();
- if (substituteObjectAndPersistInfo == null) {
- final Object object = objectAndPersistInfo.getObject();
- final ClassInfo classInfo = objectAndPersistInfo.objectClassInfo;
- final ISubstituteObjectManager substituteObjectManager = classInfo
- .getSubstituteObjectManager();
- final Object substituteObject = substituteObjectManager
- .substituteObject(object);
- final ClassInfo substituteClassInfo = classInfo
- .getSubstituteClassInfo();
- substituteObjectAndPersistInfo = getOrCreateObjectPersistInfoOfObject(
- substituteObject, Boolean.FALSE, substituteClassInfo, true/* persisted */);
- objectAndPersistInfo
- .setSubstituteObjectAndPersistInfo(substituteObjectAndPersistInfo);
+ ObjectAndPersistInfo substituteObjectAndPersistInfo;
+ if (objectAndPersistInfo.objectClassInfo.isSubstituted()) {
+ substituteObjectAndPersistInfo = objectAndPersistInfo
+ .getSubstituteObjectAndPersistInfo();
+ if (substituteObjectAndPersistInfo == null) {
+ final Object object = objectAndPersistInfo.getObject();
+ final ClassInfo classInfo = objectAndPersistInfo.objectClassInfo;
+ final ISubstituteObjectManager substituteObjectManager = classInfo
+ .getSubstituteObjectManager();
+ final Object substituteObject = substituteObjectManager
+ .substituteObject(object);
+ final ClassInfo substituteClassInfo = classInfo
+ .getSubstituteClassInfo();
+ substituteObjectAndPersistInfo = getOrCreateObjectPersistInfoOfObject(
+ substituteObject, Boolean.FALSE, substituteClassInfo,
+ true/* persisted */);
+ objectAndPersistInfo
+ .setSubstituteObjectAndPersistInfo(substituteObjectAndPersistInfo);
+ }
+ } else {
+ substituteObjectAndPersistInfo = null;// NOPMD
}
return substituteObjectAndPersistInfo;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java 2011-10-17 08:46:43 UTC (rev 2928)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java 2011-10-18 02:55:27 UTC (rev 2929)
@@ -83,14 +83,24 @@
protected ObjectAndPersistInfo keptInMemorysubstituteObject(
final ObjectAndPersistInfo objectAndPersistInfo)
throws ObjectIOException, ObjectIODataCorruptedException {
+ final ObjectAndPersistInfo substituteObjectAndPersistInfo;
+ if (objectAndPersistInfo.objectClassInfo.isKeptInMemory()) {
- final Object originalObject = objectAndPersistInfo.getObject();
- final Object substituteObject = keptInMemorySubstituteObjectManager
- .substituteObject(originalObject);
- final ObjectAndPersistInfo substituteObjectAndPersistInfo = getOrCreateObjectPersistInfoOfObject(
- substituteObject, Boolean.FALSE, substituteClassInfo, true/* persisted */);
- objectAndPersistInfo
- .setSubstituteObjectAndPersistInfo(substituteObjectAndPersistInfo);
+ final Object originalObject = objectAndPersistInfo.getObject();
+ final Object substituteObject = keptInMemorySubstituteObjectManager
+ .substituteObject(originalObject);
+ if (substituteObject == null) {
+ substituteObjectAndPersistInfo = null;
+ } else {
+ substituteObjectAndPersistInfo = getOrCreateObjectPersistInfoOfObject(
+ substituteObject, Boolean.FALSE, substituteClassInfo,
+ true/* persisted */);
+ objectAndPersistInfo
+ .setSubstituteObjectAndPersistInfo(substituteObjectAndPersistInfo);
+ }
+ } else {
+ substituteObjectAndPersistInfo = null;
+ }
return substituteObjectAndPersistInfo;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-10-17 08:46:43 UTC (rev 2928)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-10-18 02:55:27 UTC (rev 2929)
@@ -393,13 +393,13 @@
ObjectIOTooBigForSerializationException {
final ClassInfo classInfo = objectAndPersistInfo.objectClassInfo;
- final ObjectAndPersistInfo toWrite;
- if (classInfo.isKeptInMemory()) {
- toWrite = keptInMemorysubstituteObject(objectAndPersistInfo);
- } else if (classInfo.isSubstituted()) {
+ ObjectAndPersistInfo toWrite;
+ toWrite = keptInMemorysubstituteObject(objectAndPersistInfo);
+ if (toWrite == null) {
toWrite = substituteObject(objectAndPersistInfo);
- } else {
- toWrite = objectAndPersistInfo;
+ if (toWrite == null) {
+ toWrite = objectAndPersistInfo;
+ }
}
if (!objectAndPersistInfo.isLoadedOrNotAProxy()) {
throw new ObjectIOException("can not store not loaded object");
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/rel300/TestKeptInMemory.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel300/TestKeptInMemory.java 2011-10-17 08:46:43 UTC (rev 2928)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel300/TestKeptInMemory.java 2011-10-18 02:55:27 UTC (rev 2929)
@@ -22,12 +22,15 @@
*/
package net.sf.joafip.service.rel300;
+import java.util.Map;
+
import net.sf.joafip.AbstractDeleteFileTestCase;
import net.sf.joafip.NotStorableClass;
import net.sf.joafip.StorableAccess;
import net.sf.joafip.TestConstant;
import net.sf.joafip.TestException;
import net.sf.joafip.entity.EnumFilePersistenceCloseAction;
+import net.sf.joafip.java.util.PTreeMap;
import net.sf.joafip.service.FilePersistenceBuilder;
import net.sf.joafip.service.FilePersistenceClassNotFoundException;
import net.sf.joafip.service.FilePersistenceDataCorruptedException;
@@ -50,6 +53,8 @@
@StorableAccess
public class TestKeptInMemory extends AbstractDeleteFileTestCase {
+ private static final String MUST_BE_SAME_INSTANCE = "must be same instance";
+
private static final String KEY1 = "key1";
private static final String KEY2 = "key2";
@@ -65,7 +70,7 @@
}
@Override
- protected void setUp() throws Exception {
+ protected void setUp() throws Exception { // NOPMD
super.setUp();
// filePersistence = new FilePersistence(1, null, path,
// /**/true/* remove files */,
@@ -80,7 +85,7 @@
}
@Override
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception { // NOPMD
try {
filePersistence.close();
} catch (final Throwable throwable) {// NOPMD
@@ -116,12 +121,12 @@
dataAccessSession.open();
bobContainer1 = (BobContainer) dataAccessSession.getObject(KEY1);
- assertSame("must be same instance", keptInMemoryObject,
+ assertSame(MUST_BE_SAME_INSTANCE, keptInMemoryObject,
bobContainer1.getObject1());
final Bob1 bob1Read = (Bob1) bobContainer1.getObject2();
assertNotSame("must no be same object", bob1, bob1Read);
bobContainer2 = (BobContainer) dataAccessSession.getObject(KEY2);
- assertSame("must be same instance", keptInMemoryObject,
+ assertSame(MUST_BE_SAME_INSTANCE, keptInMemoryObject,
bobContainer2.getObject1());
}
@@ -148,7 +153,40 @@
dataAccessSession.open();
bobSerializable = (BobSerializable) dataAccessSession.getObject(KEY1);
- assertSame("must be same instance", keptInMemoryObject,
+ assertSame(MUST_BE_SAME_INSTANCE, keptInMemoryObject,
bobSerializable.getObject());
}
+
+ @SuppressWarnings("unchecked")
+ public void testClassPersistedAndOneInstanceKeptInMemory()
+ throws FilePersistenceException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceTooBigForSerializationException {
+ final Map<String, String> keptInMemoryMap = new PTreeMap<String, String>();
+ keptInMemoryMap.put("key1", "value1");
+ filePersistence.keptInMemory("map", keptInMemoryMap);
+ BobContainer bobContainer = new BobContainer();
+ bobContainer.setObject1(keptInMemoryMap);
+ Map<String, String> storedmap = new PTreeMap<String, String>();
+ storedmap.put("key2", "value2");
+ bobContainer.setObject2(storedmap);
+ final IDataAccessSession dataAccessSession = filePersistence
+ .createDataAccessSession();
+
+ dataAccessSession.open();
+ dataAccessSession.setObject(KEY1, bobContainer);
+ dataAccessSession.close(EnumFilePersistenceCloseAction.SAVE);
+ storedmap.clear();
+
+ dataAccessSession.open();
+ bobContainer = (BobContainer) dataAccessSession.getObject(KEY1);
+ assertSame(MUST_BE_SAME_INSTANCE, keptInMemoryMap,
+ bobContainer.getObject1());
+ storedmap = (Map<String, String>) bobContainer.getObject2();
+ assertEquals("bad content", "value2", storedmap.get("key2"));
+ dataAccessSession.close(EnumFilePersistenceCloseAction.SAVE);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-18 02:55:33
|
Revision: 2929
http://joafip.svn.sourceforge.net/joafip/?rev=2929&view=rev
Author: luc_peuvrier
Date: 2011-10-18 02:55:27 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
some instances of same class can be kept in memory and other not
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/kept/KeptInMemoryObjectManager.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerKeptInMemory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel300/TestKeptInMemory.java
Added Paths:
-----------
trunk/joafip/src/test/java/net/sf/joafip/entity/rel300/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-21 03:10:12
|
Revision: 2934
http://joafip.svn.sourceforge.net/joafip/?rev=2934&view=rev
Author: luc_peuvrier
Date: 2011-10-21 03:10:06 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
tests ok
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestSaveInExclusiveDataAccessSession.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java 2011-10-21 01:40:53 UTC (rev 2933)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java 2011-10-21 03:10:06 UTC (rev 2934)
@@ -176,28 +176,28 @@
}
// FIXMELUC _________________________for test
-// private boolean in() {
-// final StackTraceElement[] stackTraceElements = new Exception()
-// .getStackTrace();
-// final StackTraceElement stackTraceElement = stackTraceElements[3];
-// final String className = stackTraceElement.getClassName();
-// final String methodName = stackTraceElement.getMethodName();
-// return className.contains("MultiMap")
-// && methodName.contains("addKeyDefinition");
-// }
+ // private boolean in() {
+ // final StackTraceElement[] stackTraceElements = new Exception()
+ // .getStackTrace();
+ // final StackTraceElement stackTraceElement = stackTraceElements[3];
+ // final String className = stackTraceElement.getClassName();
+ // final String methodName = stackTraceElement.getMethodName();
+ // return className.contains("MultiMap")
+ // && methodName.contains("addKeyDefinition");
+ // }
@Override
@SuppressWarnings("PMD")
public void intercept$JOAFIP$() {
synchronized (storeMutex) {
- if (autoSaveEnabled) {
+ if (exclusiveAccessSession) {
inObjectCount++;
}
// FIXMELUC _________________________for test
-// if (in()) {
-// System.out.println("intercept " + inObjectCount + " "
-// + proxyObjectAndPersistInfo);
-// }
+ // if (in()) {
+ // System.out.println("intercept " + inObjectCount + " "
+ // + proxyObjectAndPersistInfo);
+ // }
// end for test
if (exclusiveAccessSession) {
try {
@@ -251,17 +251,17 @@
@SuppressWarnings("PMD")
public void methodEnd$JOAFIP$() {
// FIXMELUC _________________________for test
-// if (in()) {
-// System.out.println("methodEnd " + inObjectCount + " "
-// + proxyObjectAndPersistInfo);
-// }
+ // if (in()) {
+ // System.out.println("methodEnd " + inObjectCount + " "
+ // + proxyObjectAndPersistInfo);
+ // }
// end for test
synchronized (storeMutex) {
+ final ObjectAndPersistInfo instanceAndPersistInfo = getInstance$JOAFIP$();
+ if (--inObjectCount == 0) {
+ instanceAndPersistInfo.acceded = false;
+ }
if (autoSaveEnabled) {
- final ObjectAndPersistInfo instanceAndPersistInfo = getInstance$JOAFIP$();
- if (--inObjectCount == 0) {
- instanceAndPersistInfo.acceded = false;
- }
// ASSERTX
assert inObjectCount >= 0 : "running in object count can not be negative, is "
+ inObjectCount
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-21 01:40:53 UTC (rev 2933)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-21 03:10:06 UTC (rev 2934)
@@ -117,7 +117,7 @@
} else {
final Class<?> enhancedClass = classEnhancer.enhanceClass(
objectClassInfo, persistenceId,
- objectIOManager.isAutoSaveEnabled());
+ objectIOManager.isExclusiveAccessSession());
instanceCreated = helperReflect
.newInstanceNoConstruction(enhancedClass);
}
@@ -155,7 +155,7 @@
} else {
final Class<?> enhancedClass = classEnhancer.enhanceClass(
objectClassInfo, persistenceId,
- objectIOManager.isAutoSaveEnabled());
+ objectIOManager.isExclusiveAccessSession());
instanceCreated = reflectNewInstanceDefaultConstructor(enhancedClass);
}
if (createEntryinObjectMap) {
@@ -199,7 +199,7 @@
} else {
final Class<?> enhancedClass = classEnhancer.enhanceClass(
objectClassInfo, persistenceId,
- objectIOManager.isAutoSaveEnabled());
+ objectIOManager.isExclusiveAccessSession());
instanceCreated = reflectNewInstanceConstruct(enhancedClass,
parameterTypes, initargs);
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestSaveInExclusiveDataAccessSession.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestSaveInExclusiveDataAccessSession.java 2011-10-21 01:40:53 UTC (rev 2933)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestSaveInExclusiveDataAccessSession.java 2011-10-21 03:10:06 UTC (rev 2934)
@@ -96,9 +96,6 @@
super.setUp();
classInfoFactory = new ClassInfoFactory(1);
helperReflect = HelperReflect.getInstance();
- // filePersistence = new FilePersistence(1, null, path,
- // /**/true/* remove files */,
- // /**/false/* do not manage garbage */);
final FilePersistenceBuilder builder = new FilePersistenceBuilder();
builder.setPathName(path.getPath());
builder.setProxyMode(true);
@@ -107,7 +104,6 @@
builder.setCrashSafeMode(false);
filePersistence = (FilePersistence) builder.build();
dataAccessSession = filePersistence.createExclusiveDataAccessSession();
- // useJavaAgent = JoafipJavaAgent.isTransformerInstalled();
}
@Override
@@ -266,7 +262,9 @@
}
}
if (fail) {
- fail(builder.toString());
+ final String message = builder.toString();
+ logger.error(message);
+ fail(message);
}
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java 2011-10-21 01:40:53 UTC (rev 2933)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java 2011-10-21 03:10:06 UTC (rev 2934)
@@ -64,8 +64,9 @@
assertEquals("must not be in object", 0,
proxyManager2.getInObjectCount(object));
- assertEquals("must be in object", 1,
- ((Bob1) object).getInObjectCount(proxyManager2));
+ final int inObjectCount = ((Bob1) object)
+ .getInObjectCount(proxyManager2);
+ assertEquals("must be in object", 1, inObjectCount);
assertEquals("must not be in object", 0,
proxyManager2.getInObjectCount(object));
try {
@@ -84,4 +85,9 @@
public boolean isAutoSaveEnabled() { // NOPMD
return true;
}
+
+ @Override
+ public boolean isExclusiveAccessSession() {
+ return true;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-21 03:10:12
|
Revision: 2934
http://joafip.svn.sourceforge.net/joafip/?rev=2934&view=rev
Author: luc_peuvrier
Date: 2011-10-21 03:10:06 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
tests ok
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestSaveInExclusiveDataAccessSession.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-22 03:38:23
|
Revision: 2935
http://joafip.svn.sourceforge.net/joafip/?rev=2935&view=rev
Author: luc_peuvrier
Date: 2011-10-22 03:38:16 +0000 (Sat, 22 Oct 2011)
Log Message:
-----------
storage information management refactoring
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/StorageInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/ObjectIOBasicTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreation.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreationConstructed.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyFieldReflect.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPackageVisibility.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPrivate.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptProtected.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyManager2.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-22 03:38:23
|
Revision: 2935
http://joafip.svn.sourceforge.net/joafip/?rev=2935&view=rev
Author: luc_peuvrier
Date: 2011-10-22 03:38:16 +0000 (Sat, 22 Oct 2011)
Log Message:
-----------
storage information management refactoring
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/StorageInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/ObjectIOBasicTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreation.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreationConstructed.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyFieldReflect.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPackageVisibility.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPrivate.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptProtected.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyManager2.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/StorageInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/StorageInfo.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/StorageInfo.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -29,6 +29,7 @@
import net.sf.joafip.store.entity.classinfo.ClassInfo;
import net.sf.joafip.store.entity.conversion.ClassReplacementDef;
import net.sf.joafip.store.service.objectio.ObjectIOException;
+import net.sf.joafip.store.service.objectio.manager.AbstractObjectIOManagerIOForObject;
/**
* to store additional informations on stored class
@@ -39,11 +40,9 @@
@NotStorableClass
public class StorageInfo {
- private static final int INVALID_SIZE = -1;
-
private Deque<ClassReplacementDef> replacementDefList;
- private int headerDataSize = INVALID_SIZE;
+ private int headerDataSize = AbstractObjectIOManagerIOForObject.HEADER_DATA_SIZE;
/** joafip release identifier of data record */
private int joafipReleaseId;
@@ -51,11 +50,6 @@
/** data model identifier of data record */
private int dataModelIdentifier;
- public StorageInfo(final int headerDataSize) {
- super();
- this.headerDataSize = headerDataSize;
- }
-
public Deque<ClassReplacementDef> getReplacementDefList() {
return replacementDefList;
}
@@ -91,15 +85,11 @@
}
public int getHeaderDataSize() {
- // ASSERTX
- assert headerDataSize != INVALID_SIZE : "header data size not set";
return headerDataSize;
}
public void setHeaderDataSize(final int headerDataSize)
throws ObjectIOException {
- // ASSERTX
- assert headerDataSize != INVALID_SIZE : "header data size not set";
this.headerDataSize = headerDataSize;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/AbstractDelegatingToStoreManagers.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -77,7 +77,6 @@
import net.sf.joafip.store.service.objectio.ObjectIODataCorruptedException;
import net.sf.joafip.store.service.objectio.ObjectIODataRecordNotFoundException;
import net.sf.joafip.store.service.objectio.ObjectIOException;
-import net.sf.joafip.store.service.objectio.manager.AbstractObjectIOManagerIOForObject;
import net.sf.joafip.store.service.objectio.manager.ClassNameManager;
import net.sf.joafip.store.service.objectio.manager.IClassNameManager;
import net.sf.joafip.store.service.objectio.manager.ObjectIOManager;
@@ -759,8 +758,7 @@
private Object newProxyInstance(final ClassInfo objectClassInfo,
final Class<?>[] parameterTypes, final Object[] initargs)
throws ProxyException {
- final StorageInfo storageInfo = new StorageInfo(
- AbstractObjectIOManagerIOForObject.HEADER_DATA_SIZE);
+ final StorageInfo storageInfo = new StorageInfo();
return proxyManager2.newInstanceConstruct(objectClassInfo,
parameterTypes, initargs, storageInfo, objectIOManager,
null/*
@@ -776,8 +774,7 @@
.getNoProxyClassInfo(objectClass);
final Object newInstance;
if (proxyMode) {
- final StorageInfo storageInfo = new StorageInfo(
- AbstractObjectIOManagerIOForObject.HEADER_DATA_SIZE);
+ final StorageInfo storageInfo = new StorageInfo();
newInstance = proxyManager2.newInstanceConstruct(
objectClassInfo, storageInfo, objectIOManager,
null/*
@@ -816,8 +813,7 @@
try {
final Object newInstance;
if (proxyMode) {
- final StorageInfo storageInfo = new StorageInfo(
- AbstractObjectIOManagerIOForObject.HEADER_DATA_SIZE);
+ final StorageInfo storageInfo = new StorageInfo();
final ObjectAndPersistInfo objectAndPersistInfo = proxyManager2
.newInstanceNoConstruction(objectClassInfo,
storageInfo, objectIOManager, null/*
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -70,7 +70,6 @@
import net.sf.joafip.store.service.objectio.ObjectIOException;
import net.sf.joafip.store.service.objectio.ObjectIOInvalidClassException;
import net.sf.joafip.store.service.objectio.ObjectIONotSerializableException;
-import net.sf.joafip.store.service.objectio.manager.AbstractObjectIOManagerIOForObject;
import net.sf.joafip.store.service.objectio.manager.IObjectIOManagerForObjectIO;
import net.sf.joafip.store.service.objectio.manager.ISubsituteSynchronizer;
import net.sf.joafip.store.service.objectio.manager.ISubstituteObjectManager;
@@ -1069,12 +1068,9 @@
if (proxyMode) {
/* store root will be store in data record #1 */
storeRoot = (StoreRoot4) proxyManager2
- .newInstanceConstruct(
- storeRootClassInfo,
- new StorageInfo(
- AbstractObjectIOManagerIOForObject.HEADER_DATA_SIZE),
- objectIOManager, dataRecordIdentifier,
- true);
+ .newInstanceConstruct(storeRootClassInfo,
+ new StorageInfo(), objectIOManager,
+ dataRecordIdentifier, true);
} else {
storeRoot = new StoreRoot4();
/*
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -656,7 +656,7 @@
final ObjectAndPersistInfo objectAndPersistInfo;
- final StorageInfo storageInfo = new StorageInfo(HEADER_DATA_SIZE);
+ final StorageInfo storageInfo = new StorageInfo();
storageInfo.setReplacementDefList(replacementDef);
storageInfo.setHeaderDataSize(headerReader.headerDataSize);
storageInfo.setJoafipReleaseId(headerReader.joafipReleaseId);
@@ -1393,8 +1393,8 @@
final ClassInfo objectClassInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
return proxyManager2.newInstanceConstruct(objectClassInfo,
- parameterTypes, initargs,
- new StorageInfo(HEADER_DATA_SIZE), this, null, true);
+ parameterTypes, initargs, new StorageInfo(), this, null,
+ true);
} catch (final ClassInfoException exception) {
throw new ObjectIORuntimeException(exception);
} catch (final ProxyException exception) {
@@ -1408,7 +1408,7 @@
final ClassInfo objectClassInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
return proxyManager2.newInstanceConstruct(objectClassInfo,
- new StorageInfo(HEADER_DATA_SIZE), this, null, true);
+ new StorageInfo(), this, null, true);
} catch (final ClassInfoException exception) {
throw new ObjectIORuntimeException(exception);
} catch (final ProxyException exception) {
@@ -1416,26 +1416,11 @@
}
}
- // @Override
- // public Object newInstanceNoConstruction(final Class<?> objectClass) {
- // try {
- // final ClassInfo objectClassInfo = classInfoFactory
- // .getNoProxyClassInfo(objectClass);
- // return proxyManager2.newInstanceNoConstruction(objectClassInfo,
- // new StorageInfo(HEADER_DATA_SIZE), this, null, true)
- // .getObject();
- // } catch (final ClassInfoException exception) {
- // throw new ObjectIORuntimeException(exception);
- // } catch (final ProxyException exception) {
- // throw new ObjectIORuntimeException(exception);
- // }
- // }
-
@Override
public Object newInstanceNoConstruction(final ClassInfo objectClassInfo) {
try {
return proxyManager2.newInstanceNoConstruction(objectClassInfo,
- new StorageInfo(HEADER_DATA_SIZE), this, null, true);
+ new StorageInfo(), this, null, true);
} catch (final ProxyException exception) {
throw new ObjectIORuntimeException(exception);
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -103,7 +103,7 @@
final ClassInfo objectClassInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
return proxyManager2.newInstanceConstruct(objectClassInfo,
- parameterTypes, initargs, new StorageInfo(0), this,
+ parameterTypes, initargs, new StorageInfo(), this,
null/* dataRecordIdentifier */, true/* persisted */);
} catch (ClassInfoException exception) {
throw new StoreRuntimeException(exception);
@@ -118,7 +118,7 @@
final ClassInfo objectClassInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
return proxyManager2.newInstanceConstruct(objectClassInfo,
- new StorageInfo(0), this, null/* dataRecordIdentifier */,
+ new StorageInfo(), this, null/* dataRecordIdentifier */,
true/* persisted */);
} catch (ClassInfoException exception) {
throw new StoreRuntimeException(exception);
@@ -146,7 +146,7 @@
public Object newInstanceNoConstruction(final ClassInfo objectClassInfo) {
try {
return proxyManager2.newInstanceNoConstruction(objectClassInfo,
- new StorageInfo(0), this, null/* dataRecordIdentifier */,
+ new StorageInfo(), this, null/* dataRecordIdentifier */,
true/* persisted */).getObject();
} catch (ProxyException exception) {
throw new StoreRuntimeException(exception);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractObjectIOTest.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -490,7 +490,7 @@
final ClassInfo objectClassInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
return proxyManager2.newInstanceConstruct(objectClassInfo,
- parameterTypes, initargs, new StorageInfo(0), this, null,
+ parameterTypes, initargs, new StorageInfo(), this, null,
true);
} catch (ClassInfoException exception) {
throw new ObjectIORuntimeException(exception);
@@ -505,7 +505,7 @@
final ClassInfo objectClassInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
return proxyManager2.newInstanceConstruct(objectClassInfo,
- new StorageInfo(0), this, null, true);
+ new StorageInfo(), this, null, true);
} catch (ClassInfoException exception) {
throw new ObjectIORuntimeException(exception);
} catch (ProxyException exception) {
@@ -532,7 +532,7 @@
public Object newInstanceNoConstruction(final ClassInfo objectClassInfo) {
try {
return proxyManager2.newInstanceNoConstruction(objectClassInfo,
- new StorageInfo(0), this, null, true);
+ new StorageInfo(), this, null, true);
} catch (ProxyException exception) {
throw new ObjectIORuntimeException(exception);
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -132,7 +132,7 @@
final IObjectInput objectInput = new ObjectInputImmediateSerializable(
this, classInfoFactory, proxyManager2, helperBinaryConversion);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
// storageInfo.setHeaderDataSize(0);
ObjectAndPersistInfo unserializedAndPersistInfo = objectInput
.createObject(dataRecordIdentifier, binary, classInfo,
@@ -178,8 +178,8 @@
ObjectIODataRecordNotFoundException,
ObjectIOClassNotFoundException, ObjectIODataCorruptedException,
ObjectIOTooBigForSerializationException {
- final int offset = 0;
- final StorageInfo storageInfo = new StorageInfo(offset);
+ final StorageInfo storageInfo = new StorageInfo();
+ final int offset = storageInfo.getHeaderDataSize();
final ObjectAndPersistInfo objectAndPersistInfo =
/**/new ObjectAndPersistInfo(toSerialize, false, classInfo,
storageInfo);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/ObjectIOBasicTest.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/ObjectIOBasicTest.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/ObjectIOBasicTest.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -60,12 +60,12 @@
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(Integer.class);
final Integer integer = Integer.valueOf(10);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final ObjectAndPersistInfo objectAndItsClassInfo =
/**/new ObjectAndPersistInfo(integer, false, classInfo, storageInfo);
objectOutput.prepareWrite(objectAndItsClassInfo);
final byte[] binary = new byte[1000];
- final int offset = 0;
+ final int offset = storageInfo.getHeaderDataSize();
storageInfo.setHeaderDataSize(offset);
// int byte size to skip class name information
objectOutput
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyAutoSave.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -53,7 +53,7 @@
final Class<Bob1> objectClass = Bob1.class;
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final ProxyManager2 proxyManager2 = new ProxyManager2(
new ClassLoaderProvider(), classInfoFactory);
// change persistence id to have a new proxy class name
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreation.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreation.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreation.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -81,7 +81,7 @@
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final ProxyManager2 proxyManager2 = new ProxyManager2(
new ClassLoaderProvider(), classInfoFactory);
final Object object = proxyManager2.newInstanceNoConstruction(
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreationConstructed.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreationConstructed.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreationConstructed.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -65,7 +65,7 @@
.getNoProxyClassInfo(objectClass);
final ProxyManager2 proxyManager2 = new ProxyManager2(
new ClassLoaderProvider(), classInfoFactory);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
inConstruction = true;
final BobCallInConstructor object = (BobCallInConstructor) proxyManager2
.newInstanceConstruct(classInfo,
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyFieldReflect.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyFieldReflect.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyFieldReflect.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -128,7 +128,7 @@
IllegalAccessException, ObjectIOException, ClassInfoException {
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(Bob1.class);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final Bob1 proxyObject = (Bob1) proxyManager2.newInstanceConstruct(
classInfo, storageInfo, objectIOManager,
DataRecordIdentifier.LAST, true);
@@ -190,7 +190,7 @@
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(Bob1.class);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
storageInfo
.setHeaderDataSize(AbstractObjectIOManagerIOForObject.HEADER_DATA_SIZE);
objectIOManager
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPackageVisibility.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPackageVisibility.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPackageVisibility.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -58,7 +58,7 @@
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final ClassLoaderProvider classLoaderProvider = new ClassLoaderProvider();
final ProxyManager2 proxyManager2 = new ProxyManager2(
classLoaderProvider, classInfoFactory);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPrivate.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPrivate.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptPrivate.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -65,7 +65,7 @@
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final ClassLoaderProvider classLoaderProvider = new ClassLoaderProvider();
final ProxyManager2 proxyManager2 = new ProxyManager2(
classLoaderProvider, classInfoFactory);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptProtected.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptProtected.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyInterceptProtected.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -58,7 +58,7 @@
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final ClassLoaderProvider classLoaderProvider = new ClassLoaderProvider();
final ProxyManager2 proxyManager2 = new ProxyManager2(
classLoaderProvider, classInfoFactory);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyManager2.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyManager2.java 2011-10-21 03:10:06 UTC (rev 2934)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyManager2.java 2011-10-22 03:38:16 UTC (rev 2935)
@@ -59,7 +59,7 @@
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final ClassLoaderProvider classLoaderProvider = new ClassLoaderProvider();
final ProxyManager2 proxyManager2 = new ProxyManager2(
classLoaderProvider, classInfoFactory);
@@ -93,7 +93,7 @@
final ClassInfo classInfo = classInfoFactory
.getNoProxyClassInfo(objectClass);
setted = false;
- final StorageInfo storageInfo = new StorageInfo(0);
+ final StorageInfo storageInfo = new StorageInfo();
final ClassLoaderProvider classLoaderProvider = new ClassLoaderProvider();
final ProxyManager2 proxyManager2 = new ProxyManager2(
classLoaderProvider, classInfoFactory);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-23 11:38:02
|
Revision: 2936
http://joafip.svn.sourceforge.net/joafip/?rev=2936&view=rev
Author: luc_peuvrier
Date: 2011-10-23 11:37:55 +0000 (Sun, 23 Oct 2011)
Log Message:
-----------
auto save now ok
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/EnhanceCodeGenerator.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/DetachedProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackProxyDelegation.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackToImplement.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/NullProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/StaticProxyCallBack.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestTreeListIteratorIntercept.java
trunk/joafip/src/test/java/net/sf/joafip/service/sync/TestSynchronizedCollection.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/AbstractObjectIoManagerForProxyTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/ProxyCallBackForTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreation.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-23 11:38:03
|
Revision: 2936
http://joafip.svn.sourceforge.net/joafip/?rev=2936&view=rev
Author: luc_peuvrier
Date: 2011-10-23 11:37:55 +0000 (Sun, 23 Oct 2011)
Log Message:
-----------
auto save now ok
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/EnhanceCodeGenerator.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/DetachedProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackProxyDelegation.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackToImplement.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/NullProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/StaticProxyCallBack.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestTreeListIteratorIntercept.java
trunk/joafip/src/test/java/net/sf/joafip/service/sync/TestSynchronizedCollection.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/copier/AbstractTestDeepCopier.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/AbstractObjectIoManagerForProxyTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/ProxyCallBackForTest.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/proxy/TestProxyCreation.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/IFilePersistence.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -1195,12 +1195,22 @@
void keptInMemory(final String key, final Object object)
throws FilePersistenceException;
- // FIXMELUC _______________javadoc
+ /**
+ * instance referenced by static field of class are kept in memory
+ *
+ * @param classHavingStaticFieldReferenced
+ * @throws FilePersistenceException
+ */
void referencedByPesistedStaticField(
Class<?> classHavingStaticFieldReferenced)
throws FilePersistenceException;
- // FIXMELUC _______________javadoc
+ /**
+ * instance referenced by static field of classes are kept in memory
+ *
+ * @param classHavingStaticFieldReferenced
+ * @throws FilePersistenceException
+ */
void referencedByPesistedStaticField(
Class<?>[] classHavingStaticFieldReferenced)
throws FilePersistenceException;
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -1024,23 +1024,18 @@
ObjectIOClassNotFoundException, ObjectIOInvalidClassException,
ObjectIODataCorruptedException, ObjectIONotSerializableException {
- try {
- proxyManager2.setCreateEntryinObjectMap(false);
- final Map<EnumKey, Enum<?>> storeRootEnumMap = getStoredEnumMap();
- if (storeRootEnumMap != null) {
- final Collection<Enum<?>> values = storeRootEnumMap.values();
- final Iterator<Enum<?>> iterator = values.iterator();
- while (iterator.hasNext()) {
- final Enum<?> enumValue = iterator.next();
- /* just to force state setting of persisted value */
- if (enumValue != null) {
- // not null, not a no more existing enum
- objectIOManager.reInitializeEnum(enumValue);
- }
+ final Map<EnumKey, Enum<?>> storeRootEnumMap = getStoredEnumMap();
+ if (storeRootEnumMap != null) {
+ final Collection<Enum<?>> values = storeRootEnumMap.values();
+ final Iterator<Enum<?>> iterator = values.iterator();
+ while (iterator.hasNext()) {
+ final Enum<?> enumValue = iterator.next();
+ /* just to force state setting of persisted value */
+ if (enumValue != null) {
+ // not null, not a no more existing enum
+ objectIOManager.reInitializeEnum(enumValue);
}
}
- } finally {
- proxyManager2.setCreateEntryinObjectMap(true);
}
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/EnhanceCodeGenerator.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/EnhanceCodeGenerator.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/bytecode/proxy/EnhanceCodeGenerator.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -40,7 +40,7 @@
import net.sf.joafip.store.service.proxy.IProxyCallBackProxyDelegation;
import net.sf.joafip.store.service.proxy.IProxyCallBackToImplement;
import net.sf.joafip.store.service.proxy.IProxyInternal;
-import net.sf.joafip.store.service.proxy.NullProxyCallBack;
+import net.sf.joafip.store.service.proxy.ProxyCallBack;
/**
* generate enhancement byte code
@@ -85,11 +85,6 @@
private String forceLoadMethodDesc;
- private static final String SET_IN_CONSTRUCTION_METHOD_NAME =
- /**/"setInConstruction$JOAFIP$";
-
- private String setInConstructionMethodDesc;
-
private static final String[] FORCE_LOAD_EXCEPTION = new String[] {
/**/Type.getInternalName(ObjectIOException.class),
/**/Type.getInternalName(ObjectIODataRecordNotFoundException.class),
@@ -117,6 +112,11 @@
private String methodEndMethodDesc;
+ private static final String CONSTRUCTOR_END_METHOD_NAME =
+ /**/"constructorEnd$JOAFIP$";
+
+ private String constructorEndMethodDesc;
+
private static final String SET_PROXY_CALL_BACK_METHOD_NAME =
/**/"setProxyCallBack$JOAFIP$";
@@ -146,6 +146,11 @@
private static final String I_PROXY_CALL_BACK_DELEGATION_DESC =
/**/Type.getDescriptor(IProxyCallBackProxyDelegation.class);
+ private static final String PROXY_CALL_BACK =
+ /**/Type.getInternalName(ProxyCallBack.class);
+
+ private String proxyCallBackConstructorDesc;
+
private final static String[] INTERFACES = new String[] {
/**/Type.getInternalName(IProxyCallBack.class) };
@@ -156,12 +161,6 @@
private final static EnhanceCodeGenerator INSTANCE =
/**/new EnhanceCodeGenerator();
- private static final String NULL_PROXY_CALL_BACK_INTERNAL_NAME =
- /**/Type.getInternalName(NullProxyCallBack.class);
-
- private static final String NULL_PROXY_CALL_BACK_INTERNAL_DESC =
- /**/Type.getDescriptor(NullProxyCallBack.class);
-
public static EnhanceCodeGenerator getInstance() {
return INSTANCE;
}
@@ -194,11 +193,6 @@
forceLoadMethodDesc = Type.getMethodDescriptor(method);
method = IProxyCallBack.class.getMethod(
- /**/SET_IN_CONSTRUCTION_METHOD_NAME,
- /**/new Class[] { boolean.class });
- setInConstructionMethodDesc = Type.getMethodDescriptor(method);
-
- method = IProxyCallBack.class.getMethod(
/**/UNLOAD_METHOD_NAME,
/**/NO_PARAMETERS);
unloadMethodDesc = Type.getMethodDescriptor(method);
@@ -214,6 +208,11 @@
methodEndMethodDesc = Type.getMethodDescriptor(method);
method = IProxyCallBack.class.getMethod(
+ /**/CONSTRUCTOR_END_METHOD_NAME,
+ /**/NO_PARAMETERS);
+ constructorEndMethodDesc = Type.getMethodDescriptor(method);
+
+ method = IProxyCallBack.class.getMethod(
/**/IS_LOADED_METHOD_NAME,
/**/NO_PARAMETERS);
isLoadedMethodDesc = Type.getMethodDescriptor(method);
@@ -244,6 +243,11 @@
/**/NO_PARAMETERS);
getInstanceMethodDesc = Type.getMethodDescriptor(method);
+ final Constructor<ProxyCallBack> constructor = ProxyCallBack.class
+ .getConstructor(NO_PARAMETERS);
+ proxyCallBackConstructorDesc = Type
+ .getConstructorDescriptor(constructor);
+
initialized = true;
} catch (Exception exception) {
@@ -336,12 +340,13 @@
methodVisitor.visitCode();
methodVisitor.visitVarInsn(ALOAD, 0);
+
+ methodVisitor.visitTypeInsn(NEW, PROXY_CALL_BACK);
+ methodVisitor.visitInsn(DUP);
+ methodVisitor.visitMethodInsn(INVOKESPECIAL, PROXY_CALL_BACK,
+ INIT_METHOD_NAME, proxyCallBackConstructorDesc);
+
methodVisitor.visitFieldInsn(
- /**/GETSTATIC,
- /**/NULL_PROXY_CALL_BACK_INTERNAL_NAME,
- /**/"INSTANCE",
- /**/NULL_PROXY_CALL_BACK_INTERNAL_DESC);
- methodVisitor.visitFieldInsn(
/**/PUTFIELD,/* opcode */
/**/classInternalName,/* owner */
/**/PROXY_CALL_BACK_FIELD_NAME,/* name */
@@ -364,6 +369,13 @@
/**/INIT_METHOD_NAME,
/**/desc);
+ methodVisitor.visitVarInsn(ALOAD, 0);
+ methodVisitor.visitMethodInsn(
+ /**/INVOKEVIRTUAL,
+ /**/classInternalName,
+ /**/CONSTRUCTOR_END_METHOD_NAME,
+ /**/constructorEndMethodDesc);
+
methodVisitor.visitInsn(RETURN);
// FIXMELUC _visitmaxs call needed ?
@@ -466,44 +478,44 @@
methodVisitor.visitEnd();
/*
- * setInConstruction
+ * unload
*/
-
methodVisitor = classWriter.visitMethod(
/**/ACC_PUBLIC,
- /**/SET_IN_CONSTRUCTION_METHOD_NAME,
- /**/setInConstructionMethodDesc,
+ /**/UNLOAD_METHOD_NAME,
+ /**/unloadMethodDesc,
/**/null,
- /**/null);
+ /**/UNLOAD_EXCEPTION);
+
methodVisitor.visitCode();
+
methodVisitor.visitVarInsn(ALOAD, 0);
methodVisitor.visitFieldInsn(
/**/GETFIELD,
/**/classInternalName,
- /**/PROXY_CALL_BACK_FIELD_NAME, I_PROXY_CALL_BACK_DELEGATION_DESC);
- methodVisitor.visitVarInsn(ILOAD, 1);
+ /**/PROXY_CALL_BACK_FIELD_NAME,
+ /**/I_PROXY_CALL_BACK_DELEGATION_DESC);
methodVisitor.visitMethodInsn(
/**/INVOKEINTERFACE,
/**/I_PROXY_CALL_BACK_INTERFACE,
- /**/SET_IN_CONSTRUCTION_METHOD_NAME,
- /**/setInConstructionMethodDesc);
+ /**/UNLOAD_METHOD_NAME,
+ /**/unloadMethodDesc);
methodVisitor.visitInsn(RETURN);
+
// FIXMELUC _visitmaxs call needed ?
methodVisitor.visitMaxs(0, 0);
methodVisitor.visitEnd();
/*
- * unload
+ * intercept
*/
methodVisitor = classWriter.visitMethod(
/**/ACC_PUBLIC,
- /**/UNLOAD_METHOD_NAME,
- /**/unloadMethodDesc,
+ /**/INTERCEPT_METHOD_NAME,
+ /**/interceptMethodDesc,
/**/null,
- /**/UNLOAD_EXCEPTION);
-
+ /**/null);
methodVisitor.visitCode();
-
methodVisitor.visitVarInsn(ALOAD, 0);
methodVisitor.visitFieldInsn(
/**/GETFIELD,
@@ -513,21 +525,21 @@
methodVisitor.visitMethodInsn(
/**/INVOKEINTERFACE,
/**/I_PROXY_CALL_BACK_INTERFACE,
- /**/UNLOAD_METHOD_NAME,
- /**/unloadMethodDesc);
+ /**/INTERCEPT_METHOD_NAME,
+ /**/interceptMethodDesc);
methodVisitor.visitInsn(RETURN);
-
// FIXMELUC _visitmaxs call needed ?
methodVisitor.visitMaxs(0, 0);
methodVisitor.visitEnd();
/*
- * intercept
+ * constructor end
*/
+
methodVisitor = classWriter.visitMethod(
/**/ACC_PUBLIC,
- /**/INTERCEPT_METHOD_NAME,
- /**/interceptMethodDesc,
+ /**/CONSTRUCTOR_END_METHOD_NAME,
+ /**/constructorEndMethodDesc,
/**/null,
/**/null);
methodVisitor.visitCode();
@@ -540,8 +552,8 @@
methodVisitor.visitMethodInsn(
/**/INVOKEINTERFACE,
/**/I_PROXY_CALL_BACK_INTERFACE,
- /**/INTERCEPT_METHOD_NAME,
- /**/interceptMethodDesc);
+ /**/CONSTRUCTOR_END_METHOD_NAME,
+ /**/constructorEndMethodDesc);
methodVisitor.visitInsn(RETURN);
// FIXMELUC _visitmaxs call needed ?
methodVisitor.visitMaxs(0, 0);
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -47,6 +47,9 @@
private final ObjectStateMgr objectStateMgr = new ObjectStateMgr();
+ /** true if exclusive data access session */
+ private boolean exclusiveAccessSession;
+
public AbstractObjectIOManagerDelegatingToStateMap(
final int currentDataModelIdentifier,
final IClassNameManager classNameManager, final boolean proxyMode,
@@ -81,10 +84,11 @@
IProxyCallBackToImplement proxyCallBack;
try {
proxyCallBack = new ProxyCallBack(this);
+ ProxyManager2.setProxyCallBack(objectAndPersistInfo,
+ proxyCallBack, exclusiveAccessSession);
} catch (ProxyException exception) {
throw new ObjectIOException(exception);
}
- ProxyManager2.setProxyCallBack(objectAndPersistInfo, proxyCallBack);
} else {
assert !ProxyManager2.isProxyOrEnhanced(object);
}
@@ -188,8 +192,14 @@
protected void setExclusiveAccessSessionDelegate(
final boolean exclusiveAccessSession) {
objectStateMgr.setExclusiveAccessSession(exclusiveAccessSession);
+ this.exclusiveAccessSession = exclusiveAccessSession;
}
+ @Override
+ public boolean isExclusiveAccessSession() {
+ return exclusiveAccessSession;
+ }
+
protected void setMaintainedInMemoryQuotaDelegate(
final int maintainedInMemoryQuota) {
objectStateMgr.setMaintainedInMemoryQuota(maintainedInMemoryQuota);
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -120,9 +120,6 @@
/** file output stream to write change */
private FileOutputStream changeFileOutputStream;
- /** true if exclusive data access session */
- private boolean exclusiveAccessSession;
-
/** true if proxy notify object access */
// FIXMELUC ___no more needed ?
private boolean maintainInMemoryEnabled;// NOPMD
@@ -604,7 +601,6 @@
}
public void setExclusiveAccessSession(final boolean exclusiveAccessSession) {
- this.exclusiveAccessSession = exclusiveAccessSession;
super.setExclusiveAccessSessionDelegate(exclusiveAccessSession);
}
@@ -621,11 +617,6 @@
}
@Override
- public boolean isExclusiveAccessSession() {
- return exclusiveAccessSession;
- }
-
- @Override
public boolean isMaintainInMemoryEnabled() {
return maintainInMemoryEnabled;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/DetachedProxyCallBack.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/DetachedProxyCallBack.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/DetachedProxyCallBack.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -66,6 +66,12 @@
@SuppressWarnings("PMD")
@Override
+ public void constructorEnd$JOAFIP$() {
+ // no implementation
+ }
+
+ @SuppressWarnings("PMD")
+ @Override
public void methodEnd$JOAFIP$() {
// no implementation
}
@@ -121,10 +127,4 @@
public IObjectIOManagerForProxyObjectIO getObjectIOManager$JOAFIP$() {
throw new UnsupportedOperationException();
}
-
- @SuppressWarnings("PMD")
- @Override
- public void setInConstruction$JOAFIP$(final boolean inConstruction) {
- throw new UnsupportedOperationException();
- }
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackProxyDelegation.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackProxyDelegation.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackProxyDelegation.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -46,6 +46,12 @@
void intercept$JOAFIP$();
/**
+ * constructor execution end
+ */
+ @SuppressWarnings("PMD")
+ void constructorEnd$JOAFIP$();
+
+ /**
* method execution end
*/
@SuppressWarnings("PMD")
@@ -110,7 +116,4 @@
@SuppressWarnings("PMD")
ObjectAndPersistInfo getInstance$JOAFIP$();
-
- @SuppressWarnings("PMD")
- void setInConstruction$JOAFIP$(boolean inConstruction);
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackToImplement.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackToImplement.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/IProxyCallBackToImplement.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -51,8 +51,8 @@
IObjectIOManagerForProxyObjectIO objectIOManager)
throws ProxyException;
- @Fortest
@SuppressWarnings("PMD")
+ @Override
IObjectIOManagerForProxyObjectIO getObjectIOManager$JOAFIP$();
// @Fortest
@@ -69,4 +69,8 @@
@SuppressWarnings("PMD")
boolean isAutoSaveEnabled$JOAFIP$();
+
+ @SuppressWarnings("PMD")
+ void initialize$JOAFIP$(IProxyCallBackToImplement proxyCallBack)
+ throws ProxyException;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/NullProxyCallBack.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/NullProxyCallBack.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/NullProxyCallBack.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -48,6 +48,13 @@
}
@Override
+ @SuppressWarnings("PMD")
+ public void initialize$JOAFIP$(IProxyCallBackToImplement proxyCallBack)
+ throws ProxyException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public void initializeFileAccessSessionIdentifier(
final IObjectIOManagerForProxyObjectIO objectIOManager) {
throw new UnsupportedOperationException();
@@ -63,7 +70,13 @@
// do nothing
}
+ @SuppressWarnings("PMD")
@Override
+ public void constructorEnd$JOAFIP$() {
+ // no implementation
+ }
+
+ @Override
@SuppressWarnings("PMD")
public void methodEnd$JOAFIP$() {
// FIXMELUC ___call when proxied construct, construct not need
@@ -185,10 +198,4 @@
public boolean isAutoSaveEnabled$JOAFIP$() {
throw new UnsupportedOperationException();
}
-
- @Override
- @SuppressWarnings("PMD")
- public void setInConstruction$JOAFIP$(final boolean inConstruction) {
- throw new UnsupportedOperationException();
- }
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -49,8 +49,14 @@
private static boolean useJavaAgent;
/** mutex for storage file access */
- private final JoafipMutex storeMutex;
+ private/* final */JoafipMutex storeMutex;
+ private/* final */IObjectIOManagerForProxyObjectIO objectIOManager;
+
+ private/* final */boolean exclusiveAccessSession;
+
+ private/* final */boolean autoSaveEnabled;
+
/** true if object loaded */
private boolean loaded = false;
@@ -61,8 +67,6 @@
private boolean toUnload;
- private final IObjectIOManagerForProxyObjectIO objectIOManager;
-
/**
* the proxy instance and persistence information for which is this proxy
* callback
@@ -81,20 +85,24 @@
*/
private long myFileAccessSessionIdentifier;
- private final boolean exclusiveAccessSession;
-
/** count number of entry in object code */
private int inObjectCount;
- private final boolean autoSaveEnabled;
-
- private boolean inConstruction;
-
public static void setUseJavaAgent(final boolean useJavaAgent) {
ProxyCallBack.useJavaAgent = useJavaAgent;
}
/**
+ *
+ */
+ public ProxyCallBack() {
+ super();
+ inObjectCount = 1;
+ storeMutex = new JoafipMutex();
+ exclusiveAccessSession = true;
+ }
+
+ /**
* at construction set the proxied object class, the object input/output
* manager for state reading from file, and get the mutex for file access
*
@@ -107,8 +115,19 @@
this.objectIOManager = objectIOManager;
autoSaveEnabled = objectIOManager.isAutoSaveEnabled();
storeMutex = objectIOManager.getStoreMutex();
+ exclusiveAccessSession = objectIOManager.isExclusiveAccessSession();
initializeFileAccessSessionIdentifier(objectIOManager);
+ }
+
+ @SuppressWarnings("PMD")
+ @Override
+ public void initialize$JOAFIP$(final IProxyCallBackToImplement proxyCallBack)
+ throws ProxyException {
+ this.objectIOManager = proxyCallBack.getObjectIOManager$JOAFIP$();
+ autoSaveEnabled = objectIOManager.isAutoSaveEnabled();
+ storeMutex = objectIOManager.getStoreMutex();
exclusiveAccessSession = objectIOManager.isExclusiveAccessSession();
+ initializeFileAccessSessionIdentifier(objectIOManager);
}
@SuppressWarnings("PMD")
@@ -175,17 +194,6 @@
return result;
}
- // FIXMELUC _________________________for test
- // private boolean in() {
- // final StackTraceElement[] stackTraceElements = new Exception()
- // .getStackTrace();
- // final StackTraceElement stackTraceElement = stackTraceElements[3];
- // final String className = stackTraceElement.getClassName();
- // final String methodName = stackTraceElement.getMethodName();
- // return className.contains("MultiMap")
- // && methodName.contains("addKeyDefinition");
- // }
-
@Override
@SuppressWarnings("PMD")
public void intercept$JOAFIP$() {
@@ -193,98 +201,99 @@
if (exclusiveAccessSession) {
inObjectCount++;
}
- // FIXMELUC _________________________for test
- // if (in()) {
- // System.out.println("intercept " + inObjectCount + " "
- // + proxyObjectAndPersistInfo);
- // }
- // end for test
- if (exclusiveAccessSession) {
- try {
- objectIOManager.objectIsAccessed(getInstance$JOAFIP$());
- } catch (Exception exception) {
- LOGGER.error("method begin interception error", exception);
- throw new ProxyInterceptException(getInstance$JOAFIP$()
- .toString(), exception);
+ if (!exclusiveAccessSession || inObjectCount == 1) {
+ if (exclusiveAccessSession) {
+ try {
+ objectIOManager.objectIsAccessed(getInstance$JOAFIP$());
+ } catch (Exception exception) {
+ LOGGER.error("method begin interception error",
+ exception);
+ throw new ProxyInterceptException(getInstance$JOAFIP$()
+ .toString(), exception);
+ }
}
- }
- /*
- * No loading operation twice. A nested call can happen when
- * invoking serialization method while loading
- */
- if (!loading) {
- loading = true;
-
/*
- * do not force load if finalizer thread
+ * No loading operation twice. A nested call can happen when
+ * invoking serialization method while loading
*/
- if (autoSaveEnabled && inObjectCount == 1) {
- wasLoaded = loaded;
- }
+ if (!loading) {
+ loading = true;
- if (!loaded
- && !inConstruction
- && !FINALIZER_THREAD_NAME.equals(Thread.currentThread()
- .getName())) {
+ if (autoSaveEnabled) {
+ wasLoaded = loaded;
+ }
+
/*
- * since object can be manipulated outside store method call
- * by another thread, need to be synchronized
+ * do not force load if finalizer thread
*/
- /* must be loaded before invoke method */
- try {
- load();
- } catch (Exception exception) {
- LOGGER.error("method begin interception error",
- exception);
- throw new ProxyInterceptException(getInstance$JOAFIP$()
- .toString(), exception);
+ if (!loaded
+ && !FINALIZER_THREAD_NAME.equals(Thread
+ .currentThread().getName())) {
+ /*
+ * since object can be manipulated outside store method
+ * call by another thread, need to be synchronized
+ */
+ /* must be loaded before invoke method */
+ try {
+ load();
+ } catch (Exception exception) {
+ LOGGER.error("method begin interception error",
+ exception);
+ final ObjectAndPersistInfo instance = getInstance$JOAFIP$();
+ final String instanceToString = instance == null ? "no instance"
+ : instance.toString();
+ throw new ProxyInterceptException(instanceToString,
+ exception);
+ }
}
+ loading = false;
}
-
- loading = false;
}
}
}
+ @SuppressWarnings("PMD")
@Override
+ public void constructorEnd$JOAFIP$() {
+ inObjectCount--;
+ assert inObjectCount >= 0 : "running in object count can not be negative, is "
+ + inObjectCount;
+ }
+
+ @Override
@SuppressWarnings("PMD")
public void methodEnd$JOAFIP$() {
- // FIXMELUC _________________________for test
- // if (in()) {
- // System.out.println("methodEnd " + inObjectCount + " "
- // + proxyObjectAndPersistInfo);
- // }
- // end for test
synchronized (storeMutex) {
final ObjectAndPersistInfo instanceAndPersistInfo = getInstance$JOAFIP$();
- if (--inObjectCount == 0) {
+ inObjectCount--;
+ // ASSERTX
+ assert inObjectCount >= 0 : "running in object count can not be negative, is "
+ + inObjectCount + " " + getInstance$JOAFIP$().toString();
+ if (inObjectCount == 0) {
instanceAndPersistInfo.acceded = false;
- }
- if (autoSaveEnabled) {
- // ASSERTX
- assert inObjectCount >= 0 : "running in object count can not be negative, is "
- + inObjectCount
- + " "
- + getInstance$JOAFIP$().toString();
- if (!wasLoaded && loaded && inObjectCount == 0) {
- try {
- objectIOManager.newObjectLoaded();
- } catch (ObjectIOException exception) {
- throw new ProxyInterceptException(exception);
+ if (autoSaveEnabled) {
+ if (!wasLoaded && loaded) {
+ try {
+ objectIOManager.newObjectLoaded();
+ } catch (ObjectIOException exception) {
+ throw new ProxyInterceptException(exception);
+ }
}
- }
- if (toUnload && inObjectCount == 0) {
- toUnload = false;
- loaded = false;
- assert instanceAndPersistInfo != null;
- try {
- objectIOManager
- .saveAndUnsetProxyObjectState(instanceAndPersistInfo);
- } catch (Exception exception) {
- LOGGER.error("method end interception error", exception);
- throw new ProxyInterceptException(
- instanceAndPersistInfo.toString(), exception);
+ if (toUnload) {
+ toUnload = false;
+ loaded = false;
+ assert instanceAndPersistInfo != null;
+ try {
+ objectIOManager
+ .saveAndUnsetProxyObjectState(instanceAndPersistInfo);
+ } catch (Exception exception) {
+ LOGGER.error("method end interception error",
+ exception);
+ throw new ProxyInterceptException(
+ instanceAndPersistInfo.toString(),
+ exception);
+ }
}
}
}
@@ -307,7 +316,7 @@
ObjectIOClassNotFoundException, ObjectIODataCorruptedException,
ObjectIONotSerializableException {
synchronized (storeMutex) {
- if (!loading && !inConstruction) {
+ if (!loading) {
loading = true;
if (!loaded) {
load();
@@ -326,8 +335,8 @@
/*
* inObjectCount==0 because can not unload object when running its code
*/
- if (loaded && !inConstruction) {
- if (!loading && inObjectCount == 0) {
+ if (loaded) {
+ if (!loading && (!exclusiveAccessSession || inObjectCount == 0)) {
loaded = false;
objectIOManager.unsetProxyObjectState(getInstance$JOAFIP$());
} else {
@@ -407,12 +416,6 @@
@Override
@SuppressWarnings("PMD")
- public void setInConstruction$JOAFIP$(final boolean inConstruction) {
- this.inConstruction = inConstruction;
- }
-
- @Override
- @SuppressWarnings("PMD")
public boolean isAutoSaveEnabled$JOAFIP$() {
return autoSaveEnabled;
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-22 03:38:16 UTC (rev 2935)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-23 11:37:55 UTC (rev 2936)
@@ -65,8 +65,6 @@
private int persistenceId;
- private boolean createEntryinObjectMap = true;
-
/**
*
* @param classLoaderProvider
@@ -158,11 +156,9 @@
objectIOManager.isExclusiveAccessSession());
instanceCreated = reflectNewInstanceDefaultConstructor(enhancedClass);
}
- if (createEntryinObjectMap) {
- objectAndPersistInfoOfCreatedInstance(objectClassInfo,
- storageInfo, objectIOManager, dataRecordIdentifier,
- persisted, instanceCreated, true);
- }
+ objectAndPersistInfoOfCreatedInstance(objectClassInfo, storageInfo,
+ objectIOManager, dataRecordIdentifier, persisted,
+ instanceCreated, true);
} catch (ReflectException exception) {
throw new ProxyException(exception);
} catch (EnhanceException exception) {
@@ -203,11 +199,9 @@
instanceCreated = reflectNewInstanceConstruct(enhancedClass,
parameterTypes, initargs);
}
- if (createEntryinObjectMap) {
- objectAndPersistInfoOfCreatedInstance(objectClassInfo,
- storageInfo, objectIOManager, dataRecordIdentifier,
- persisted, instanceCreated, true);
- }
+ objectAndPersistInfoOfCreatedInstance(objectClassInfo, storageInfo,
+ objectIOManager, dataRecordIdentifier, persisted,
+ instanceCreated, true);
} catch (ReflectException exception) {
throw new ProxyException(exception);
} catch (EnhanceException exception) {
@@ -228,10 +222,6 @@
initargs);
}
- public void setCreateEntryinObjectMap(final boolean createEntryinObjectMap) {
- this.createEntryinObjectMap = createEntryinObjectMap;
- }
-
private ObjectAndPersistInfo objectAn...
[truncated message content] |
|
From: <luc...@us...> - 2011-10-27 01:46:09
|
Revision: 2941
http://joafip.svn.sourceforge.net/joafip/?rev=2941&view=rev
Author: luc_peuvrier
Date: 2011-10-27 01:46:02 +0000 (Thu, 27 Oct 2011)
Log Message:
-----------
test added for auto save
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/service/AbstractDataAccessSession.java
trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
trunk/joafip/src/main/java/net/sf/joafip/service/ExclusiveDataAccessSession.java
trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/service/IDataAccessSessionCommon.java
trunk/joafip/src/main/java/net/sf/joafip/service/IExclusiveDataAccessSession.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobASDelegatingListenDelegate.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobAsDelegateNotifyDelegating.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSave.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-27 01:46:09
|
Revision: 2941
http://joafip.svn.sourceforge.net/joafip/?rev=2941&view=rev
Author: luc_peuvrier
Date: 2011-10-27 01:46:02 +0000 (Thu, 27 Oct 2011)
Log Message:
-----------
test added for auto save
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/service/AbstractDataAccessSession.java
trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
trunk/joafip/src/main/java/net/sf/joafip/service/ExclusiveDataAccessSession.java
trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/service/IDataAccessSessionCommon.java
trunk/joafip/src/main/java/net/sf/joafip/service/IExclusiveDataAccessSession.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobASDelegatingListenDelegate.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobAsDelegateNotifyDelegating.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSave.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/AbstractDataAccessSession.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractDataAccessSession.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/AbstractDataAccessSession.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -184,6 +184,22 @@
}
@Override
+ public Object getObject(final long dataRecordIdentifier)
+ throws FilePersistenceException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceNotSerializableException {
+ final Object object;
+ synchronized (mutex) {
+ assertPersistenceOpenned();
+ assertOpened();
+ object = filePersistence.getObject(dataRecordIdentifier);
+ }
+ return object;
+ }
+
+ @Override
@Deprecated
public void setEnumState(final Enum<?> enumObject)
throws FilePersistenceException {
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/AbstractFilePersistenceDelegatingToStore.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -1300,7 +1300,6 @@
}
}
- @Fortest
public Object createObjectReadingInStoreOrGetExisting(
final DataRecordIdentifier dataRecordIdentifier)
throws FilePersistenceException,
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/ExclusiveDataAccessSession.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/ExclusiveDataAccessSession.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/ExclusiveDataAccessSession.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -24,6 +24,7 @@
import net.sf.joafip.NoStorableAccess;
import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.entity.EnumFilePersistenceCloseAction;
import net.sf.joafip.store.service.proxy.IInstanceFactory;
/**
@@ -88,11 +89,22 @@
FilePersistenceClassNotFoundException,
FilePersistenceDataCorruptedException,
FilePersistenceTooBigForSerializationException {
+ close(EnumFilePersistenceCloseAction.SAVE);
+ }
+
+ @Override
+ public void close(final EnumFilePersistenceCloseAction action)
+ throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceTooBigForSerializationException {
synchronized (mutex) {
try {
assertPersistenceOpenned();
assertOpened();
- filePersistence.endExclusiveUse(this);
+ filePersistence.endExclusiveUse(this, action);
} catch (final FilePersistenceException exception) {
logger.error(CLOSE_ERROR, exception);
throw exception;
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -38,6 +38,7 @@
import net.sf.joafip.entity.FilePersistencePropertyEntry;
import net.sf.joafip.file.service.FileIOException;
import net.sf.joafip.heapfile.entity.EnumFileState;
+import net.sf.joafip.heapfile.record.entity.DataRecordIdentifier;
import net.sf.joafip.heapfile.service.HeapFileState;
import net.sf.joafip.heapfile.service.IHeapDataManager;
import net.sf.joafip.java.util.PTreeMap;
@@ -1030,8 +1031,10 @@
}
}
- void endExclusiveUse(// NOPMD
- final IExclusiveDataAccessSession exclusiveDataAccessSession)
+ @SuppressWarnings("PMD")
+ void endExclusiveUse(
+ final IExclusiveDataAccessSession exclusiveDataAccessSession,
+ final EnumFilePersistenceCloseAction action)
throws FilePersistenceException,
FilePersistenceInvalidClassException,
FilePersistenceNotSerializableException,
@@ -1047,7 +1050,23 @@
throw new FilePersistenceException(
"alone data access session miss match");
}
- save(true, false);
+
+ // save(true, false);
+ switch (action) {
+ case SAVE:
+ save(true, false);
+ break;
+ case DO_NOT_SAVE:
+ doNotSave();
+ break;
+ case CLEAR:
+ clearStoreContent();
+ break;
+ default:
+ throw new FilePersistenceException("unknow action "
+ + this.action);
+ }
+
this.exclusiveDataAccessSession = null;// NOPMD
storeEndAccessSession();
} catch (final FilePersistenceException exception) {
@@ -1362,6 +1381,20 @@
}
}
+ @SuppressWarnings("PMD")
+ @StorableAccess
+ Object getObject(final long dataRecordIdentifier)
+ throws FilePersistenceException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceNotSerializableException {
+ synchronized (mutex) {
+ return createObjectReadingInStoreOrGetExisting(new DataRecordIdentifier(
+ dataRecordIdentifier));
+ }
+ }
+
/**
* add a persistent object associated to a key
*
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/IDataAccessSessionCommon.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/IDataAccessSessionCommon.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/IDataAccessSessionCommon.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -101,8 +101,15 @@
* @throws FilePersistenceException
* this data access session not opened
*/
- Object getObject(final String key) throws FilePersistenceException;
+ Object getObject(String key) throws FilePersistenceException;
+ Object getObject(long dataRecordIdentifier)
+ throws FilePersistenceException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceNotSerializableException;
+
/**
* add a persistent object associated to a key<br>
*
@@ -114,8 +121,7 @@
* @throws FilePersistenceException
* this data access session not opened
*/
- Object setObject(final String key, final Object object)
- throws FilePersistenceException;
+ Object setObject(String key, Object object) throws FilePersistenceException;
/**
* remove a persistent object associated to a key<br>
@@ -126,7 +132,7 @@
* @throws FilePersistenceException
* this data access session not opened
*/
- Object removeObject(final String key) throws FilePersistenceException;
+ Object removeObject(String key) throws FilePersistenceException;
/**
* remove all persistent object<br>
@@ -143,7 +149,7 @@
* @throws FilePersistenceException
*/
@Deprecated
- void setEnumState(final Enum<?> enumObject) throws FilePersistenceException;
+ void setEnumState(Enum<?> enumObject) throws FilePersistenceException;
/**
*
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/IExclusiveDataAccessSession.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/IExclusiveDataAccessSession.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/IExclusiveDataAccessSession.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -22,6 +22,7 @@
*/
package net.sf.joafip.service;
+import net.sf.joafip.entity.EnumFilePersistenceCloseAction;
import net.sf.joafip.store.service.proxy.IInstanceFactory;
/**
@@ -86,4 +87,12 @@
FilePersistenceDataCorruptedException,
FilePersistenceTooBigForSerializationException;
+ void close(EnumFilePersistenceCloseAction action)
+ throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceTooBigForSerializationException;
+
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -438,9 +438,9 @@
}
public boolean referenceLost() {
- return weakReference!=null && weakReference.get()==null;
+ return weakReference != null && weakReference.get() == null;
}
-
+
@Override
public Object getObject() {
final Object result;
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/IStore.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -770,8 +770,6 @@
ClassInfo getClassInfoInDataRecord(DataRecordIdentifier dataRecordIdentifier)
throws StoreException;
- @Fortest
- // FIXMELUC may be used by export
ObjectAndPersistInfo createObjectReadingInStoreOrGetExisting(
DataRecordIdentifier dataRecordIdentifier, boolean notLazy)
throws StoreException, StoreClassNotFoundException,
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/Store.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -1459,7 +1459,6 @@
return changeLogEnabled;
}
- @Fortest
@Override
public ObjectAndPersistInfo createObjectReadingInStoreOrGetExisting(
final DataRecordIdentifier dataRecordIdentifier,
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyCallBack.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -203,14 +203,7 @@
}
if (!exclusiveAccessSession || inObjectCount == 1) {
if (exclusiveAccessSession) {
- try {
- objectIOManager.objectIsAccessed(getInstance$JOAFIP$());
- } catch (Exception exception) {
- LOGGER.error("method begin interception error",
- exception);
- throw new ProxyInterceptException(getInstance$JOAFIP$()
- .toString(), exception);
- }
+ objectIsAccessed();
}
/*
@@ -253,12 +246,27 @@
}
}
+ private void objectIsAccessed() {
+ try {
+ objectIOManager.objectIsAccessed(getInstance$JOAFIP$());
+ } catch (Exception exception) {
+ LOGGER.error("method begin interception error", exception);
+ final ObjectAndPersistInfo instance = getInstance$JOAFIP$();
+ final String instanceToString = instance == null ? "no instance"
+ : instance.toString();
+ throw new ProxyInterceptException(instanceToString, exception);
+ }
+ }
+
@SuppressWarnings("PMD")
@Override
public void constructorEnd$JOAFIP$() {
inObjectCount--;
assert inObjectCount >= 0 : "running in object count can not be negative, is "
+ inObjectCount;
+ // if (objectIOManager != null) {
+ // objectIsAccessed();
+ // }
}
@Override
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -282,6 +282,7 @@
assert getProxyCallBack(instanceCreated) != NULL_PROXY_CALL_BACK_INSTANCE;
// set is loaded last for auto save
objectAndPersistInfo.setIsLoaded();
+ objectAndPersistInfo.acceded = false;
}
} else {
// FIXMELUC ___________one method for objectAndPersistInfo action
@@ -298,6 +299,7 @@
*/
// set is loaded last for auto save
setIsLoaded(instanceCreated);
+ objectAndPersistInfo.acceded = false;
}
return objectAndPersistInfo;
}
@@ -536,6 +538,7 @@
existing.initialize$JOAFIP$(proxyCallBack);
existing.setInstance$JOAFIP$(objectAndPersistInfo);
objectAndPersistInfo.setProxyCallBack(existing);
+ objectAndPersistInfo.acceded = true;
}
} else {
final IProxyCallBack proxy = (IProxyCallBack) object;
@@ -549,6 +552,7 @@
existing.initialize$JOAFIP$(proxyCallBack);
existing.setInstance$JOAFIP$(objectAndPersistInfo);
objectAndPersistInfo.setProxyCallBack(existing);
+ objectAndPersistInfo.acceded = true;
}
}
} else {
Modified: trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobASDelegatingListenDelegate.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobASDelegatingListenDelegate.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobASDelegatingListenDelegate.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -80,4 +80,8 @@
public void delegateNotification() {
// delegate notification
}
+
+ public BobAsDelegateNotifyDelegating getDelegate() {
+ return delegate;
+ }
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobAsDelegateNotifyDelegating.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobAsDelegateNotifyDelegating.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/BobAsDelegateNotifyDelegating.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -61,4 +61,8 @@
public void action() {
bobASDelegatingListenDelegate.delegateNotification();
}
+
+ public BobASDelegatingListenDelegate getBobASDelegatingListenDelegate() {
+ return bobASDelegatingListenDelegate;
+ }
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSave.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSave.java 2011-10-24 02:59:20 UTC (rev 2940)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestAutoSave.java 2011-10-27 01:46:02 UTC (rev 2941)
@@ -30,8 +30,10 @@
import net.sf.joafip.StorableAccess;
import net.sf.joafip.TestConstant;
import net.sf.joafip.TestException;
+import net.sf.joafip.entity.EnumFilePersistenceCloseAction;
import net.sf.joafip.entity.rel400.BobASDelegatingListenDelegate;
import net.sf.joafip.entity.rel400.BobASWithTransientCaller;
+import net.sf.joafip.entity.rel400.BobAsDelegateNotifyDelegating;
import net.sf.joafip.entity.rel400.BobForAutoSaveTest;
import net.sf.joafip.entity.rel400.KeyDef;
import net.sf.joafip.java.util.PTreeMap;
@@ -382,6 +384,31 @@
assertTrue("bad state saved", bob.isConstructed());
}
+ public void testSaveInConstruction5() throws FilePersistenceException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceTooBigForSerializationException, ProxyException {
+ final IInstanceFactory instanceFactory = session.getInstanceFactory();
+ assertNotNull(MUST_HAS_INSTANCE_FACTORY, instanceFactory);
+
+ session.open();
+ BobASDelegatingListenDelegate bob = BobASDelegatingListenDelegate
+ .newInstance(instanceFactory);
+ BobAsDelegateNotifyDelegating delegate = bob.getDelegate();
+ final long delegateDataRecordIdentifier = ProxyManager2
+ .getObjectAndPersistInfo(delegate).dataRecordIdentifier.value;
+ bob = null;// NOPMD unreference
+ session.close(EnumFilePersistenceCloseAction.DO_NOT_SAVE);
+
+ session.open();
+ delegate = (BobAsDelegateNotifyDelegating) session
+ .getObject(delegateDataRecordIdentifier);
+ bob = delegate.getBobASDelegatingListenDelegate();
+ assertNotNull("bob is in bad state", bob.getDelegate());
+ }
+
public void testWithTransient() throws FilePersistenceException,
FilePersistenceClassNotFoundException,
FilePersistenceInvalidClassException,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-30 03:09:17
|
Revision: 2954
http://joafip.svn.sourceforge.net/joafip/?rev=2954&view=rev
Author: luc_peuvrier
Date: 2011-10-30 03:09:09 +0000 (Sun, 30 Oct 2011)
Log Message:
-----------
fix done, code cleaner
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-30 03:09:17
|
Revision: 2954
http://joafip.svn.sourceforge.net/joafip/?rev=2954&view=rev
Author: luc_peuvrier
Date: 2011-10-30 03:09:09 +0000 (Sun, 30 Oct 2011)
Log Message:
-----------
fix done, code cleaner
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectAndPersistInfo.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -539,6 +539,9 @@
}
public void setIsLoaded() throws ObjectIOException {
+ // out of constructor, no more acceded, to do before set is
+ // loaded
+ acceded = false;
if (proxyIntanceOrEnhanced) {
/*
* set loaded state can call save and object is referenced only by
@@ -549,6 +552,13 @@
}
}
+ public void newInstanceAndCreatedBySave(final StorageInfo storageInfo)
+ throws ObjectIOException {
+ unWeakReferenceOnObject();
+ setStorageInfo(storageInfo);
+ setIsLoaded();
+ }
+
public void unloadAfterSave() throws ObjectIOException,
ObjectIOInvalidClassException {
if (proxyIntanceOrEnhanced && !acceded) {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -68,7 +68,7 @@
throw new ImportException(exportFile + " does not exists");
}
final SAXParserFactory factory = SAXParserFactory.newInstance();
- // FIXMELUC ___________why not validating
+ // FIXMELUC ____why not validating
factory.setValidating(false);
factory.setNamespaceAware(true);
final SchemaFactory schemaFactory = SchemaFactory
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/serialize/output/AbstractObjectOutput.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -443,7 +443,7 @@
final List<ReferenceChange> referenceChangeList)
throws ObjectIOException {
final boolean stateChanged;
- // FIXMELUC ___________only for exclusive das
+ // FIXMELUC ____only for exclusive das
if (originalReferenced.referenceLost()) {
stateChanged = true;
} else {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/proxy/ProxyManager2.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -280,32 +280,13 @@
if (constructed) {
assert getProxyCallBack(instanceCreated) != NULL_PROXY_CALL_BACK_INSTANCE;
- // FIXMELUC ___________unweak needed ?
assert objectAndPersistInfo.isNotWeak();
- // objectAndPersistInfo.unWeakReferenceOnObject();
- // out of constructor, no more acceded, to do before set is
- // loaded
- objectAndPersistInfo.acceded = false;
- // set is loaded is last operation for auto save
- setIsLoaded(instanceCreated);
+ objectAndPersistInfo.setIsLoaded();
}
} else {
- // FIXMELUC ___________one method for objectAndPersistInfo action
// created by save
assert constructed;
- objectAndPersistInfo.unWeakReferenceOnObject();
- objectIOManager
- .dataRecordIdentifierAssociatedToObjectSetted(objectAndPersistInfo);
- objectAndPersistInfo.setStorageInfo(storageInfo);
- /*
- * FIXMELUC __for setIsLoaded, call of
- * objectAndPersistInfo.setIsLoaded() should be good to, may be
- * better
- */
- // out of constructor, no more acceded, to do before set is loaded
- objectAndPersistInfo.acceded = false;
- // set is loaded is last operation for auto save
- setIsLoaded(instanceCreated);
+ objectAndPersistInfo.newInstanceAndCreatedBySave(storageInfo);
}
return objectAndPersistInfo;
}
@@ -383,17 +364,18 @@
return loaded;
}
- public static void setIsLoaded(final Object object) throws ProxyException {
- try {
- if (useJavaAgent) {
- StaticProxyCallBack.setIsLoaded(object);
- } else if (isProxy(object)) {
- ((IProxyCallBackProxyDelegation) object).setIsLoaded$JOAFIP$();
- }
- } catch (ObjectIOException exception) {
- throw new ProxyException(exception);
- }
- }
+ // public static void setIsLoaded(final Object object) throws ProxyException
+ // {
+ // try {
+ // if (useJavaAgent) {
+ // StaticProxyCallBack.setIsLoaded(object);
+ // } else if (isProxy(object)) {
+ // ((IProxyCallBackProxyDelegation) object).setIsLoaded$JOAFIP$();
+ // }
+ // } catch (ObjectIOException exception) {
+ // throw new ProxyException(exception);
+ // }
+ // }
public static void setIsLoadedNoSave(final Object object)
throws ProxyException {
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceSetupByProperties.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -74,6 +74,7 @@
filePersistence = new FilePersistence(
"net/sf/joafip/service/joafip_for_test.properties", true);
filePersistence.addToNotCheckMethod(Bob1.class);
+ filePersistence.addToNotCheckMethod(Bob1Substitute.class);
session = filePersistence.createDataAccessSession();
// Logger.getLogger(ProxyCallBackInterceptEnd.class).setLevel(Level.DEBUG);
// Logger.getLogger(StoreSaver3.class).setLevel(Level.DEBUG);
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java 2011-10-29 20:06:13 UTC (rev 2953)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestHugeList.java 2011-10-30 03:09:09 UTC (rev 2954)
@@ -102,10 +102,9 @@
if (logger.debugEnabled) {
logger.debug("begin set free memory");
}
- // FIXMELUC _________to reactivate win xp jvm 32 bits
// yes, only 512Ko of free memory, on Xp 32 bits jvm
MEMORY_EATER.setFreeMemory(512 * 1024);
- // FIXMELUC _________to test win 7 with 64 bits jvm
+ // FIXMELUC ____to test win 7 with 64 bits jvm
// MEMORY_EATER.setFreeMemory(4 * 1024 * 1024);
if (logger.debugEnabled) {
logger.debug("end end set free memory");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-31 03:07:18
|
Revision: 2956
http://joafip.svn.sourceforge.net/joafip/?rev=2956&view=rev
Author: luc_peuvrier
Date: 2011-10-31 03:07:11 +0000 (Mon, 31 Oct 2011)
Log Message:
-----------
fix update
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/reflect/HelperReflect.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfoForSerialization.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/conversion/ValuedFieldList.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/conversion/def/AbstractConversionDefinitionReader.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/AbstractFieldOwnerHandler.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InObjectHandler.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/service/sync/TestSynchronizedCollection.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/reflect/HelperReflect.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/reflect/HelperReflect.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/reflect/HelperReflect.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -244,7 +244,7 @@
/**
* @param object
- * @param field
+ * @param fieldInfo
* @param fieldValue
* @throws ReflectException
* @throws ReflectFailedSetException
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -821,6 +821,24 @@
return allDeclaredTransientOrNotFields; // NOPMD
}
+ public FieldInfo getFieldInfo(final String declaringClassName,
+ final String fieldName) throws ClassInfoException {
+ if (!fieldInfoInitialized) {
+ initializeFieldInfo();
+ }
+ FieldInfo fieldInfo = null;
+ final int length = allDeclaredTransientOrNotFields.length;
+ for (int index = 0; fieldInfo == null && index < length; index++) {
+ final FieldInfo candidate = allDeclaredTransientOrNotFields[index];
+ if (fieldName.equals(candidate.getFieldName())
+ && declaringClassName.equals(candidate
+ .getDeclaringClassName())) {
+ fieldInfo = candidate;
+ }
+ }
+ return fieldInfo;
+ }
+
public FieldInfo[] getSerialPersistentFieldsInfo()
throws ClassInfoException {
if (!fieldInfoInitialized) {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -77,6 +77,9 @@
private boolean persisted = true;
+ /**
+ * null field information
+ */
private FieldInfo() {
super();
this.field = null;// NOPMD
@@ -122,6 +125,7 @@
assertNotNull = field.isAnnotationPresent(AssertNotNull.class);
}
+ // FIXMELUC ______known field: called ?
public FieldInfo(final ClassInfo declaringClass, final String fieldName,
final ClassInfo fieldType, final Boolean staticField,
final Boolean transientField) throws ClassInfoException {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfoForSerialization.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfoForSerialization.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfoForSerialization.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -51,6 +51,7 @@
final String fieldName, final ClassInfo fieldType,
final Boolean staticField, final Boolean transientField)
throws ClassInfoException {
+ // FIXMELUC ______known field
super(declaringClass, fieldName, fieldType, staticField, transientField);
unshared = false;
securityException = null;
@@ -61,6 +62,7 @@
final String fieldName, final ClassInfo fieldType,
final NoSuchFieldException noSuchFieldException)
throws ClassInfoException {
+ // FIXMELUC ______known field
super(declaringClass, fieldName, fieldType, null, null);
unshared = false;
this.noSuchFieldException = noSuchFieldException;
@@ -71,6 +73,7 @@
final String fieldName, final ClassInfo fieldType,
final SecurityException securityException)
throws ClassInfoException {
+ // FIXMELUC ______known field
super(declaringClass, fieldName, fieldType, null, null);
unshared = false;
this.securityException = securityException;
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/conversion/ValuedFieldList.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/conversion/ValuedFieldList.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/conversion/ValuedFieldList.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -101,6 +101,7 @@
// ASSERTX
assert fieldValue != null : "field value must be set";
try {
+ // FIXMELUC ______known field
final FieldInfo fieldInfo = new FieldInfo(declaringClass,
fieldName, fieldType, Boolean.valueOf(staticField),
Boolean.valueOf(transientField));
@@ -164,6 +165,7 @@
final boolean transientField, final int index)
throws ConversionException {
try {
+ // FIXMELUC ______known field
final FieldInfo fieldInfo = new FieldInfo(declaringClass,
fieldName, fieldType, Boolean.valueOf(staticField),
Boolean.valueOf(transientField));
@@ -205,6 +207,7 @@
final ClassInfo fieldType, final boolean staticField,
final boolean transientField) throws ConversionException {
try {
+ // FIXMELUC ______known field
final FieldInfo originalFieldInfo = new FieldInfo(
originalDeclaringClass, originalFieldName,
originalFieldType, null, null);
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -582,7 +582,7 @@
private void removeWeaked(final ObjectAndPersistInfo toRemove) {
stateMap.remove(toRemove);
stateMapByIdentifier.remove(toRemove.dataRecordIdentifier);
- // FIXMELUC ___assert failure, why ?
+ // FIXMELUC ?___assert failure, why ?
// assert x == toRemove : x + "\n" + toRemove;
toRemove.clearSubstitution();
removeFromQueue(toRemove);
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -201,6 +201,19 @@
}
@Override
+ public ClassInfo getClassInfo(final Class<?> clazz)
+ throws ClassInfoException {
+ final String className = clazz.getName();
+ assert className.indexOf(ClassEnhancer.JOAFIP_SUFIX) == -1;
+ ClassInfo classInfo = classInfoMap.get(className);
+ if (classInfo == null) {
+ classInfo = createClassInfoOfExistingClass(clazz, className);
+ }
+ setAttributes(classInfo, className);
+ return classInfo;
+ }
+
+ @Override
public ClassInfo getNoProxyClassInfo(final Class<?> clazz)
throws ClassInfoException {
String className = clazz.getName();
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -60,6 +60,9 @@
ClassInfo knownAsNotExisting(String className)
throws ClassNotFoundException, ClassInfoException;
+ ClassInfo getClassInfo(Class<?> clazz) throws ClassInfoException;
+
+ // FIXMELUC __(rename) call only if can be a proxy
ClassInfo getNoProxyClassInfo(Class<?> clazz) throws ClassInfoException;
Class<?> getNoProxyClass(Class<?> clazz) throws ClassInfoException;
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/conversion/def/AbstractConversionDefinitionReader.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/conversion/def/AbstractConversionDefinitionReader.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/conversion/def/AbstractConversionDefinitionReader.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -180,6 +180,7 @@
final ClassInfo declaringClass = classForName(declaringClassName);
FieldInfo fieldInfo;
try {
+ // FIXMELUC ______known field
fieldInfo = new FieldInfo(declaringClass, fieldName,// NOPMD
fieldClass, staticField, transientField);
} catch (ClassInfoException exception) {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/AbstractFieldOwnerHandler.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/AbstractFieldOwnerHandler.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/AbstractFieldOwnerHandler.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -79,6 +79,7 @@
final Boolean staticField, final Boolean transientField)
throws ImportException, ImportClassNotFoundException {
try {
+ // FIXMELUC ______known field
return new FieldInfo(fieldDeclaringClass, originalFieldName,
fieldType, staticField, transientField);
} catch (ClassInfoException exception) {
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InObjectHandler.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InObjectHandler.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InObjectHandler.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -97,10 +97,14 @@
FieldInfo fieldInfo;
- fieldInfo = new FieldInfo(currentObject.getClassInfo(),
- "dataModelIdentifier",
- classInfoFactory.getNoProxyClassInfo(int.class),
- false, false);
+ final ClassInfo currentObjectClassInfo = currentObject
+ .getClassInfo();
+ fieldInfo = currentObjectClassInfo.getFieldInfo(
+ StoreRoot4.class.getName(), "dataModelIdentifier");
+ // fieldInfo = new FieldInfo(currentObjectClassInfo,
+ // "dataModelIdentifier",
+ // classInfoFactory.getClassInfo(int.class),
+ // false, false);
currentObject.setValue(
2,
fieldInfo,
@@ -109,10 +113,13 @@
classInfoFactory
.getNoProxyClassInfo(int.class)));
- fieldInfo = new FieldInfo(currentObject.getClassInfo(),
- "dataRecordIdOfpersistedStaticSet",
- classInfoFactory.getNoProxyClassInfo(Set.class),
- false, false);
+ fieldInfo = currentObjectClassInfo.getFieldInfo(
+ StoreRoot4.class.getName(),
+ "dataRecordIdOfpersistedStaticSet");
+ // fieldInfo = new FieldInfo(currentObjectClassInfo,
+ // "dataRecordIdOfpersistedStaticSet",
+ // classInfoFactory.getClassInfo(Set.class),
+ // false, false);
Set<Long> dataRecordIdOfpersistedStaticSet = storeRoot
.getDataRecordIdOfpersistedStaticSet();
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -68,7 +68,7 @@
throw new ImportException(exportFile + " does not exists");
}
final SAXParserFactory factory = SAXParserFactory.newInstance();
- // FIXMELUC ____why not validating
+ // FIXMELUC ?____why not validating ?
factory.setValidating(false);
factory.setNamespaceAware(true);
final SchemaFactory schemaFactory = SchemaFactory
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -150,7 +150,7 @@
final DataRecordIdentifier dataRecordIdentifier) {
objectStateMgr
.clearObjectAndPersistInfoByDataRecordIdentifier(dataRecordIdentifier);
- // FIXMELUC ___clear statemap ?
+ // FIXMELUC ?___clear statemap ?
}
@Override
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -121,7 +121,7 @@
private FileOutputStream changeFileOutputStream;
/** true if proxy notify object access */
- // FIXMELUC ___no more needed ?
+ // FIXMELUC ?___no more needed ?
private boolean maintainInMemoryEnabled;// NOPMD
private IFilePersistenceAutoSaver saver;
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/sync/TestSynchronizedCollection.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/sync/TestSynchronizedCollection.java 2011-10-30 03:34:28 UTC (rev 2955)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/sync/TestSynchronizedCollection.java 2011-10-31 03:07:11 UTC (rev 2956)
@@ -66,7 +66,7 @@
FilePersistenceDataCorruptedException,
FilePersistenceNotSerializableException,
FilePersistenceTooBigForSerializationException {
- // FIXMELUC ______known problem to solve
+ // FIXMELUC __known problem to solve
if (buildMode) {
warnSkipped();
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-10-31 03:07:18
|
Revision: 2956
http://joafip.svn.sourceforge.net/joafip/?rev=2956&view=rev
Author: luc_peuvrier
Date: 2011-10-31 03:07:11 +0000 (Mon, 31 Oct 2011)
Log Message:
-----------
fix update
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/reflect/HelperReflect.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/ClassInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfo.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/classinfo/FieldInfoForSerialization.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/conversion/ValuedFieldList.java
trunk/joafip/src/main/java/net/sf/joafip/store/entity/objectio/ObjectStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/ClassInfoFactory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/classinfo/IClassInfoFactory.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/conversion/def/AbstractConversionDefinitionReader.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/AbstractFieldOwnerHandler.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/InObjectHandler.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/in/XmlImporter.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerDelegatingToStateMap.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/service/sync/TestSynchronizedCollection.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-11-12 16:58:29
|
Revision: 2968
http://joafip.svn.sourceforge.net/joafip/?rev=2968&view=rev
Author: luc_peuvrier
Date: 2011-11-12 16:58:23 +0000 (Sat, 12 Nov 2011)
Log Message:
-----------
added tests. added fix. correction
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java
trunk/joafip/src/test/resources/log4j.properties
Added Paths:
-----------
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/que/
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/EnumItemState.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java 2011-11-12 16:56:52 UTC (rev 2967)
+++ trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java 2011-11-12 16:58:23 UTC (rev 2968)
@@ -59,7 +59,6 @@
import net.sf.joafip.store.service.objectio.manager.ISubsituteSynchronizer;
import net.sf.joafip.store.service.objectio.serialize.input.IObjectInput;
import net.sf.joafip.store.service.objectio.serialize.output.IObjectOutput;
-import net.sf.joafip.store.service.proxy.ProxyManager2;
/**
*
@@ -1291,7 +1290,6 @@
}
private void storedEnumMapPutAll(final Map<EnumKey, Enum<?>> map) {
- assert !ProxyManager2.isProxyOrEnhanced(map);
for (final Map.Entry<EnumKey, Enum<?>> entry : map.entrySet()) {
storedEnumMap.put(entry.getKey(), entry.getValue());
}
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java 2011-11-12 16:56:52 UTC (rev 2967)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java 2011-11-12 16:58:23 UTC (rev 2968)
@@ -39,7 +39,14 @@
@NotStorableClass
public class ExportStoreQue {
- private static final byte[] DATA = new byte[] {};
+ // FIXMELUC ____________________________why not empty ?
+ // HeapFileDataManager not accept empty data
+ // net.sf.joafip.heapfile.service.HeapException: associated data size must
+ // be defined
+ // at
+ // net.sf.joafip.heapfile.record.entity.HeapRecord.assertDataRecordStateForMarshalling(HeapRecord.java:385)
+ // private static final byte[] DATA = new byte[] {};
+ private static final byte[] DATA = new byte[] { 0 };
private static final int MAX_RECORDS = 1000;
Added: trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/EnumItemState.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/EnumItemState.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/EnumItemState.java 2011-11-12 16:58:23 UTC (rev 2968)
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2008 Luc Peuvrier
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.entity.rel400;
+
+/**
+ * for test
+ *
+ * @author luc peuvrier
+ */
+public enum EnumItemState {
+ /**/STATE1,
+ /**/STATE2;
+}
Added: trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java 2011-11-12 16:58:23 UTC (rev 2968)
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2007 Luc Peuvrier
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.entity.rel400;
+
+import net.sf.joafip.StorableClass;
+
+@SuppressWarnings("PMD")
+@StorableClass
+public class Item implements Cloneable {
+
+ private final int identifier;
+
+ private String value;
+
+ private EnumItemState itemState;
+
+ /**
+ * default constructor to make this persistable
+ *
+ */
+ public Item() {
+ super();
+ identifier = -1;
+ }
+
+ public Item(final int identifier) {
+ super();
+ this.identifier = identifier;
+ }
+
+ public Item(final int identifier,
+ final String value) {
+ super();
+ this.identifier = identifier;
+ this.value = value;
+ }
+
+ /**
+ * copy constructor
+ *
+ * @param item
+ */
+ public Item(final Item item) {
+ super();
+ identifier = item.getIdentifier();
+ final String valueFromItem = item.getValue();
+ if (valueFromItem == null) {
+ value = null;
+ } else {
+ value = "" + valueFromItem;
+ }
+ itemState = item.getItemState();
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(final String value) {
+ this.value = value;
+ }
+
+ public int getIdentifier() {
+ return identifier;
+ }
+
+ public EnumItemState getItemState() {
+ return itemState;
+ }
+
+ public void setItemState(final EnumItemState itemState) {
+ this.itemState = itemState;
+ }
+
+ @Override
+ public String toString() {
+ return "id=" + identifier + " value=" + value;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + identifier;
+ result = PRIME * result + ((value == null) ? 0 : value.hashCode());
+ return result;
+ }
+
+ @Override
+ @SuppressWarnings("PMD")
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof Item)) {
+ return false;
+ }
+ final Item other = (Item) obj;
+ if (identifier != other.getIdentifier())
+ return false;
+ if (value == null) {
+ if (other.getValue() != null)
+ return false;
+ } else if (!value.equals(other.getValue()))
+ return false;
+ return true;
+ }
+
+ @Override
+ public Item clone() {// NOPMD
+ try {
+ return (Item) super.clone();
+ } catch (CloneNotSupportedException exception) {
+ throw new InternalError();// NOPMD
+ }
+ }
+}
Added: trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java (rev 0)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java 2011-11-12 16:58:23 UTC (rev 2968)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2011 Luc Peuvrier
+ *
+ * This file is a part of JOAFIP.
+ *
+ * JOAFIP is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License.
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE
+ * Licensed under the LGPL License, Version 3, 29 June 2007 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * JOAFIP is distributed in the hope that it will be useful, but
+ * unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.sf.joafip.service.rel400;
+
+import net.sf.joafip.AbstractDeleteFileTestCase;
+import net.sf.joafip.NotStorableClass;
+import net.sf.joafip.StorableAccess;
+import net.sf.joafip.TestException;
+import net.sf.joafip.entity.EnumFilePersistenceCloseAction;
+import net.sf.joafip.entity.rel400.Item;
+import net.sf.joafip.service.FilePersistenceBuilder;
+import net.sf.joafip.service.FilePersistenceClassNotFoundException;
+import net.sf.joafip.service.FilePersistenceDataCorruptedException;
+import net.sf.joafip.service.FilePersistenceException;
+import net.sf.joafip.service.FilePersistenceInvalidClassException;
+import net.sf.joafip.service.FilePersistenceNotSerializableException;
+import net.sf.joafip.service.FilePersistenceTooBigForSerializationException;
+import net.sf.joafip.service.IDataAccessSession;
+import net.sf.joafip.service.IFilePersistence;
+
+/**
+ *
+ * @author luc peuvrier
+ *
+ */
+@NotStorableClass
+@StorableAccess
+public class TestEnumMap extends AbstractDeleteFileTestCase {
+
+ public TestEnumMap() throws TestException {
+ super();
+ }
+
+ public TestEnumMap(final String name) throws TestException {
+ super(name);
+ }
+
+ public void testEnumMap() throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException,
+ FilePersistenceTooBigForSerializationException {
+
+ IFilePersistence filePersistence = createFilePersistence(true);
+ IDataAccessSession session = filePersistence.createDataAccessSession();
+ session.open();
+ Item item=new Item(0, "value");
+ session.setObject("key",item);
+ session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
+ filePersistence.close();
+
+ filePersistence = createFilePersistence(false);
+ session = filePersistence.createDataAccessSession();
+ session.open();
+ item=(Item) session.getObject("key");
+ assertEquals("bad state",0,item.getIdentifier());
+ assertEquals("bad state","value",item.getValue());
+ session.closeAndWait(EnumFilePersistenceCloseAction.SAVE);
+ filePersistence.close();
+ }
+
+ private IFilePersistence createFilePersistence(final boolean removeFile)
+ throws FilePersistenceException,
+ FilePersistenceInvalidClassException,
+ FilePersistenceNotSerializableException,
+ FilePersistenceClassNotFoundException,
+ FilePersistenceDataCorruptedException {
+ final FilePersistenceBuilder builder = new FilePersistenceBuilder();
+ builder.setPathName(path.getAbsolutePath());
+ builder.setRemoveFiles(removeFile);
+ builder.setProxyMode(true);
+ builder.setCrashSafeMode(false);
+ builder.setGarbageManagement(false);
+ return builder.build();
+ }
+}
Modified: trunk/joafip/src/test/resources/log4j.properties
===================================================================
--- trunk/joafip/src/test/resources/log4j.properties 2011-11-12 16:56:52 UTC (rev 2967)
+++ trunk/joafip/src/test/resources/log4j.properties 2011-11-12 16:58:23 UTC (rev 2968)
@@ -127,7 +127,9 @@
#log4j.logger.net.sf.joafip.performance.service=debug
#log4j.logger.net.sf.joafip.service.bug.emis.TestEmis=debug
log4j.logger.net.sf.joafip.performance.items.service.Inserter=info
+log4j.logger.net.sf.joafip.performance.items.service.InserterBKM=info
log4j.logger.net.sf.joafip.performance.items.service.Searcher=info
+log4j.logger.net.sf.joafip.performance.items.service.SearcherBKM=info
log4j.logger.net.sf.joafip.performance.items.service.ImportSearcher=info
log4j.logger.net.sf.joafip.service.MainCrash=info
log4j.logger.net.sf.joafip.service.MainAfterCrash=info
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-11-12 16:58:29
|
Revision: 2968
http://joafip.svn.sourceforge.net/joafip/?rev=2968&view=rev
Author: luc_peuvrier
Date: 2011-11-12 16:58:23 +0000 (Sat, 12 Nov 2011)
Log Message:
-----------
added tests. added fix. correction
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/service/FilePersistence.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java
trunk/joafip/src/test/resources/log4j.properties
Added Paths:
-----------
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/que/
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/EnumItemState.java
trunk/joafip/src/test/java/net/sf/joafip/entity/rel400/Item.java
trunk/joafip/src/test/java/net/sf/joafip/service/rel400/TestEnumMap.java
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <luc...@us...> - 2011-11-21 19:54:05
|
Revision: 2976
http://joafip.svn.sourceforge.net/joafip/?rev=2976&view=rev
Author: luc_peuvrier
Date: 2011-11-21 19:53:58 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------
refactoring
Modified Paths:
--------------
trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java
trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceNoG.java
trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java 2011-11-21 07:14:22 UTC (rev 2975)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/export_import/out/ExportStoreQue.java 2011-11-21 19:53:58 UTC (rev 2976)
@@ -39,7 +39,7 @@
@NotStorableClass
public class ExportStoreQue {
- // FIXMELUC ____________________________why not empty ?
+ // FIXMELUC ______why not empty ?
// HeapFileDataManager not accept empty data
// net.sf.joafip.heapfile.service.HeapException: associated data size must
// be defined
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-11-21 07:14:22 UTC (rev 2975)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/AbstractObjectIOManagerIOForObject.java 2011-11-21 19:53:58 UTC (rev 2976)
@@ -833,10 +833,10 @@
@Override
public void newObjectLoaded() throws ObjectIOException {
- autoSave();
+ checkForAutoSave();
}
- protected abstract void autoSave() throws ObjectIOException;
+ protected abstract void checkForAutoSave() throws ObjectIOException;
/**
* creation of a not existing object delegating to
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-11-21 07:14:22 UTC (rev 2975)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/ObjectIOManager.java 2011-11-21 19:53:58 UTC (rev 2976)
@@ -308,7 +308,7 @@
public void saveAndUnsetProxyObjectState(
final ObjectAndPersistInfo objectAndItsClassInfo)
throws ObjectIOException, ObjectIOInvalidClassException {
- save();
+ autoSave();
unsetProxyObjectState(objectAndItsClassInfo);
}
@@ -677,17 +677,16 @@
}
@Override
- protected void autoSave() throws ObjectIOException {
+ protected void checkForAutoSave() throws ObjectIOException {
if (autoSaveEnabled) {
- // final int numberOfObjectState = getNumberOfObjectState();
final int numberOfObjectState = getNumberOfReferenced();
if (numberOfObjectState >= maxInMemoryThreshold && doAutoSave()) {
- save();
+ autoSave();
}
}
}
- protected void save() throws ObjectIOException {
+ protected void autoSave() throws ObjectIOException {
try {
final long beginTime = System.currentTimeMillis();
final boolean saveDone = saver.autoSave();
Modified: trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java
===================================================================
--- trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java 2011-11-21 07:14:22 UTC (rev 2975)
+++ trunk/joafip/src/main/java/net/sf/joafip/store/service/objectio/manager/SerializerObjectIOManager.java 2011-11-21 19:53:58 UTC (rev 2976)
@@ -409,7 +409,7 @@
}
@Override
- protected void autoSave() throws ObjectIOException {
+ protected void checkForAutoSave() throws ObjectIOException {
// no implementation
}
Modified: trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceNoG.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceNoG.java 2011-11-21 07:14:22 UTC (rev 2975)
+++ trunk/joafip/src/test/java/net/sf/joafip/service/TestFilePersistenceNoG.java 2011-11-21 19:53:58 UTC (rev 2976)
@@ -32,8 +32,7 @@
builder.setGarbageManagement(false);
builder.setCrashSafeMode(false);
filePersistence = (FilePersistence) builder.build();
- // FIXMELUC ______________________NoPersistenceConstraintCheck
- // annotation
+ // FIXMELUC ___________NoPersistenceConstraintCheck annotation
final Method method = Bob1.class.getDeclaredMethod(
"doSomethingOnOtherBob1Private", new Class<?>[] { Bob1.class });
filePersistence.addToNotCheckMethod(method);
Modified: trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java
===================================================================
--- trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java 2011-11-21 07:14:22 UTC (rev 2975)
+++ trunk/joafip/src/test/java/net/sf/joafip/store/service/objectio/serialize/AbstractSerializeTest.java 2011-11-21 19:53:58 UTC (rev 2976)
@@ -261,5 +261,4 @@
protected abstract void assertUnserialized(Object unserialized);
protected abstract Object[] modifyObjectToSerialize(Object object);
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|