Method-level Locking

(Here's another one):
I'm unable to find a way to enable method-level locking in WebLogic.
This kind of lock has the same semantics as a simple "synchronized" on the
method level (which you cannot write as a bean developer). The advantage is
that you've got thread-safe access to a method without expensively
interfering with the transaction manager.
So is this possible in WLS v6.1/v7.0?
Regards,
Pieter Van Gorp.

I assume you are talking about entity beans. You can use the "Exclusive"
concurrency strategy. Here is the link:
http://e-docs.bea.com/wls/docs61/ejb/reference.html#1139340
"Pieter Van Gorp" <[email protected]> wrote in message
news:[email protected]..
(Here's another one):
I'm unable to find a way to enable method-level locking in WebLogic.
This kind of lock has the same semantics as a simple "synchronized" on the
method level (which you cannot write as a bean developer). The advantageis
that you've got thread-safe access to a method without expensively
interfering with the transaction manager.
So is this possible in WLS v6.1/v7.0?
Regards,
Pieter Van Gorp.

Similar Messages

  • Method-level ACLs

    Can anyone provide me with an example web.xml file that has acl protection at the method level? There is documentation saying that you can protect down to the method level, but I am having trouble finding anything on how...

    I assume you are talking about entity beans. You can use the "Exclusive"
    concurrency strategy. Here is the link:
    http://e-docs.bea.com/wls/docs61/ejb/reference.html#1139340
    "Pieter Van Gorp" <[email protected]> wrote in message
    news:[email protected]..
    (Here's another one):
    I'm unable to find a way to enable method-level locking in WebLogic.
    This kind of lock has the same semantics as a simple "synchronized" on the
    method level (which you cannot write as a bean developer). The advantageis
    that you've got thread-safe access to a method without expensively
    interfering with the transaction manager.
    So is this possible in WLS v6.1/v7.0?
    Regards,
    Pieter Van Gorp.

  • Java has no function level lock?

    Hi, everyone!
    I am a C++ programmer before and after reading the
    internal implemention method of Java Thread. I think
    Java has no function level lock and only object level
    lock. I mean to acquire a function lock is the same as
    acquire an object's lock.
    For example, when objectA.synchronizedFunctionA is called,
    suppose synchronizedFunctionA is a synchronized function of
    class A. Java only check whether objectA is locked. The synchronized
    function synchronizedFunctionA has no individual function level
    lock.
    Am I correct?
    If I am correct, I think in some certain application, function level
    lock will be more efficient than object level lock. Even though it
    should be used more carefully.
    Thanks in advance,
    George

    You could have a custom lock object for every method to get the same functionality.
    I.e. instead of...
    public synchronized void mySynchMethod() {
    }you'd do..
    public void mySynchMethod() {
       synchronize(thisMethodLock) {
    }where thisMethodLock would be some object used as a lock by only that method.

  • Pl sql row level locking with wait ?

    Hi,
    I am using oracle 10g.
    I am new to Oracle locks. I have two tables Table1(id_no, employee, salary) and Table2(id_no, employee, salary).
    I need to pull any requested row from Table1 into Table2 only once on demand. I have a procedure to pull data and there could be more than one requests try to call same procedure to pull a row from Table1 into Table2 at any given time.
    I coded below to achieve row level lock. if one transaction gets row level lock on Table1 at 2, so other Transactions should wait till the lock is released at line 2 or 5 to avoid duplicates.
    But below code is not working, I am getting duplicates when I call this using two concurrent java threads.
    How do I control this concurrency issue so that I can avoid duplicate entries in Table2. Could any one please help?
    1.begin
    2.select 0 into emp_cnt
    3.from Table1 where id=id_no
    4.for update;
    5.update Table1 set employee='xyz'
    6.where id=id_no;
    7.select count(*) into table2_cnt from Table2 where id=id_no;
    8.if(table2_cnt =0) then
    9.code to insert above row from Table1 to Table2;
    10.end if;
    11.commit;
    12.End;
    Edited by: 980916 on Jan 9, 2013 5:48 PM

    Welcome to the forums and welcome to Oracle.
    Lets establish one thing right from the beginning ... the Oracle Database is not a Microsoft product.
    There is no general reason to use row level locks, you should not want to use row level locks, you don't need row level locks, and you will almost never have any valid reason to consider row level locks.
    That said there are two situations were it may be necessary to lock a row prior to an update or delete (possibly in a merge) and in those cases you want to use the built-in SELECT FOR UPDATE syntax. (Demo here: http://www.morganslibrary.org/reference/deadlocks.html#dlfu). But we should be clear here ... one rarely needs to use this locking mechanism as the chances of a collision in a well designed application are essentially zero.
    Also as you are new to Oracle please explore the dynamic performance view V$RESERVED_WORDS and do not name objects, columns, etc. with reserved word names not that there is an excuse in any product to name a column "ID." Something Joe Celko has railed about for decades and a tradition I think we should all follow.
    In the case of your posted code example (btw please read the FAQ and learn how to use tags) the solution is SELECT FOR UPDATE if locking can be justified which is unlikely.
    Edited by: damorgan on Jan 9, 2013 6:11 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Row level locks

    Hi All,
    Version - Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    I have a card's data in a table. Whenver a two different sessions/threads selects the data sometimes they get the same card.
    Now I need to lock the record. If Thred-1 selects then it will lock the first records and thread-2 must select the second record as the first record is locked by thread-1.
    I have written a piece of code , at first session it locks one record and when second session select it selects no records.
    I have takem MIN group function because I want the cards to be selected in order.
    Can you please tell where is my code went wrong or need some changes. Data and code is given below.
    SQL> SELECT * FROM crm_pps_cards_sz ORDER BY 1;
    CARD_NO          PIN  SERIAL_NUMBER DATE_CREATED DATE_MERGED DATE_ALLOCATED DATE_REGISTERED
    6338079966430591 9985 9950013661    12/06/2011                             
    6338079973369543 6858 9950013660    12/06/2011                             
    6338079978994154 7144 9950013655    12/06/2011                             
    6338079981471778 7631 9950013654    12/06/2011                             
    6338079986365041 7849 9950013657    12/06/2011                             
    SQL>
    Thread - 1
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    Connected as crm
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2    l_rec crm_pps_cards_sz%ROWTYPE;
      3    CURSOR c IS
      4      SELECT * FROM crm_pps_cards_sz t WHERE t.card_no =
      5      (SELECT MIN(card_no) card FROM crm_pps_cards_sz)
      6      FOR UPDATE NOWAIT SKIP LOCKED;
      7 
      8  BEGIN
      9    OPEN c;
    10    FETCH c
    11      INTO l_rec;
    12    CLOSE c;
    13    dbms_output.put_line('Card Allocated ' || l_rec.card_no);
    14 
    15  END;
    16  /
    Card Allocated 6338079966430591
    PL/SQL procedure successfully completed
    SQL>
    Thread - 2
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
    Connected as crm
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2    l_rec crm_pps_cards_sz%ROWTYPE;
      3    CURSOR c IS
      4      SELECT * FROM crm_pps_cards_sz t WHERE t.card_no =
      5      (SELECT MIN(card_no) card FROM crm_pps_cards_sz)
      6      FOR UPDATE NOWAIT SKIP LOCKED;
      7 
      8  BEGIN
      9    OPEN c;
    10    FETCH c
    11      INTO l_rec;
    12    CLOSE c;
    13    dbms_output.put_line('Card Allocated ' || l_rec.card_no);
    14 
    15  END;
    16  /
    Card Allocated
    PL/SQL procedure successfully completed
    SQL> My concern is that it must allocate in the order
    6338079966430591
    6338079973369543
    ....

    It is because MIN(ard_no) is able to find value from table which is locked by you thread 1 and thread 1 mentioned NOWAIT thus it thread 2 went out without getting anything.
    Please check my reply to your duplicate thread "row level locking" .

  • Method to lock alignment guides (pages 5.5)

    Is there a method to lock "alignment guides" in Pages?     I seem to be constantly grabbing them accidentally.  Probably just moving too fast.  But was hoping there would be a method to lock them in position once they are set-up. 
    Thank-you,  John L.

    You have 2 versions of Pages on your Mac and are alternately opening the wrong one.
    Pages 5 is in your Applications folder.
    Pages '09 is in your Applications/iWork folder.
    Pages '09 can not open Pages 5, iOS 7 Pages, Pages for iCloud beta or iCloud files.
    Pages 5 only runs on Mavericks and can not open Pages '08 or earlier files at all and alters/damages Pages '09 files, which once saved can not be opened by anything other than Pages 5.
    Pages 5 files are in an odd compressed bundle, impossible to parse, which won't transfer via non-Apple servers. DropBox may have patched theirs, I haven't checked lately.
    All Pages files, no matter what version or compatibility, have the same file extension: .pages.
    Apple has removed over 110 features from Pages and many of the rest are buggy. They have confused their users and apparently themselves with the installations, upgrades and cross-transfers of files. Effectively Pages 5 files are only compatible with themselves in a very narrow range of hardware and software.
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&mforum=iworktipsn trick
    We are recommending users "upgrade" back to Pages '09 and trash/archive Pages 5 after Exporting their Pages 5 files back to Pages '09 or Word .docx files.
    You should give Apple and other users feedback by rating/reviewing Pages 5 in the App Store.
    Peter

  • How to implement method level authorisation in JSF

    Hi all,
    I am new to JSF 2. I have been able to implement authorization on my web pages, but I also want to implement it at the bean level. Does JSF 2 provide an in-built functionality to implement role-based authorization on bean methods? Or, I need to use some security frameworks (i.e. ACEGI)?
    Thanks in advance,
    Neeraj

    I am curious: can you explain WHY you want method level security? It seems woefully overkill and paranoid to me - server level security should be enough to keep out rogue code.
    Anyway for that level of security, the security measures built into the JVM should be used.
    [Java Security documentation|http://java.sun.com/javase/technologies/security/]
    You can also look into a security API like Spring security - be warned though, it has a steep learning curve.

  • Best method of Locking down computers (theft prevention)

    Our lab was robbed last night of 6 G5s and 7 23" monitors. All computers were locked with cable locks but were obviously cut...very easily.
    Does anyone have any better methods of locking computers down to make it very difficult to remove hardware? These cables broke like strings and our cameras have not been installed yet (they're going in tomorrow).
    We're replacing the computers with all new Mac Pros and screens, any suggestions would help.
    Thanks gang.

    i just installed SMARTreporter and i was wondering how you configured it to send mail?
    Are you saying the thieves are hooked up to the net and SMARTreporter is using their email account or yours? I mean did you check off
    "use the preferences of Mail.app" or
    "use the following SMTP setup" ?
    I ask because i don't use my ISPs email service, but rather the free web-based services and i don't think SMARTreporter could use that.
    John, when you say that your computers emailed you from a queens address, you mean internet address, yes?
    Did the police say that this was going to be useful?
    As far as the undercover software, seems pretty good, especially with their money back guarantee. Makes me want to install it on a used cheaper computer just to follow it with friends, like instead of watching a mystery movie. Especially with the camera phone-homes.
    My only question is, how many computers are resold as is, and how many are 'prepared' for resale, maybe with a clean install of the system, so as to 'cover their tracks'.
    The web site mentions that FBI statistics reveal that 97% of stolen computers are never recovered. We know that 70 to 85% of all crime is related to drugs. Now i would tend to think that those thefts done by addicts in need of cash for an immediate fix don't concern themselves with such questions, but those to whom they sell might. And we know that sometimes things are specifically 'ordered' by fences. That kind of preparation implies more organisation. Maybe more diligence to cover their tracks and knowledge about the systems in question.

  • Record level locking

    Hi Experts,
              I want to lock a table as per ecord level locking . How to go for it?
              Actually the table is being updated with key records simultaneously through different processes.
    Regards,
    Jyoti Shankar

    HI,
    SAP provides you with the ability to restrict access to data while the table is being updated. This is fairly
    simple to implement via the use of a lock object . Create the Lock Object in SE11 for that table, if that already exist then use that one..
    Add the following code in-order to create the table lock. This function module must be called before any
    update takes place. If a lock has already been taken out it will display the appropriate message.
      CALL FUNCTION 'ENQUEUE_EZ_ZTABLENAME'
          EXPORTING
               mode_ZTABLENAME = 'E'
               mandt              = sy-mandt
               KEYFIELD1           = "Value
               KEYFIELD2           = "Value
               KEYFIELD3           = "Value
    *         X_KEYFIELD1            = ' '
    *         X_KEYFIELD2            = ' '
    *         X_KEYFIELD3            = ' '
    *         _SCOPE             = '2'
    *         _WAIT              = ' '
    *         _COLLECT           = ' '
    *   If exceptions are not used, message is displayed within FM
        EXCEPTIONS
             FOREIGN_LOCK       = 1
             SYSTEM_FAILURE     = 2
             OTHERS             = 3.
      IF sy-subrc <> 0.
    *   Retrieve message displayed within Function Module
        message id     sy-msgid
                  type   'I'
                  number sy-msgno
                  with   sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        EXIT.
      ENDIF.
    The following code will remove the lock for the specific table entries.
    CALL FUNCTION 'DEQUEUE_EZ_ZTABLENAME'
        EXPORTING
             MODE_ZTABLENAME = 'E'
             MANDT              = SY-MANDT
               mandt              = sy-mandt
               KEYFIELD1           = "Value
               KEYFIELD2           = "Value
               KEYFIELD3           = "Value
            X_KEYFIELD1            = ' '
            X_KEYFIELD2            = ' '
            X_KEYFIELD3            = ' '
            _SCOPE             = '3'
            _SYNCHRON          = ' '
            _COLLECT           = ' '
    releasing the lock is mandatory,
    See the link for more info.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/7af4c8a79e11d1950f0000e82de14a/content.htm
    Regards
    Sudheer.

  • Detail screen for row level locking

    Hi All ,
    I have developed row level locking for a table , Next requirment is to display the details of each row i another screen when the user click on each row .And if the row which is clicked for display is geyout in first screen then it should be grey in details screen also .If the row is editable in the first screen then it should be in change mode in details screen .
    I appreciate the help and support .
    please provide the answer as soon as possbile .....
    Thanks,
    NJ

    Yes, if a process holds many row level locks on a table, those locks by default can be escalated to partition locks, and, if necessary, table locks.  Unless you are getting and holding many locks on a given table, this will not happen.
    You say you are exporting data.  If all you are doing is selecting from the table (not updating, deleting or inserting data) and you are using the read committed transaction isolation level, you would only hold a lock on a row for the small fraction
    of a second when you are actually reading it.  So you will never have large numbers of locks at one time.  If you are doing large numbers of updates, inserts, or deletes in a singletransaction or if you are doing large numbers of selects in a single
    transaction with the isolation level set to repeatable read or serializable, then it is possible to get enough locks to cause SQL server to escalate to partition or table locks.  This is normally a good thing (that's the reason Microsoft made it the default). 
    To many locks eats up memory.
    However, if you determine this is causing you a problem and you do not want the locks on a particular table ever escalated, you can use the ALTER TABLE SET (LOCK_ESCALATION = DISABLE) command to prevent most cases of lock escalation on a table by table basis. 
    See BOL for a description of the ALTER TABLE command.  However, I would recommend you not use this unless you have determined that lock escalation is causing you problems.  It is very easy to make things worse, not better by doing this.
    Tom

  • "method level" serializable ServerSockets

    i don't understand why this code block can be serialized:
    public class Foo extends Thread implements Serializable {
      public void run() {
        ServerSocket servSok = new ServerSocket(9876);
        Socket sok = servSok.accept();
    }compare with this code block. as expected it cannot serialize (unless transient is used):
    exception code = " +NotSerializableException: java.net.ServerSocket+ "
    public class Foo extends Thread implements Serializable {
      private ServerSocket servSok = null;  // <-- add "transient" and ok.
      public void run() {
        this.servSok = new ServerSocket(9876);
        Socket sok = servSok.accept();
    note: both are live, running, threads when serialized.
    one is an instance level object, the other a method level. but i cannot take my understanding
    beyond that. can someone talk me through what is going on?
    both are bound ServerSockets . neither can pop-up, after de-serialization, bound to a port
    on a remote jvm.

    pdFrog wrote:
    Your misunderstanding is that methods do not get serializedok. i did not know that.
    i think this is why we need the class loaders.Mneh, in a roundabout way, but probably not the way you're thinking. Technically speaking, methods are already serialized, in that their bytecode exists as a stream. But if you're trying to serialize code, not just data, you've probably misunderstood why we serialize. In particular, serializing a Socket connection of any kind is a bit pointless.

  • JDeveloper 11 ignores @SuppressWarnings at method level

    Seems that this only works at class level.
    If you add it at a method level, JDev simply ignores it and continues to display warnings.
    Has anyone found how to get it to work?

    Hi,
    This is the code:
    <snip>
    @SuppressWarnings("unchecked")
    public List<T> findAll(final int... rowStartIdxAndCount)
    return commonPersistence.findAll(getClassName(), rowStartIdxAndCount);
    <snip>
    If I add this annotation to the line just before declaration of the class, it actually works, but becomes reasonably useless as I don't see any other warnings for the class.
    Thanks
    Jonny

  • Generics at method level

    As we all know, in Java5.0, Sun introduced Generics. Now I used this at class level and at field method. However I tried using them at method level, but could not succeced.
    I did a search on the internet and I found a very good article about generics. The url is the following: http://www-128.ibm.com/developerworks/java/library/j-djc02113.html
    Scrolling to the bottom, I found out what I needed. the example on that website shows the following:class Utilities {
       <T extends Object> public static List<T> make(T first) {
         return new List<T>(first);
    }However I tried to do this code in a method inside my project, but did not work at all.
    Does any one know how I can do generics at method level. What I want to achieve is that you pass the class type you want to be returned as a generic at the method level.
    regards,
    sim085

    Please before you check my code, check the example that there is in the article, that is the code I posted in my first post. I based all this on the information I read from the website, and since the source looks very reliable,, there is no need for me to doubt that it works!
    I did a simple example, I am just using generics to get used to them ... Here comes the exampleimport java.util.*;
    public class Test{
         private List<String> myList;
         public Test(){
              myList = new ArrayList<String>();
              <List>normalMethod();
         <T>public T normalMethod(){
              return null;
         <T>public static void staticMethod(){
         public static void main(String... args){
              <List>staticMethod();
              new Test();
    }The exception throws is an exception you would see when the syntax is incorrect. However I do have Java5.0 and if you delete the methods and the method calls, but you leave the generics at the field level , the code would compile.
    The exception throws are the following:C:\Documents and Settings\saquilina\My Documents\Test.java:21: illegal start of type
         <T>public static void staticMethod(){
               ^
    C:\Documents and Settings\saquilina\My Documents\Test.java:32: <identifier> expected
    }Now since in the example in that website they use a static method, I tried it also with a static method, but it did not work all the same :(
    regards,
    sim085

  • Row Level Locking while inserting a record.

    It is a good practice to lock the whole table or do the row level locking while performing any DELETE / UPDATE / MODIFY actions on a database table. Is it necessary to do the same thing while inserting a record via INSERT statement?
    One point may arise if two  users are inserting same records at a same time....
    Well i am little bit confused here bcos if a record doen't exist in a table what is the point of locking it.
    Please help me.

    create a lock object using SE11 for that perticular table and include field names in Lock parameters. Then it will generate two FMs one for locking and another for unlocking.
    Call the lock FM before updating the table and pass that row key value(For fields which taken in lock parameters for creating lock objects) to the exporting parameters.
    Then do the updation.
    Reward if useful...................

  • JAAS method level authorisation

    Hi
    Is it possible to do method level authorisation in java.
    I was under the impression you grant permission at the class level. Can you please inform as to
    how we can grant permissions at method level.
    example :
    class A {
    method1();
    method2();
    can I grant permissions to A.method1() to execute, without having to create an actions class
    with run implemented as required , that is :
    class actionMethod1() implements PrivilegedAction {
    run(){
    A.method1();
    because then I will have to create too many action classes !

    Hi, try this:
    Within method 1 of Class A, do a permission check at the beginning of the method.
    Class A {
    1. public void method1() {
    2. SecurityManger sm = System.getSecurityManager();
    3. if(sm!= null ) {
    4. sm.checkPermission( new XXXPermission() );
    5. }
    6. }
    where XXXPermission is the type of permission that your checking for. If the current thread doesn't have this (XXXPermission) permission, then a SecurityException will be thrown and the rest of the method will not be executed. Alternatively, I believe that the above code (line 2-4) can be replaced with :
    1. AccessController.checkPermission(new XXXPermission());
    I hope this helps. You can also try referring to: http://java.sun.com/j2se/1.4/docs/api/java/security/AccessController.html
    >
    Hi
    Is it possible to do method level authorisation in
    java.
    I was under the impression you grant permission at the
    class level. Can you please inform as to
    how we can grant permissions at method level.
    example :
    class A {
    method1();
    method2();
    can I grant permissions to A.method1() to execute,
    without having to create an actions class
    with run implemented as required , that is :
    class actionMethod1() implements PrivilegedAction {
    run(){
    A.method1();
    because then I will have to create too many action
    classes !

Maybe you are looking for