curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sznajder ForMailingList <bs4mailingl...@gmail.com>
Subject Usage of semaphore
Date Thu, 09 Jan 2014 14:50:22 GMT
Hi

I need to allow the access to a shared resource only MAX_CON times.

It sounds natural to use the semaphore for that.

However, something is not clear to me in the API.

What is the difference between the two constructors:

public InterProcessSemaphoreV2(CuratorFramework
<http://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFramework.html>
client,
                       String
<http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true>
path,
                       int maxLeases)

public InterProcessSemaphoreV2(CuratorFramework
<http://curator.apache.org/apidocs/org/apache/curator/framework/CuratorFramework.html>
client,
                       String
<http://docs.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true>
path,
                       SharedCountReader
<http://curator.apache.org/apidocs/org/apache/curator/framework/recipes/shared/SharedCountReader.html>
count)



And especially, with the second constructor signature, how do I define
the maxLeases value? How can I limit the access to be only MAX_CONN?

Many thanks

Benjamin

Mime
View raw message