Search in sources :

Example 46 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class PostJoinProxyOperation method run.

@Override
public void run() throws Exception {
    if (proxies == null || proxies.size() <= 0) {
        return;
    }
    NodeEngine nodeEngine = getNodeEngine();
    ProxyServiceImpl proxyService = getService();
    ExecutionService executionService = nodeEngine.getExecutionService();
    for (final ProxyInfo proxy : proxies) {
        final ProxyRegistry registry = proxyService.getOrCreateRegistry(proxy.getServiceName());
        try {
            executionService.execute(ExecutionService.SYSTEM_EXECUTOR, new CreateProxyTask(registry, proxy));
        } catch (Throwable t) {
            logProxyCreationFailure(proxy, t);
        }
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) ProxyInfo(com.hazelcast.spi.impl.proxyservice.impl.ProxyInfo) ProxyRegistry(com.hazelcast.spi.impl.proxyservice.impl.ProxyRegistry) ProxyServiceImpl(com.hazelcast.spi.impl.proxyservice.impl.ProxyServiceImpl) ExecutionService(com.hazelcast.spi.impl.executionservice.ExecutionService)

Example 47 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class XAResourceImpl method finalizeTransactionRemotely.

private void finalizeTransactionRemotely(Xid xid, boolean isCommit) throws XAException {
    NodeEngine nodeEngine = getNodeEngine();
    IPartitionService partitionService = nodeEngine.getPartitionService();
    OperationService operationService = nodeEngine.getOperationService();
    SerializableXID serializableXID = new SerializableXID(xid.getFormatId(), xid.getGlobalTransactionId(), xid.getBranchQualifier());
    Data xidData = nodeEngine.toData(serializableXID);
    int partitionId = partitionService.getPartitionId(xidData);
    FinalizeRemoteTransactionOperation operation = new FinalizeRemoteTransactionOperation(xidData, isCommit);
    InternalCompletableFuture<Integer> future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId);
    Integer errorCode;
    try {
        errorCode = future.get();
    } catch (Exception e) {
        throw ExceptionUtil.rethrow(e);
    }
    if (errorCode != null) {
        throw new XAException(errorCode);
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) XAException(javax.transaction.xa.XAException) IPartitionService(com.hazelcast.internal.partition.IPartitionService) Data(com.hazelcast.internal.serialization.Data) OperationService(com.hazelcast.spi.impl.operationservice.OperationService) FinalizeRemoteTransactionOperation(com.hazelcast.transaction.impl.xa.operations.FinalizeRemoteTransactionOperation) HazelcastInstanceNotActiveException(com.hazelcast.core.HazelcastInstanceNotActiveException) MemberLeftException(com.hazelcast.core.MemberLeftException) TargetNotMemberException(com.hazelcast.spi.exception.TargetNotMemberException) ExecutionException(java.util.concurrent.ExecutionException) XAException(javax.transaction.xa.XAException)

Example 48 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class CollectRemoteTransactionsOperation method run.

@Override
public void run() throws Exception {
    XAService xaService = getService();
    NodeEngine nodeEngine = getNodeEngine();
    Set<SerializableXID> xids = xaService.getPreparedXids();
    List<Data> xidSet = new ArrayList<Data>();
    for (SerializableXID xid : xids) {
        xidSet.add(nodeEngine.toData(xid));
    }
    this.xidSet = new SerializableList(xidSet);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) XAService(com.hazelcast.transaction.impl.xa.XAService) SerializableXID(com.hazelcast.transaction.impl.xa.SerializableXID) SerializableList(com.hazelcast.spi.impl.SerializableList) ArrayList(java.util.ArrayList) Data(com.hazelcast.internal.serialization.Data)

Example 49 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class PutRemoteTransactionOperation 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);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) XAService(com.hazelcast.transaction.impl.xa.XAService) XATransaction(com.hazelcast.transaction.impl.xa.XATransaction)

Example 50 with NodeEngine

use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.

the class CacheRecordStoreTestSupport method createCacheRecordStore.

protected ICacheRecordStore createCacheRecordStore(HazelcastInstance instance, String cacheName, int partitionId, InMemoryFormat inMemoryFormat) {
    NodeEngine nodeEngine = getNodeEngineImpl(instance);
    ICacheService cacheService = getCacheService(instance);
    CacheConfig cacheConfig = createCacheConfig(cacheName, inMemoryFormat);
    cacheService.putCacheConfigIfAbsent(cacheConfig);
    return new CacheRecordStore(CACHE_NAME_PREFIX + cacheName, partitionId, nodeEngine, (AbstractCacheService) cacheService);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) ICacheRecordStore(com.hazelcast.cache.impl.ICacheRecordStore) CacheRecordStore(com.hazelcast.cache.impl.CacheRecordStore) ICacheService(com.hazelcast.cache.impl.ICacheService) CacheConfig(com.hazelcast.config.CacheConfig)

Aggregations

NodeEngine (com.hazelcast.spi.impl.NodeEngine)165 Data (com.hazelcast.internal.serialization.Data)48 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)30 Address (com.hazelcast.cluster.Address)22 Test (org.junit.Test)21 ILogger (com.hazelcast.logging.ILogger)20 HazelcastInstance (com.hazelcast.core.HazelcastInstance)18 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)18 QuickTest (com.hazelcast.test.annotation.QuickTest)18 Config (com.hazelcast.config.Config)17 Operation (com.hazelcast.spi.impl.operationservice.Operation)16 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)15 IPartitionService (com.hazelcast.internal.partition.IPartitionService)12 Nonnull (javax.annotation.Nonnull)12 ArrayList (java.util.ArrayList)11 Future (java.util.concurrent.Future)11 Member (com.hazelcast.cluster.Member)10 UUID (java.util.UUID)10 InitializingObject (com.hazelcast.spi.impl.InitializingObject)9 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)9