use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class MultiMapProxyImpl method tryLock.
@Override
public boolean tryLock(@Nonnull K key, long time, TimeUnit timeunit) throws InterruptedException {
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
NodeEngine nodeEngine = getNodeEngine();
Data dataKey = nodeEngine.toData(key);
return lockSupport.tryLock(nodeEngine, dataKey, time, timeunit);
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class MultiMapProxyImpl method containsEntry.
@Override
public boolean containsEntry(@Nonnull K key, @Nonnull V value) {
checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
checkNotNull(value, NULL_VALUE_IS_NOT_ALLOWED);
NodeEngine nodeEngine = getNodeEngine();
Data dataKey = nodeEngine.toData(key);
Data valueKey = nodeEngine.toData(value);
return containsInternal(dataKey, valueKey);
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class ScheduledExecutorServiceProxy method shutdown.
@Override
public void shutdown() {
NodeEngine nodeEngine = getNodeEngine();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
OperationService operationService = nodeEngine.getOperationService();
Collection<Future> calls = new LinkedList<>();
for (Member member : members) {
Operation op = new ShutdownOperation(name);
calls.add(operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress()));
}
waitWithDeadline(calls, SHUTDOWN_TIMEOUT, TimeUnit.SECONDS, shutdownExceptionHandler);
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class SqlServiceImpl method createOptimizer.
/**
* Create either normal or not-implemented optimizer instance.
*
* @param nodeEngine Node engine.
* @return Optimizer.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private SqlOptimizer createOptimizer(NodeEngine nodeEngine, QueryResultRegistry resultRegistry) {
// 1. Resolve class name.
String className = System.getProperty(OPTIMIZER_CLASS_PROPERTY_NAME, SQL_MODULE_OPTIMIZER_CLASS);
// 2. Get the class.
Class clazz;
try {
clazz = Class.forName(className);
} catch (ClassNotFoundException e) {
logger.log(SQL_MODULE_OPTIMIZER_CLASS.equals(className) ? Level.FINE : Level.WARNING, "Optimizer class \"" + className + "\" not found, falling back to " + DisabledSqlOptimizer.class.getName());
return new DisabledSqlOptimizer();
} catch (Exception e) {
throw new HazelcastException("Failed to resolve optimizer class " + className + ": " + e.getMessage(), e);
}
// 3. Get required constructor.
Constructor<SqlOptimizer> constructor;
try {
constructor = clazz.getConstructor(NodeEngine.class, QueryResultRegistry.class);
} catch (ReflectiveOperationException e) {
throw new HazelcastException("Failed to get the constructor for the optimizer class " + className + ": " + e.getMessage(), e);
}
// 4. Finally, get the instance.
try {
return constructor.newInstance(nodeEngine, resultRegistry);
} catch (ReflectiveOperationException e) {
throw new HazelcastException("Failed to instantiate the optimizer class " + className + ": " + e.getMessage(), e);
}
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class PutRemoteTransactionBackupOperation method run.
@Override
public void run() throws Exception {
XAService xaService = getService();
NodeEngine nodeEngine = getNodeEngine();
XATransaction transaction = new XATransaction(nodeEngine, records, txnId, xid, txOwnerUuid, timeoutMillis, startTime);
xaService.putTransaction(transaction);
}
Aggregations