use of org.apache.geode.cache.client.ServerConnectivityException in project geode by apache.
the class ClientTypeRegistration method addImportedEnum.
@Override
public void addImportedEnum(int enumId, EnumInfo importedInfo) {
Collection<Pool> pools = getAllPools();
ServerConnectivityException lastException = null;
for (Pool pool : pools) {
try {
sendEnumIdToPool(importedInfo, enumId, pool);
} catch (ServerConnectivityException e) {
lastException = e;
break;
}
}
if (lastException == null) {
return;
}
throw returnCorrectExceptionForFailure(pools, enumId, lastException);
}
use of org.apache.geode.cache.client.ServerConnectivityException in project geode by apache.
the class ServerFunctionExecutor method executeOnServer.
private ResultCollector executeOnServer(Function function, ResultCollector rc, byte hasResult) {
FunctionStats stats = FunctionStats.getFunctionStats(function.getId());
try {
validateExecution(function, null);
long start = stats.startTime();
stats.startFunctionExecution(true);
ExecuteFunctionOp.execute(this.pool, function, this, args, memberMappedArg, this.allServers, hasResult, rc, this.isFnSerializationReqd, UserAttributes.userAttributes.get(), groups);
stats.endFunctionExecution(start, true);
rc.endResults();
return rc;
} catch (FunctionException functionException) {
stats.endFunctionExecutionWithException(true);
throw functionException;
} catch (ServerConnectivityException exception) {
throw exception;
} catch (Exception exception) {
stats.endFunctionExecutionWithException(true);
throw new FunctionException(exception);
}
}
use of org.apache.geode.cache.client.ServerConnectivityException in project geode by apache.
the class ServerFunctionExecutor method executeOnServerNoAck.
private void executeOnServerNoAck(String functionId, byte hasResult, boolean isHA, boolean optimizeForWrite) {
FunctionStats stats = FunctionStats.getFunctionStats(functionId);
try {
validateExecution(null, null);
long start = stats.startTime();
stats.startFunctionExecution(false);
ExecuteFunctionNoAckOp.execute(this.pool, functionId, args, memberMappedArg, this.allServers, hasResult, this.isFnSerializationReqd, isHA, optimizeForWrite, groups);
stats.endFunctionExecution(start, false);
} catch (FunctionException functionException) {
stats.endFunctionExecutionWithException(false);
throw functionException;
} catch (ServerConnectivityException exception) {
throw exception;
} catch (Exception exception) {
stats.endFunctionExecutionWithException(false);
throw new FunctionException(exception);
}
}
use of org.apache.geode.cache.client.ServerConnectivityException in project geode by apache.
the class OpExecutorImplJUnitTest method testExecuteOncePerServer.
@Test
public void testExecuteOncePerServer() throws Exception {
OpExecutorImpl exec = new OpExecutorImpl(manager, queueManager, endpointManager, riTracker, -1, 10, false, cancelCriterion, null);
manager.numServers = 5;
try {
exec.execute(new Op() {
@Override
public Object attempt(Connection cnx) throws Exception {
throw new IOException("Something didn't work");
}
@Override
public boolean useThreadLocalConnection() {
return true;
}
});
fail("Should have got an exception");
} catch (ServerConnectivityException expected) {
// do nothing
}
assertEquals(1, borrows);
assertEquals(4, exchanges);
assertEquals(1, returns);
assertEquals(6, invalidateConnections);
assertEquals(6, serverCrashes);
}
use of org.apache.geode.cache.client.ServerConnectivityException in project geode by apache.
the class OpExecutorImplJUnitTest method testRetryFailedServers.
@Test
public void testRetryFailedServers() throws Exception {
OpExecutorImpl exec = new OpExecutorImpl(manager, queueManager, endpointManager, riTracker, 10, 10, false, cancelCriterion, null);
manager.numServers = 5;
try {
exec.execute(new Op() {
@Override
public Object attempt(Connection cnx) throws Exception {
throw new IOException("Something didn't work");
}
@Override
public boolean useThreadLocalConnection() {
return true;
}
});
fail("Should have got an exception");
} catch (ServerConnectivityException expected) {
// do nothing
}
assertEquals(1, borrows);
assertEquals(10, exchanges);
assertEquals(1, returns);
assertEquals(11, invalidateConnections);
assertEquals(11, serverCrashes);
}
Aggregations