Exemple #1
0
 private Object invokeSyncOperation(
     final String resourceName, final String operationName, final Object... parameters)
     throws Exception {
   ClientMessage message = clientSession.createMessage(false);
   ManagementHelper.putOperationInvocation(message, resourceName, operationName, parameters);
   ClientMessage reply;
   try {
     reply = requestor.request(message, 3000);
   } catch (Exception e) {
     throw new IllegalStateException(
         "Exception while invoking " + operationName + " on " + resourceName, e);
   }
   if (reply == null) {
     throw new IllegalStateException(
         "no reply received when invoking " + operationName + " on " + resourceName);
   }
   if (!ManagementHelper.hasOperationSucceeded(reply)) {
     throw new IllegalStateException(
         "operation failed when invoking "
             + operationName
             + " on "
             + resourceName
             + ": "
             + ManagementHelper.getResult(reply));
   }
   return ManagementHelper.getResult(reply);
 }
Exemple #2
0
  public void stop() throws Exception {
    requestor.close();

    if (sf != null) {
      sf.close();
    }

    if (serverLocator != null) {
      serverLocator.close();
    }

    sf = null;
    serverLocator = null;
  }