Search in sources :

Example 6 with SemaphoreContainer

use of com.hazelcast.concurrent.semaphore.SemaphoreContainer in project hazelcast by hazelcast.

the class ReduceOperation method run.

@Override
public void run() throws Exception {
    SemaphoreContainer semaphoreContainer = getSemaphoreContainer();
    response = semaphoreContainer.reduce(permitCount);
}
Also used : SemaphoreContainer(com.hazelcast.concurrent.semaphore.SemaphoreContainer)

Example 7 with SemaphoreContainer

use of com.hazelcast.concurrent.semaphore.SemaphoreContainer in project hazelcast by hazelcast.

the class SemaphoreDetachMemberOperation method run.

@Override
public void run() throws Exception {
    SemaphoreService service = getService();
    if (service.containsSemaphore(name)) {
        SemaphoreContainer semaphoreContainer = service.getSemaphoreContainer(name);
        response = semaphoreContainer.detachAll(detachedMemberUuid);
    }
    ILogger logger = getLogger();
    if (logger.isFineEnabled()) {
        logger.fine("Removing permits attached to " + detachedMemberUuid + ". Result: " + response);
    }
}
Also used : SemaphoreContainer(com.hazelcast.concurrent.semaphore.SemaphoreContainer) SemaphoreService(com.hazelcast.concurrent.semaphore.SemaphoreService) ILogger(com.hazelcast.logging.ILogger)

Example 8 with SemaphoreContainer

use of com.hazelcast.concurrent.semaphore.SemaphoreContainer in project hazelcast by hazelcast.

the class SemaphoreReplicationOperation method writeInternal.

@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
    out.writeInt(migrationData.size());
    for (Map.Entry<String, SemaphoreContainer> entry : migrationData.entrySet()) {
        String key = entry.getKey();
        SemaphoreContainer value = entry.getValue();
        out.writeUTF(key);
        value.writeData(out);
    }
}
Also used : SemaphoreContainer(com.hazelcast.concurrent.semaphore.SemaphoreContainer) Map(java.util.Map) HashMap(java.util.HashMap)

Example 9 with SemaphoreContainer

use of com.hazelcast.concurrent.semaphore.SemaphoreContainer in project hazelcast by hazelcast.

the class SemaphoreReplicationOperation method run.

@Override
public void run() throws Exception {
    SemaphoreService service = getService();
    for (SemaphoreContainer semaphoreContainer : migrationData.values()) {
        semaphoreContainer.setInitialized();
    }
    service.insertMigrationData(migrationData);
}
Also used : SemaphoreContainer(com.hazelcast.concurrent.semaphore.SemaphoreContainer) SemaphoreService(com.hazelcast.concurrent.semaphore.SemaphoreService)

Example 10 with SemaphoreContainer

use of com.hazelcast.concurrent.semaphore.SemaphoreContainer in project hazelcast by hazelcast.

the class InitBackupOperation method run.

@Override
public void run() throws Exception {
    SemaphoreContainer semaphoreContainer = getSemaphoreContainer();
    semaphoreContainer.init(permitCount);
    response = true;
}
Also used : SemaphoreContainer(com.hazelcast.concurrent.semaphore.SemaphoreContainer)

Aggregations

SemaphoreContainer (com.hazelcast.concurrent.semaphore.SemaphoreContainer)16 SemaphoreService (com.hazelcast.concurrent.semaphore.SemaphoreService)3 ILogger (com.hazelcast.logging.ILogger)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1