RRemoteService.getFreeWorkers method added

pull/672/merge
Nikita 8 years ago
parent 349f8bb4bc
commit 0149b05b6f

@ -101,6 +101,12 @@ public class RedissonRemoteService extends BaseRemoteService implements RRemoteS
}
}
@Override
public int getFreeWorkers(Class<?> remoteInterface) {
Set<RFuture<RemoteServiceRequest>> futuresSet = futures.get(remoteInterface);
return futuresSet.size();
}
@Override
public <T> void register(Class<T> remoteInterface, T object, int workers) {
register(remoteInterface, object, workers, commandExecutor.getConnectionManager().getExecutor());

@ -57,6 +57,14 @@ import java.util.concurrent.TimeUnit;
*/
public interface RRemoteService {
/**
* Returns free workers amount available for tasks
*
* @param remoteInterface - remote service interface
* @return workers amount
*/
int getFreeWorkers(Class<?> remoteInterface);
/**
* Register remote service with single worker
*

Loading…
Cancel
Save