Persistent Locking

Just to warn you before anybody reads this long post and finds it completely out of his/her interest - in this post I'm sidetracking a bit from the 'traditional' Java concurrency...
I am currently interested in the subject of persistent locking, i.e. acquiring locks in database. Last year I was involved in several projects with such requirement, mainly on account of running in clustered environment. In such case there is sometimes a need to ensure that a resource / critical code block is subject to synchronized modification / execution beyond the scope of a single JVM. As far as I know, database vendors offer different kinds of locks, but they all are bound to a single transaction (this is also reflected by ORM APIs, which often expose lock() methods that lock an entity till the end of current transaction). However, the usecases that I encountered required different scopes:
- 'smaller' than a single transaction (e.g. small block of code that required cluster-wide synchronization within larger transaction executed frequently - transaction-scoped lock would hurt scalability, since each transaction would be blocked at entry point to the critical code block until the one holding the lock would finish)
- 'greater' than a single transaction - e.g. possimistic locking of data objects for certain page flows consisting of multiple web pages (= requests = transactions) for current user. If another user tried to enter the page flow, he would be informed that someone else is modifying the data and he must try again later (this usually does not fit for mass-user internet portals, but does occur in internal entrprise apps)
I am trying to design small framework / library that would handle such use cases in a generic way, thus making implementation of this kind of locking easier. But I don't see much discussion around this particular topic (in fact, I don't see any discussion and I wonder, if I'm the only person out there that has met such use cases... Probably app server vendors provide their own solutions for cluster-wide locking, presumably in some cleverer way than database locks, but the projects I participated in usually operated on simple, unmanaged clusters (actually 'cluster' is a wrong name for this, they were simple collections of machines hidden behind load-balancer). So this kind of solution (vendor-specific) was not an answer, because it would require a full-blown cluster.
My question is therefore - have you ever met the kind of scenario I described - where persistent locks would be useful? If so, please describe it. I don't want to do anything basing exclusively on my experience. It would help me a lot to get to know various points of view and to convince myself that this kind of locking is useful in more scenarios.

Hi Rich,
1 more question .. if i have multiple Db tables related to 1 logical entity (eg Logical entity is customer and it has multiple Ztables to store customer's data) so I would have to create a persistent class for each of the Ztables correct ? then which of the following approaches is the best
1. Write a wrapper class to represent the Business entity customer and inside that wrapper class call the locking methods and the GET_  & SET_ methods
2. Add the other persistent classes as attributes of the main persistent class( as type ref to so that its corresponding GET_, SET_ methods are auto generated ). eg. IF the are two tables ZCUST, ZCUST_COMP_CODE then we would have 2 persistent classes. Should I add the persisent class of ZCUST_COMP_CODE to ZCUST ?

Similar Messages

  • Can't delete some files due to a persistent lock.

    I've been having problems deleting a few files. I get this error
    oracle.ifs.common.IfsException: IFS-30650: PublicObject has a persistent lock; unable to change
         void oracle.ifs.common.IfsException.<init>(int)
              IfsException.java:341
         void oracle.ifs.common.IfsException.<init>(int, oracle.ifs.common.Traceable)
              IfsException.java:361
         void oracle.ifs.server.S_LockObject.verifyCanDeleteLockedPublicObject(oracle.ifs.server.S_PublicObject)
              S_LockObject.java:709
         java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])
              native code
         java.lang.Object oracle.ifs.server.S_LibraryObject.invokePolicyMethod(java.lang.String, java.lang.Object[], java.lang.String[])
              S_LibraryObject.java:2701
         void oracle.ifs.server.S_LockObject.handleLockPolicy(oracle.ifs.server.S_PublicObject, oracle.ifs.server.S_LibraryObjectDefinition, java.lang.String)
              S_LockObject.java:405
         void oracle.ifs.server.S_PublicObject.extendedPreFree(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)
              S_PublicObject.java:1818
         void oracle.ifs.server.S_Document.extendedPreFree(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)
              S_Document.java:377
         void oracle.ifs.server.S_LibraryObject.preFree(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)
              S_LibraryObject.java:1655
         void oracle.ifs.server.S_LibraryObject.free(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)
              S_LibraryObject.java:2328
         void oracle.ifs.server.S_LibrarySession.DMFree(java.lang.Long, java.lang.Long, oracle.ifs.server.S_LibraryObjectDefinition)
              S_LibrarySession.java:9283
         void oracle.ifs.beans.LibrarySession.DMFree(java.lang.Long, java.lang.Long, oracle.ifs.server.S_LibraryObjectDefinition)
              LibrarySession.java:9222
         void oracle.ifs.beans.LibraryObject.free(oracle.ifs.beans.LibraryObjectDefinition)
              LibraryObject.java:1132
         void oracle.ifs.beans.LibraryObject.free()
              LibraryObject.java:1108
         void Tester.Tester.unLockFiles(java.lang.String)
              Tester.java:149
         void Tester.Tester.main(java.lang.String[])
              Tester.java:81
    This error even happens when I log in as system which has system admin priveleges. I can't figure out how to release the lock on these files that have it. I don't even know how this lock was created.
    I also tried to loop through all of the files with this lock and change the files to unlocked, but that produced a stack trace as well.
    Shouldn't system admin be able to delete any file?
    Thanks for the help.

    Tried that as well initially. When I log in as system, set as administration mode, I tried setting the objects to unlock using this code.
    LibrarySession session = [My Get Session Code];
    session.setAdministrationMode(true);
    IfsFileSystem fso = new IfsFileSystem(session);
    Folder folder = (Folder)fso.findPublicObjectByPath([Path to folder which contains the locked files]);
    PublicObject[] pos = folder.getItems();
    for (int index = 0; index < pos.length; index++) {
    pos[index].getLockObject().setLockState(LockObject.LOCKSTATE_UNLOCK);
    I get this exception when I run that code
    oracle.ifs.common.IfsException: IFS-30020: Attribute is not updateable (LOCKSTATE)
    This is kinda frustrating. Luckily this is in development right now but I don't want something like this happening in production, and if it did, it'd be nice to be able to fix it.
    Thanks again for your help.

  • Persistent Lock Icon on AE USB Disk

    Hi. I have a 1TB USB disk hanging off of my Airport Extreme. At some point recently, it decided to lock itself and become non-writable. I've mucked around in Terminal and tried Super Get Info, and in both places it shows the volume as being owned by me (777 UNIX permissions). I've gotten to the point where I can copy files into the existing folders on it, but not directly to the volume (e.g., I can't copy a folder onto its "desktop.").
    Am I just doing something immensely stupid, or missing something really easy? I'm pretty frustrated; a network disk you can't write to isn't really worth very much.
    Any help would be appreciated.

    run the following terminal command
    sudo chflags 0 /Volumes/*
    you'll have to enter your admin password (which you won't see). that's normal.

  • Persistent locks??

    Hi experts,
    we have the following phenomenon:
    The use of FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT' sets a lot of lock entries.
    Following the function call we call FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    This should start the update process and release the locks. But although COMMIT WORK has been processed, no update process starts and all the locks remain. This causes a lock table overflow if we try to mass-update.
    Can you explain this behavior?
    Regards,
    Clemens

    Bingo!
    there are lots of notes about performance issues and other things.
    But there is one not yet one month old and it is titled
    Note 1071095 - Releasing blocks with BAPI_MATERIAL_MAINTAINDATA_RT
    After application of the note, it works as expected.
    Regards,
    Clemens

  • Persistent​ly lock function keys!?

    Hello,
    I would like to persistently lock the function keys at my E531 laptop.
    I know you can switch between function keys and multimedia functions by setting FnLock (Fn+ESC), but unfortunately this setting is volatile: everytime I restart the system (even from power saving mode), it is lost and the keys default to multimedia again.
    Using this laptop only for "real work", with software that extensively uses the function keys, this is really getting on my nerves...
    Is there any way to persistently lock the function keys to generate F1..F12 keycodes?
    If I'd ever need the multimedia functions, I'll luckily hold down the Fn key before...
    OS is Windows 8.1.
    Thanks for any help,
    Tilmann
    Solved!
    Go to Solution.

    Tillman,
    In addition to the suggestions Mithunr has made, I would ask if you are running the preload?  
    Could you also check to see that the hotkey drivers are installed, especially if you have done a reload of the system.
    I mention this after reading this thread -> http://forums.lenovo.com/t5/ThinkPad-Edge-S-series​/ThinkPad-Yoga-FN-keys/td-p/1355211
    Thanks!
    Best regards,
    Mark
    ThinkPads: S30, T43, X60t, X1, W700ds, IdeaPad Y710, IdeaCentre: A300, IdeaPad K1
    Mark Hopkins
    Program Manager, Lenovo Social Media (Services)
    twitter @lenovoforums
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

  • Any way to lock objects in stateless app?

    Hi Guys
    Firstly: I know... I know... Once the stateless request has completed, the "session" is destroyed along with any locks etc. But how do you handle situations where you need to keep a more persistent lock on an object across stateless invocations?
    For example: Our stateless app allows you to update a customer record. I want to prevent someone from going into XD02 (or use our BSP app) to update the same record...
    Any thoughts greatly appreciated!

    I had a little bit of time so I tried my shared memory idea and unfortunetely it didn't work. I can lock from within my shared memory class, however the locks are released as soon as the detatch_commit() of the area is called.  When I look in the debugger I see something even more interesting.  If I look at references to my object while my write program is running I see that the object is of my class type: ZCL_SDN_SHARED_ROOT and that it is referenced by the running program and also referenced as the following: KERNEL=
    Now if I follow the debugger out of the execution of my program into the calling stack, I can see that my object reference still exists.  If I look at the references, I still have two of them.  One is the Kernel still, but the program's reference is gone.  Now I have the following reference as well:
    .  This must be the reference to my Root instance in my shared memory area. 
    This is the really interesting part.  If I drill into the object display of my root class instance it no longer displays as type CLASS=ZCL_SDN_SHARED_ROOT.  It is now as follows:  .  It is as though the root instance isn't actually stored in Shared memory, just some meta model description of the object instance.  This could very well explain why you can't persist locks or other ABAP Object References inside a shared memory class.

  • LOCK STR

    Hi,
    I need to lock STRs while creating STO. Can you pls help me with the function module.
    I looked for ENQUEUE FM for STR lock.But couldn't find it.
    Pls help
    Thanks
    Ram

    Hi,
    This typically occurs when, after creating a workspace, the parent workspace updates the row.  Then, when the child workspace tries to lock it, it is unable to do so due to the row already being versioned(updated) in the parent.  While the row might not be locked in the parent, it would prevent another workspace from obtaining a lock on it.
    If this is the case, your options to resolve this are:
    (1) Refresh the child workspace.  The child workspace would then be able to view the latest version of the row and lock it as necessary.
    (2) Rollback the change to the row in the parent workspace.
    (3) Update the row in the child workspace in such a way that a persistent lock does not need to be applied.
    If the above does not describe your situation, that I would need more details about when and in which workspaces the row was modified.
    Regards,
    Ben

  • Locking without Enqueue Process

    Hi All,
    Here is a strange scenario ;
    - Standalone EP SP12 installation.
    - Start J2EE
    - Logon to Portal, open an iview(iviewA) to edit it
    - Open "Monitor Locked Objects" within Portal to see the locked iview object
    - Terminate enqueue server process manually on O.S Level.
    - Open another iview object (iviewB) to edit in Portal
    Now,if I try to edit iviewB with another user, I expect to edit it without any restriction although it is in edit mode by another user, because there is no enqueue process to handle the locks. But that does not happen! I'm still getting "Object is Read-Only" message if I try to edit iviewB and I can see the provided lock for iviewB in "Locked Objects List".
    Another thing is, I can also still see the lock for iviewA in lock table even though there is no enqueue process.
    Now, how can this be explained ? There is no lock server, but someone is still providing locks ???
    Regards
    Ahmet Tekin

    It's entirely possible that the PCD which persists iviews uses internal persistent locks on an object level; and if it uses enqueue locks at all then most likely for cluster-wide  synchronized access to critical PCD superstructures only.

  • IMAP option to not delete from server OR recommend alternate mail app?

    Using POP in Windows computer and IMAP on iphone.
    In the iphone, POP has the opton to "delete from server: never"
    There seems no way to accomplish this in the stock mail app when using IMAP ?
    Using POP on the iphone is not an option due to the longstanding issue of the Apple mail apps not sending a  proper termination signal back. The mailbox remains locked until the server times it out for inactivity and cleans up the stale lock after 10 minutes. The result is "wrong password" on the computer if it then tries to retrieve during that period. It's a feature of POP by design to use a lock to prevent corruption caused by simultaneous access to the mailbox. BUT, BB,Android,Windows all handle this correctly so that their POP transaction (and the mailbox lock) only lasts seconds! Only ever see this persistent lock with Apple mail clients
    The user likes to keep his phone inbox clean, he will delete messages as he deals with them as well as messages he is postponing to deal with on computer later.
    Moving messages to a 'later' folder won't help, as that 'later' folder will not be available thru POP (for the computer)
    They also don't want to use IMAP on the computer because they don't want their communications stored on the server any longer than necessary.
    Can anyone recommend:
    - Windows IMAP client which downloads all and keeps a local copy of inbox which does not synch with server inbox.
    - Alternate mail app for iphone which allows "delete from device only // never delete from server "

    That's not how IMAP works. If you want to keep the inbox clean, but not delete the messages, create folders and move the messages into them for later review.

  • CMS admin tool account info

    When setting up domains in CMS, I put a user account instead of the CMSadm account.  Later on, I switched from the user account to the CMSadm account.  In between a that time and current time, our UME began to use Active Directory to authenticate users.  Once that happened, I noticed my Active Directory id was getting persistently locked.  It turns out the CMS service tcSLCMS~WebUI is still using my old user account to do something and passing Active Directory the wrong id and locking the account.
    Does anyone know where tcSLCMSWebUI gets account information from?  I want to find every place in tcSLCMSWebUI where that user account is hard coded and take it out.
    Thanks in advance,
    JC

    Hi Jason,
    It might be the case that CMSadm account that you have created does not have write access in the WAS of the SLD.
    The user requires LcrInstanceWriterAll. If both the WAS are using the same source for User Mgmt then i feel you need to assign this role in the WAS of SLD.
    What you do think?
    Regards
    Sidharth
    Message was edited by: Sidharth Deshpande

  • User lock persists for killed process

    Hi,
    We have an app that acquires a user lock (using dbms_lock, release_on_commit FALSE).
    We needed to kill a session but it remained in v$session (KILLED), even after killing the OS process. Fine, I know it will clear up eventually.
    But the user lock (UL) persists. Does anyone know how it can be force-released?
    Calling dbms_lock.release (using handle in v$lock) fails, even as user SYS, the error being that the user does not own the lock. But the owning session is killed so who can release it?
    Eventually the session (and lock) disappers from v$session/v$lock but can the lock be removed before then, to avoid a DB bounce in an urgent case?
    Thanks

    If the process was truely KILLED and not MARKED FOR KILL then I do not know what could of happened. I cannot remember Oracle ever failing to release a user lock when the acquiring session was terminated. We use a fair number of UL; however, few of our processes have concurrent sessions that attempt to use the same UL. Mostly we just ensure that batch processes do not get submitted twice and that some on demand processes run single threaded or do not run if another customer has submitted the task.
    HTH -- Mark D Powell --

  • BPM Workspace - Persistent column resizing & locking down Priority field

    Hello All,
    BPM version 11.1.1.7
    1) In the BPM workspace, a user can resize the visible columns in the tasks list in the Inbox views or other views. However, as soon as the user navigates out and returns to the view , the layout gets resset. All the column resizing is lost. This happens within the same session. Is this expected behaviour? Is there any way to alter this?
    Usually in ADF applications, hooking the application to MDS and enabling user customizations persists the column resizing across sessions. I am wondering why (if) this hasn't been done for the workspace.
    2) The priority field is editable by any user. Is there a way to lock this down based on roles? i.e. only certain roles may edit the priority.
    TIA,
    Bijesh

    Hello All,
    BPM version 11.1.1.7
    1) In the BPM workspace, a user can resize the visible columns in the tasks list in the Inbox views or other views. However, as soon as the user navigates out and returns to the view , the layout gets resset. All the column resizing is lost. This happens within the same session. Is this expected behaviour? Is there any way to alter this?
    Usually in ADF applications, hooking the application to MDS and enabling user customizations persists the column resizing across sessions. I am wondering why (if) this hasn't been done for the workspace.
    2) The priority field is editable by any user. Is there a way to lock this down based on roles? i.e. only certain roles may edit the priority.
    TIA,
    Bijesh

  • Locking and non-persistent changes in cache

    I have a question regarding Optimistic locking and modifying objects in the cache.
    I have a case where one client modifies a (persistent) object, but since it is a temporary change, which should not be persisted, it is not within a UOW. However, when the next client reads the same object, it gets the modified value and not the original value, which is not correct.
    For the moment, there are no locking defined for the descriptors, but would Optimistic locking help in this case? Does this not only protect when you try to write a change on a stale object to the database?
    If you run the risk that someone might change an object, and consequently change the cache and how the object is seen by others, should the reads be performed in a UOW?
    Regards,
    Katarina

    Yes, if you may make changes to the object you must make the changes in the unit of work, even if you do not intend to commit the changes. Reads from the session are strictly read-only.

  • Locking in persistent object

    Hi Experts,
    Does persistent object provide locking mechanism for updating data? If yes, How do I do it?
    Thanks!

    Sure - it's called the Transaction Service. [ABAP - Object Services|http://help.sap.com/saphelp_nw70/helpdata/en/ab/9d0a3ad259cd58e10000000a11402f/frameset.htm]
    Cheers
    Graham Robbo

  • Persistent banner on lock screen even after deleting app

    AMC movies & Stubbs awards app has been deleted on all devices yet on my iPhone 6 the AMC banner persists on the lock screen! Driving me crazy!

    Reset your phone - no data loss
    Restart or reset your iPhone, iPad, or iPod touch - Apple Support

Maybe you are looking for

  • Adding data to a specific row in excel

    Hi there,                     I have problems with my data collection from serial read block. I get every time 16 bytes when I write certain command to my serial device. But after a continuous data written to excel, that is let say six rows of data a

  • RM 900 remote doesn't work after driver update

    Hi! After solving the proble of? "crackle, pops and noise" with a driver update for Audigy Platinum Ex, I see that my remote is no longer working, i've try reinstalling Remote Center from original drivers and applications CD and after a Volume Up or

  • Unable to open FR in PDF

    Hi All, We have upgraded our system to 11.1.2.2 from 11.1.2.1 and that moment we were able to open FR in PDF. But the moment we applied 300 patches. from when we are unable to open FR in PDF format. OS: Solaris Does any one else facing same issue or

  • Adobe Form urgent questions!

    Okay, I've just created a form using Adobe Designer, one that contains fields that someone can fill out when the form is open with Adobe Reader. The form I've created specifically is for a medical practice, and the first few fields are the doctor's l

  • Grant select permission

    As user "A" I want to grant select permissions to all my tables to user "B". Is there a way to do this in 1 command, or do I need to specify 1 table at a time.