@Override public Throwable createException(String message, Throwable cause) { return new TransactionTimedOutException(message, cause); } });
@Override public Throwable createException(String message, Throwable cause) { return new TransactionTimedOutException(message, cause); } });
@Override public void handleException(Throwable throwable) { if (throwable instanceof TimeoutException) { throw new TransactionTimedOutException(throwable); } throw ExceptionUtil.rethrow(throwable); } };
@Override public void handleException(Throwable throwable) { if (throwable instanceof TimeoutException) { throw new TransactionTimedOutException(throwable); } throw ExceptionUtil.rethrow(throwable); } };
@Override public void handleException(Throwable throwable) { if (throwable instanceof TimeoutException) { throw new TransactionTimedOutException(throwable); } if (throwable instanceof MemberLeftException) { logger.warning("Member left while replicating tx begin: " + throwable); return; } if (throwable instanceof ExecutionException) { Throwable cause = throwable.getCause(); if (cause instanceof TargetNotMemberException || cause instanceof HazelcastInstanceNotActiveException) { logger.warning("Member left while replicating tx begin: " + cause); return; } } throw ExceptionUtil.rethrow(throwable); } };
@Override public void handleException(Throwable throwable) { if (throwable instanceof TimeoutException) { throw new TransactionTimedOutException(throwable); } if (throwable instanceof MemberLeftException) { logger.warning("Member left while replicating tx begin: " + throwable); return; } if (throwable instanceof ExecutionException) { Throwable cause = throwable.getCause(); if (cause instanceof TargetNotMemberException || cause instanceof HazelcastInstanceNotActiveException) { logger.warning("Member left while replicating tx begin: " + cause); return; } } throw ExceptionUtil.rethrow(throwable); } };
private VersionedValue lockAndGet(Data key, long timeout, boolean shouldLoad) { VersionedValue versionedValue = valueMap.get(key); if (versionedValue != null) { return versionedValue; } boolean blockReads = tx.getTransactionType() == TransactionType.ONE_PHASE; MapOperation operation = operationProvider.createTxnLockAndGetOperation(name, key, timeout, timeout, tx.getOwnerUuid(), shouldLoad, blockReads); operation.setThreadId(ThreadUtil.getThreadId()); try { int partitionId = partitionService.getPartitionId(key); Future<VersionedValue> future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId); versionedValue = future.get(); if (versionedValue == null) { throw new TransactionTimedOutException("Transaction couldn't obtain lock for the key: " + toObjectIfNeeded(key)); } valueMap.put(key, versionedValue); return versionedValue; } catch (Throwable t) { throw rethrow(t); } }
private VersionedValue lockAndGet(Data key, long timeout, boolean shouldLoad) { VersionedValue versionedValue = valueMap.get(key); if (versionedValue != null) { return versionedValue; } boolean blockReads = tx.getTransactionType() == TransactionType.ONE_PHASE; MapOperation operation = operationProvider.createTxnLockAndGetOperation(name, key, timeout, timeout, tx.getOwnerUuid(), shouldLoad, blockReads); operation.setThreadId(ThreadUtil.getThreadId()); try { int partitionId = partitionService.getPartitionId(key); Future<VersionedValue> future = operationService.invokeOnPartition(SERVICE_NAME, operation, partitionId); versionedValue = future.get(); if (versionedValue == null) { throw new TransactionTimedOutException("Transaction couldn't obtain lock for the key: " + toObjectIfNeeded(key)); } valueMap.put(key, versionedValue); return versionedValue; } catch (Throwable t) { throw rethrow(t); } }