Package java.util.concurrent

Examples of java.util.concurrent.Semaphore.release()


        epl.endpointAdded((EndpointDescription)EasyMock.anyObject(), (String)EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {

            public Object answer() throws Throwable {
                System.out.println("Call made !!!");
                sema.release();
                return null;
            }
           
        }).once();
View Full Code Here


        ImportReference iref = c.createMock(ImportReference.class);
       
        EasyMock.expect(rsa.importService(EasyMock.eq(epd))).andAnswer(new IAnswer<ImportRegistration>( ) {

            public ImportRegistration answer() throws Throwable {
                sema.release();
                return ireg;
            }
        }).once();
        EasyMock.expect(ireg.getImportReference()).andReturn(iref).anyTimes();
        EasyMock.expect(iref.getImportedEndpoint()).andReturn(epd).anyTimes();
View Full Code Here

          while (true) {
            BlockReader blockReader = null;
            try {
              blockReader = BlockReaderTestUtil.
                  getBlockReader(cluster, lblock, 0, TEST_FILE_LEN);
              sem.release();
              try {
                blockReader.readAll(buf, 0, TEST_FILE_LEN);
              } finally {
                sem.acquireUninterruptibly();
              }
View Full Code Here

              } finally {
                sem.acquireUninterruptibly();
              }
            } catch (ClosedByInterruptException e) {
              LOG.info("got the expected ClosedByInterruptException", e);
              sem.release();
              break;
            } finally {
              if (blockReader != null) blockReader.close();
            }
            LOG.info("read another " + TEST_FILE_LEN + " bytes.");
View Full Code Here

            LOG.info("read another " + TEST_FILE_LEN + " bytes.");
          }
        } catch (Throwable t) {
          LOG.error("getBlockReader failure", t);
          testFailed.set(true);
          sem.release();
        }
      }
    };
    Thread thread = new Thread(readerRunnable);
    thread.start();
View Full Code Here

    // While the thread is reading, send it interrupts.
    // These should trigger a ClosedChannelException.
    while (thread.isAlive()) {
      sem.acquireUninterruptibly();
      thread.interrupt();
      sem.release();
    }
    Assert.assertFalse(testFailed.get());

    // We should be able to read from the file without
    // getting a ClosedChannelException.
View Full Code Here

                }
                catch (IllegalArgumentException iae) {
                    m_log.log(LogService.LOG_ERROR, "Error writing out contents of RepositoryAdminUser", iae);
                    exceptions[0] = iae;
                }
                semaphore.release();
            }
        }.start();
        m_repository.writeLocal(in);
        try {
            if (!semaphore.tryAcquire(30, TimeUnit.SECONDS)) {
View Full Code Here

                    logger.log(Level.WARNING, "Unable to load avatar sample " +
                               "shader. High quality avatars are not available.",
                               ex);
                    out.value = false;
                } finally {
                    done.release();
                }
            }
        });

        try {
View Full Code Here

                     ClientMessage message = consumer.receive(5000);

                     Assert.assertNotNull(message);

                     message.acknowledge();
                     semop.release();
                     if (i % 1000 == 0)
                     {
                        session.commit();
                     }
                  }
View Full Code Here

      Semaphore creationSemaphore = socketCreationMap.get(key);
      if ( sipStack.isLoggingEnabled()) {
              sipStack.getStackLogger().logDebug("leaveIOCriticalSection : " + key);
          }
      if (creationSemaphore != null) {
        creationSemaphore.release();
      }
    }
  }
 
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.