Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:33:51+00:00 2026-06-05T16:33:51+00:00

I have a test sample about coherence lock-unlock mechanism like this: public class Test

  • 0

I have a test sample about coherence lock-unlock mechanism like this:

public class Test {


    public static void main(String[] args) throws InterruptedException, IOException, IllegalArgumentException, IllegalAccessException {

        Trt test=new Trt();
        test.lock();
        Thread a=new Thread(test);
        a.start();
    }

    public static class Trt implements Runnable{

        NamedCache cache=null;

        @Override
        public void run() {

            System.out.println(cache.unlock("asd"));


        }

        public void lock(){
            cache= CacheFactory.getCache(Globals.REGISTRY_CACHE_NAME);

            System.out.println(cache.lock("asd"));

        }

    }
}

So the result is:

true
false

The result that I am expecting is:

true
true

But the case is, I have only one item ‘test’, I am all using it and it has only one cache instance in it. So the owner of the cache is that cache instance.

Why is it not able to close it and returns false in the end?

Thanks

Ali

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:33:53+00:00Added an answer on June 5, 2026 at 4:33 pm

    From Oracle Coherence Developer’s Guide:

    When a lock is in place, it is the responsibility of the caller (either in the same thread or the same cluster node, depending on the lease-granularity configuration) to release the lock.

    By default Coherence uses thread ownership granularity, so that is probably the reason lock is not being released.

    A value of thread means that locks are held by a thread that obtained them and can only be released by that thread. A value of member means that locks are held by a cluster node and any thread running on the cluster node that obtained the lock can release it.

    See http://docs.oracle.com/cd/E24290_01/coh.371/e22837/api_transactionslocks.htm#BEIIEEBB and http://docs.oracle.com/cd/E24290_01/coh.371/e22837/appendix_operational.htm#BAGJBCEF for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class
I have the following test sample: <Window x:Class=WpfScrollTest.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=Window1 Height=200 Width=200> <Border>
I have this query: SELECT * FROM sample INNER JOIN test ON sample.sample_number =
I have these (sample) lines in a HTML-file: test.ABC.test test.ABCD.test test.ABCE.test And this Ant
<p title=The test paragraph>This is a sample of some <b>HTML you might<br>have</b> in your
Here is a sample code that I have: void test() { Object1 *obj =
This is some sample test app i trying to learn Parallel.Foreach Loop functionality static
Assume I have a sample source file, test.c, which I am compiling like so:
I have this sample code: struct A { bool test() const { return false;
I have sample site: /index.html /appcache.manifest /style.css /test.js index.html: <!DOCTYPE HTML> <html manifest=appcache.manifest> <head>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.