use of org.apache.geode.GemFireException in project geode by apache.
the class RebalanceOperationImpl method getResults.
public RebalanceResults getResults() throws CancellationException, InterruptedException {
RebalanceResultsImpl results = new RebalanceResultsImpl();
List<Future<RebalanceResults>> frlist = getFutureList();
for (Future<RebalanceResults> fr : frlist) {
try {
RebalanceResults rr = fr.get();
results.addDetails((RebalanceResultsImpl) rr);
} catch (ExecutionException e) {
if (e.getCause() instanceof GemFireException) {
throw (GemFireException) e.getCause();
} else if (e.getCause() instanceof InternalGemFireError) {
throw (InternalGemFireError) e.getCause();
} else {
throw new InternalGemFireError(e.getCause());
}
}
}
return results;
}
use of org.apache.geode.GemFireException in project geode by apache.
the class RebalanceOperationImpl method getResults.
public RebalanceResults getResults(long timeout, TimeUnit unit) throws CancellationException, TimeoutException, InterruptedException {
long endTime = unit.toNanos(timeout) + System.nanoTime();
RebalanceResultsImpl results = new RebalanceResultsImpl();
List<Future<RebalanceResults>> frlist = getFutureList();
for (Future<RebalanceResults> fr : frlist) {
try {
long waitTime = endTime - System.nanoTime();
RebalanceResults rr = fr.get(waitTime, TimeUnit.NANOSECONDS);
results.addDetails((RebalanceResultsImpl) rr);
} catch (ExecutionException e) {
if (e.getCause() instanceof GemFireException) {
throw (GemFireException) e.getCause();
} else if (e.getCause() instanceof InternalGemFireError) {
throw (InternalGemFireError) e.getCause();
} else {
throw new InternalGemFireError(e.getCause());
}
}
}
return results;
}
use of org.apache.geode.GemFireException in project geode by apache.
the class AbstractGatewaySenderEventProcessor method setRunningStatus.
public void setRunningStatus() throws Exception {
GemFireException ex = null;
try {
this.initializeEventDispatcher();
} catch (GemFireException e) {
ex = e;
}
synchronized (this.runningStateLock) {
if (ex != null) {
this.setException(ex);
setIsStopped(true);
} else {
setIsStopped(false);
}
this.runningStateLock.notifyAll();
}
if (ex != null) {
throw ex;
}
}
use of org.apache.geode.GemFireException in project geode by apache.
the class JdkToolTest method testGetJdkToolPathnameForNonExistingTool.
@Test
public void testGetJdkToolPathnameForNonExistingTool() {
try {
final GemFireException expected = new GemFireException() {
@Override
public String getMessage() {
return "expected";
}
};
JdkTool.getJdkToolPathname("nonExistingTool.exe", expected);
} catch (GemFireException expected) {
assertEquals("expected", expected.getMessage());
}
}
use of org.apache.geode.GemFireException in project geode by apache.
the class StartJConsoleCommand method startJConsole.
@CliCommand(value = CliStrings.START_JCONSOLE, help = CliStrings.START_JCONSOLE__HELP)
@CliMetaData(shellOnly = true, relatedTopic = { CliStrings.TOPIC_GEODE_MANAGER, CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_M_AND_M })
public Result startJConsole(@CliOption(key = CliStrings.START_JCONSOLE__INTERVAL, unspecifiedDefaultValue = "4", help = CliStrings.START_JCONSOLE__INTERVAL__HELP) final int interval, @CliOption(key = CliStrings.START_JCONSOLE__NOTILE, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = CliStrings.START_JCONSOLE__NOTILE__HELP) final boolean notile, @CliOption(key = CliStrings.START_JCONSOLE__PLUGINPATH, help = CliStrings.START_JCONSOLE__PLUGINPATH__HELP) final String pluginpath, @CliOption(key = CliStrings.START_JCONSOLE__VERSION, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = CliStrings.START_JCONSOLE__VERSION__HELP) final boolean version, @CliOption(key = CliStrings.START_JCONSOLE__J, optionContext = GfshParser.J_OPTION_CONTEXT, help = CliStrings.START_JCONSOLE__J__HELP) final String[] jvmArgs) {
try {
String[] jconsoleCommandLine = createJConsoleCommandLine(null, interval, notile, pluginpath, version, jvmArgs);
if (isDebugging()) {
getGfsh().printAsInfo(String.format("JConsole command-line ($1%s)", Arrays.toString(jconsoleCommandLine)));
}
Process jconsoleProcess = Runtime.getRuntime().exec(jconsoleCommandLine);
StringBuilder message = new StringBuilder();
if (version) {
jconsoleProcess.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(jconsoleProcess.getErrorStream()));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
message.append(line);
message.append(StringUtils.LINE_SEPARATOR);
}
IOUtils.close(reader);
} else {
getGfsh().printAsInfo(CliStrings.START_JCONSOLE__RUN);
String jconsoleProcessOutput = waitAndCaptureProcessStandardErrorStream(jconsoleProcess);
if (StringUtils.isNotBlank(jconsoleProcessOutput)) {
message.append(StringUtils.LINE_SEPARATOR);
message.append(jconsoleProcessOutput);
}
}
return ResultBuilder.createInfoResult(message.toString());
} catch (GemFireException | IllegalStateException | IllegalArgumentException e) {
return ResultBuilder.createShellClientErrorResult(e.getMessage());
} catch (IOException e) {
return ResultBuilder.createShellClientErrorResult(CliStrings.START_JCONSOLE__IO_EXCEPTION_MESSAGE);
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
throw e;
} catch (Throwable t) {
SystemFailure.checkFailure();
return ResultBuilder.createShellClientErrorResult(String.format(CliStrings.START_JCONSOLE__CATCH_ALL_ERROR_MESSAGE, toString(t, false)));
}
}
Aggregations