Package com.hazelcast.core

Examples of com.hazelcast.core.ILock.lock()


        try {
            String memberAddr = event.getMember().getInetSocketAddress().toString();
            if (endpointOwners.containsKey(memberAddr)) {
                synchronized (shutdownMutex) {
                    ILock lock = hazelcastInstance.getLock("EndpointOwners/" + memberAddr);
                    lock.lock();
                    try {
                        if (endpointOwners.containsKey(memberAddr)) {
                            Collection<String> keys = endpointOwners.remove(memberAddr);
                            for (Object k : keys) {
                                Endpoint endpoint = (Endpoint)endpointMap.remove(k);
View Full Code Here


        try {
            String memberAddr = event.getMember().getInetSocketAddress().toString();
            if (endpointOwners.containsKey(memberAddr)) {
                synchronized (shutdownMutex) {
                    ILock lock = hazelcastInstance.getLock("EndpointOwners/" + memberAddr);
                    lock.lock();
                    try {
                        if (endpointOwners.containsKey(memberAddr)) {
                            Collection<String> keys = endpointOwners.remove(memberAddr);
                            for (Object k : keys) {
                                endpointMap.remove(k);
View Full Code Here

        try {
            String memberAddr = event.getMember().getInetSocketAddress().toString();
            if (endpointOwners.containsKey(memberAddr)) {
                synchronized (shutdownMutex) {
                    ILock lock = hazelcastInstance.getLock("EndpointOwners/" + memberAddr);
                    lock.lock();
                    try {
                        if (endpointOwners.containsKey(memberAddr)) {
                            Collection<String> keys = endpointOwners.remove(memberAddr);
                            for (Object k : keys) {
                                Endpoint endpoint = (Endpoint)endpointMap.remove(k);
View Full Code Here

    public void run()
    {
      logger.info(threadName+"   ---   Acquiring lock ...");
      ILock lock = Hazelcast.getLock(lockName);
      lock.unlock();
      lock.lock();
      lock.lock();
      logger.info(threadName+"   ---   Acquired lock.");
      logger.info(threadName+"   ---   Waiting: "+waitTime);
      try
      {
View Full Code Here

    {
      logger.info(threadName+"   ---   Acquiring lock ...");
      ILock lock = Hazelcast.getLock(lockName);
      lock.unlock();
      lock.lock();
      lock.lock();
      logger.info(threadName+"   ---   Acquired lock.");
      logger.info(threadName+"   ---   Waiting: "+waitTime);
      try
      {
        Thread.sleep(waitTime);
View Full Code Here

        try {
            String memberAddr = event.getMember().getInetSocketAddress().toString();
            if (endpointOwners.containsKey(memberAddr)) {
                synchronized (shutdownMutex) {
                    ILock lock = hazelcastInstance.getLock("EndpointOwners/" + memberAddr);
                    lock.lock();
                    try {
                        if (endpointOwners.containsKey(memberAddr)) {
                            Collection<String> keys = endpointOwners.remove(memberAddr);
                            for (Object k : keys) {
                                endpointMap.remove(k);
View Full Code Here

        try {
            String memberAddr = event.getMember().getInetSocketAddress().toString();
            if (endpointOwners.containsKey(memberAddr)) {
                synchronized (shutdownMutex) {
                    ILock lock = hazelcastInstance.getLock("EndpointOwners/" + memberAddr);
                    lock.lock();
                    try {
                        if (endpointOwners.containsKey(memberAddr)) {
                            Collection<String> keys = endpointOwners.remove(memberAddr);
                            for (Object k : keys) {
                                endpointMap.remove(k);
View Full Code Here

    @Test(expected = NullPointerException.class, timeout = 60000)
    public void testLockLeaseTime_whenNullTimeout() {
        final HazelcastInstance instance = createHazelcastInstance();
        final ILock lock = instance.getLock(randomString());

        lock.lock(1000, null);
    }

    @Test(timeout = 60000)
    public void testLockLeaseTime_whenLockFree() {
        final HazelcastInstance instance = createHazelcastInstance();
View Full Code Here

    @Test(timeout = 60000)
    public void testLockLeaseTime_whenLockFree() {
        final HazelcastInstance instance = createHazelcastInstance();
        final ILock lock = instance.getLock(randomString());

        lock.lock(1000, TimeUnit.MILLISECONDS);
    }

    @Test(timeout = 60000)
    public void testLockLeaseTime_whenLockAcquiredByOther() throws InterruptedException {
        final HazelcastInstance instance = createHazelcastInstance();
View Full Code Here

        final CountDownLatch latch0 = new CountDownLatch(1);
        final CountDownLatch latch = new CountDownLatch(1);

        new Thread() {
            public void run() {
                lock.lock();
                latch0.countDown();
                sleepMillis(500);
                lock.unlock();
            }
        }.start();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.