Bug #5
using persistence functions in session hooks
Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:
0%
billable:
No
vendor_id:
GCD
case_num:
History
#1 Updated by Stanislav Lomany almost 14 years ago
@44898 - issue 1:
1. Register this hook: public class SessionHook implements InitTermListener { public void initialize() { Persistence persistence = PersistenceFactory.getInstance("p2j_test"); RecordIdentifier ident = null; try { boolean beganTx = persistence.beginTransaction(); Long pk = (Long) persistence.nextPrimaryKey("book"); ident = new RecordIdentifier("book", pk); persistence.lock(LockType.EXCLUSIVE_NO_WAIT, ident, true); BookImpl book = new BookImpl(); book.setBookId(new integer(9999)); book.setBookTitle(new character("Some book")); book.setCost(new integer(10)); book.setPrice(new integer(10)); persistence.save(book, pk); if (beganTx) { persistence.commit(); } } catch (PersistenceException exc) { System.out.println(exc); } finally { if (ident != null) { try { persistence.lock(LockType.NONE, ident, true); } catch (LockUnavailableException exc) { // unexpected } } } } public void terminate(Throwable t) { } } 2. Run a simple testcase that uses permanent buffers, e.g. find first book no-lock.
#2 Updated by Stanislav Lomany almost 14 years ago
@44899 - isuue 1 (cont):
3. You will the following exception when performing RecordBuffer.openScope(book): (StandardServer.invoke:SEVERE) {00000001:00000006:syman} Abnormal end! java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.goldencode.p2j.util.Utils.invoke(Utils.java:1049) at com.goldencode.p2j.main.StandardServer$MainInvoker.execute(StandardServer.java:1292) at com.goldencode.p2j.main.StandardServer.invoke(StandardServer.java:761) at com.goldencode.p2j.main.StandardServer.standardEntry(StandardServer.java:300) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:76) at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:584) at com.goldencode.p2j.net.Conversation.block(Conversation.java:316) at com.goldencode.p2j.net.Conversation.run(Conversation.java:158) at java.lang.Thread.run(Thread.java:619)
#3 Updated by Stanislav Lomany almost 14 years ago
@44900 - issue 1 (cont 2):
Caused by: java.lang.NullPointerException at com.goldencode.p2j.persist.BufferManager.resetState(BufferManager.java:723) at com.goldencode.p2j.util.TransactionManager.processResettables(TransactionManager.java:1678) at com.goldencode.p2j.util.TransactionManager.rollbackWorker(TransactionManager.java:1660) at com.goldencode.p2j.util.TransactionManager.rollback(TransactionManager.java:1521) at com.goldencode.p2j.util.TransactionManager.rollback(TransactionManager.java:1478) at com.goldencode.p2j.util.TransactionManager.abnormalEnd(TransactionManager.java:3128) at com.goldencode.p2j.util.TransactionManager.abnormalEnd(TransactionManager.java:3049) at com.goldencode.p2j.util.BlockManager.topLevelBlock(BlockManager.java:6924) at com.goldencode.p2j.util.BlockManager.externalProcedure(BlockManager.java:194) at com.goldencode.p2j.util.BlockManager.externalProcedure(BlockManager.java:180) at com.goldencode.testcases.Go.execute(Go.java:15) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.goldencode.p2j.util.Utils.invoke(Utils.java:1049) at com.goldencode.p2j.main.StandardServer$MainInvoker.execute(StandardServer.java:1292) at com.goldencode.p2j.main.StandardServer.invoke(StandardServer.java:761) at com.goldencode.p2j.main.StandardServer.standardEntry(StandardServer.java:300) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.goldencode.p2j.util.MethodInvoker.invoke(MethodInvoker.java:76) at com.goldencode.p2j.net.Dispatcher.processInbound(Dispatcher.java:584) at com.goldencode.p2j.net.Conversation.block(Conversation.java:316) at com.goldencode.p2j.net.Conversation.run(Conversation.java:158) at java.lang.Thread.run(Thread.java:619) Probably happens because openBuffers does not have a proper scopes added.
#4 Updated by Redmine Admin over 12 years ago
@45194 - Status changed from WIP to Hold
#5 Updated by Stanislav Lomany about 12 years ago
Imported from JPRM on 2012-04-12 11:22:57.783:
TASKID = 5989 PROJECTID = 124 STATUS = 3 (Hold) DESCRIPTION = using persistence functions in session hooks OWNER = SVL ASSIGNEE = BILLABLE = false PRIORITY = 5 (Normal) PHASE = 52 (Problem Resolution) COMPONENT = 0 ESTEFFORT = 0.000000 ESTSTART = 2010-05-31 ESTSTOP = ACTSTOP = CASENUM = VENDORID = COMMENT = '' LASTWIP = 2011-09-18