Semaphore Configuration

The following are example semaphore configurations.


<semaphore name="semaphore">


Config config = new Config();
SemaphoreConfig semaphoreConfig = config.getSemaphoreConfig();
semaphoreConfig.setName( "semaphore" ).setBackupCount( "1" )
        .setInitialPermits( "3" );

It has below elements.

  • initial-permits: the thread count to which the concurrent access is limited. For example, if you set it to "3", concurrent access to the object is limited to 3 threads.
  • backup-count: Number of synchronous backups.
  • async-backup-count: Number of asynchronous backups.