use of java.rmi.ServerException in project cloudstack by apache.
the class CreateLunCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
CreateLunCmdResponse response = new CreateLunCmdResponse();
String[] returnVals = null;
returnVals = netappMgr.createLunOnFiler(getPoolName(), getLunSize());
response.setPath(returnVals[0]);
response.setIqn(returnVals[1]);
response.setIpAddress(returnVals[2]);
response.setObjectName("lun");
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (ServerException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
}
}
use of java.rmi.ServerException in project cloudstack by apache.
the class CreateVolumeOnFilerCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
//param checks
if (snapshotReservation != null && (snapshotReservation < 0 || snapshotReservation > 100))
throw new InvalidParameterValueException("Invalid snapshot reservation");
StringBuilder s = new StringBuilder(getVolSize().toString());
s.append("g");
try {
netappMgr.createVolumeOnFiler(ipAddress, aggrName, poolName, volName, s.toString(), snapshotPolicy, snapshotReservation, userName, password);
CreateVolumeOnFilerCmdResponse response = new CreateVolumeOnFilerCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (ServerException e) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString());
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (UnknownHostException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
}
}
use of java.rmi.ServerException in project cloudstack by apache.
the class DestroyLunCmd method execute.
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
netappMgr.destroyLunOnFiler(path);
DeleteLUNCmdResponse response = new DeleteLUNCmdResponse();
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException e) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString());
} catch (ServerException e) {
throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString());
}
}
use of java.rmi.ServerException in project geode by apache.
the class PRClientServerRegionFunctionExecutionNoSingleHopDUnitTest method executeFunction.
public static void executeFunction() throws ServerException, InterruptedException {
Region region = cache.getRegion(PartitionedRegionName);
assertNotNull(region);
final HashSet testKeysSet = new HashSet();
for (int i = (totalNumBuckets.intValue() * 10); i > 0; i--) {
testKeysSet.add("execKey-" + i);
}
DistributedSystem.setThreadsSocketPolicy(false);
Function function = new TestFunction(true, TEST_FUNCTION2);
FunctionService.registerFunction(function);
Execution dataSet = FunctionService.onRegion(region);
try {
ResultCollector rc1 = dataSet.withFilter(testKeysSet).setArguments(Boolean.TRUE).execute(function.getId());
HashMap resultMap = ((HashMap) rc1.getResult());
assertEquals(3, resultMap.size());
Iterator mapIterator = resultMap.entrySet().iterator();
Map.Entry entry = null;
DistributedMember key = null;
ArrayList resultListForMember = null;
while (mapIterator.hasNext()) {
entry = (Map.Entry) mapIterator.next();
key = (DistributedMember) entry.getKey();
resultListForMember = (ArrayList) entry.getValue();
for (Object result : resultListForMember) {
assertEquals(Boolean.TRUE, result);
}
}
} catch (Exception e) {
LogWriterUtils.getLogWriter().info("Got an exception : " + e.getMessage());
assertTrue(e instanceof EOFException || e instanceof SocketException || e instanceof SocketTimeoutException || e instanceof ServerException || e instanceof IOException || e instanceof CacheClosedException);
}
}
use of java.rmi.ServerException in project adempiere by adempiere.
the class CLogFormatter method fillExceptionTrace.
// getException
/**
* Fill Exception Trace
* @param sb string buffer
* @param hdr header
* @param thrown thrown
*/
private static void fillExceptionTrace(StringBuffer sb, String hdr, Throwable thrown) {
boolean firstError = hdr.length() == 0;
sb.append(hdr).append(thrown.toString());
if (thrown instanceof SQLException) {
SQLException ex = (SQLException) thrown;
sb.append("; State=").append(ex.getSQLState()).append("; ErrorCode=").append(ex.getErrorCode());
}
sb.append(NL);
//
StackTraceElement[] trace = thrown.getStackTrace();
boolean adempiereTrace = false;
int adempiereTraceNo = 0;
for (int i = 0; i < trace.length; i++) {
adempiereTrace = trace[i].getClassName().startsWith("org.compiere.");
if (// RMI
thrown instanceof ServerException || adempiereTrace) {
if (adempiereTrace)
sb.append("\tat ").append(trace[i]).append(NL);
} else if (i > 20 || (i > 10 && adempiereTraceNo > 8))
break;
else
sb.append("\tat ").append(trace[i]).append(NL);
if (adempiereTrace)
adempiereTraceNo++;
}
//
Throwable cause = thrown.getCause();
if (cause != null)
fillExceptionTrace(sb, "caused by: ", cause);
}
Aggregations