congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
MethodCall
Code IndexAdd Tabnine to your IDE (free)

How to use
MethodCall
in
org.jgroups.blocks

Best Java code snippets using org.jgroups.blocks.MethodCall (Showing top 20 results out of 315)

origin: wildfly/wildfly

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  try {
    MethodCall call=new MethodCall(CLEAR);
    disp.callRemoteMethods(null, call, call_options);
  }
  catch(Exception e) {
    throw new RuntimeException("clear() failed", e);
  }
}
origin: wildfly/wildfly

Method method=MethodCall.findMethod(target.getClass(), method_name, args);
if(method == null) {
  if(prot instanceof AdditionalJmxObjects) {
    for(Object obj: ((AdditionalJmxObjects)prot).getJmxObjects()) {
      method=MethodCall.findMethod(obj.getClass(), method_name, args);
      if(method != null) {
        target=obj;
MethodCall call=new MethodCall(method);
Object[] converted_args=null;
if(args != null) {
    converted_args[i]=Util.convert(args[i], types[i]);
Object retval=call.invoke(target, converted_args);
if(retval != null)
  map.put(prot_name + "." + method_name, retval.toString());
origin: wildfly/wildfly

/**
 * Returns the first method that matches the specified name and parameter types. The overriding methods have priority.
 * The method is chosen from all the methods of the current class and all its superclasses and superinterfaces.
 * @return the matching method or null if no matching method has been found.
 */
protected static Method getMethod(Class target, String methodName, Class[] types) {
  if(types == null)
    types=new Class[0];
  Method[] methods = getAllMethods(target);
  methods: for(int i = 0; i < methods.length; i++) {
    Method m= methods[i];
    if(!methodName.equals(m.getName()))
      continue;
    Class[] parameters = m.getParameterTypes();
    if (types.length != parameters.length) {
      continue;
    }
    for(int j = 0; j < types.length; j++) {
      if(!parameters[j].isAssignableFrom(types[j])) {
        continue methods;
      }
    }
    return m;
  }
  return null;
}
origin: wildfly/wildfly

protected static MethodCall methodCallFromBuffer(final byte[] buf, int offset, int length, Marshaller marshaller) throws Exception {
  ByteArrayDataInputStream in=new ByteArrayDataInputStream(buf, offset, length);
  MethodCall call=new MethodCall();
  call.readFrom(in, marshaller);
  return call;
}
origin: wildfly/wildfly

/** Called by the ProbeHandler impl. All args are strings. Needs to find a method where all parameter
 * types are primitive types, so the strings can be converted */
public static Method findMethod(Class target_class, String method_name, Object[] args) throws Exception {
  int len=args != null? args.length : 0;
  Method retval=null;
  Method[] methods=getAllMethods(target_class);
  for(int i=0; i < methods.length; i++) {
    Method m=methods[i];
    if(m.getName().equals(method_name)) {
      Class<?>[] parameter_types=m.getParameterTypes();
      if(parameter_types.length == len) {
        retval=m;
        // now check if all parameter types are primitive types:
        boolean all_primitive=true;
        for(Class<?> parameter_type: parameter_types) {
          if(!isPrimitiveType(parameter_type)) {
            all_primitive=false;
            break;
          }
        }
        if(all_primitive)
          return m;
      }
    }
  }
  return retval;
}
origin: wildfly/wildfly

protected static Buffer methodCallToBuffer(final MethodCall call, Marshaller marshaller) throws Exception {
  Object[] args=call.args();
  int estimated_size=64;
  if(args != null)
    for(Object arg: args)
      estimated_size+=marshaller != null? marshaller.estimatedSize(arg) : (arg == null? 2 : 50);
  ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(estimated_size, true);
  call.writeTo(out, marshaller);
  return out.getBuffer();
}
origin: org.jboss.as/jboss-as-clustering-impl

@SuppressWarnings("unchecked")
<T> T invokeDirectly(String serviceName, String methodName, Object[] args, Class<?>[] types, List<T> remoteResponses, ResponseFilter filter) throws Exception {
  T retVal = null;
  Object handler = this.rpcHandlers.get(serviceName);
  if (handler != null) {
    MethodCall call = new MethodCall(methodName, args, types);
    try {
      Object result = call.invoke(handler);
      retVal = (T) result;
      if (remoteResponses != null && (filter == null || filter.isAcceptable(retVal, me))) {
        remoteResponses.add(retVal);
      }
    } catch (Exception e) {
      throw e;
    } catch (Error e) {
      throw e;
    } catch (Throwable e) {
      throw new RuntimeException(e);
    }
  }
  return retVal;
}
origin: wildfly/wildfly

/**
 * Message contains MethodCall. Execute it against *this* object and return result.
 * Use MethodCall.invoke() to do this. Return result.
 */
public Object handle(Message req) throws Exception {
  if(server_obj == null) {
    log.error(Util.getMessage("NoMethodHandlerIsRegisteredDiscardingRequest"));
    return null;
  }
  if(req == null || req.getLength() == 0) {
    log.error(Util.getMessage("MessageOrMessageBufferIsNull"));
    return null;
  }
  MethodCall method_call=methodCallFromBuffer(req.getRawBuffer(), req.getOffset(), req.getLength(), marshaller);
  if(log.isTraceEnabled())
    log.trace("[sender=%s], method_call: %s", req.getSrc(), method_call);
  if(method_call.mode() == MethodCall.ID) {
    if(method_lookup == null)
      throw new Exception(String.format("MethodCall uses ID=%d, but method_lookup has not been set", method_call.methodId()));
    Method m=method_lookup.findMethod(method_call.methodId());
    if(m == null)
      throw new Exception("no method found for " + method_call.methodId());
    method_call.method(m);
  }
    
  return method_call.invoke(server_obj);
}
origin: org.jboss.cluster/jboss-ha-server-core

String methodName = method_call.getName();
method_call.setName(newMethodName);
 retval = method_call.invoke(handler);
 if (overrideCL)
origin: wildfly/wildfly

local_addr=ch.getAddress().toString();
MethodCall call=new MethodCall(getClass().getMethod("handleMessage", String.class, String.class));
for(;;) {
  String line=Util.readStringFromStdin(": ");
  call.args(line, local_addr);
origin: org.jgroups/com.springsource.org.jgroups

  log.trace("[sender=" + req.getSrc() + "], method_call: " + method_call);
if(method_call.getMode() == MethodCall.ID) {
  if(method_lookup == null)
    throw new Exception("MethodCall uses ID=" + method_call.getId() + ", but method_lookup has not been set");
  Method m=method_lookup.findMethod(method_call.getId());
  if(m == null)
    throw new Exception("no method foudn for " + method_call.getId());
  method_call.setMethod(m);
return method_call.invoke(server_obj);
origin: org.jgroups/com.springsource.org.jgroups

switch(mode) {
case OLD:
  meth=findMethod(cl);
  break;
case METHOD:
case TYPES:
  meth = getMethod(cl, method_name, types);
  break;
case SIGNATURE:
  Class[] mytypes=null;
  if(signature != null)
    mytypes=getTypesFromString(cl, signature);
  meth = getMethod(cl, method_name, mytypes);
  break;
case ID:
origin: wildfly/wildfly

public Object invoke(Object target, Object[] args) throws Exception {
  if(args != null)
    this.args=args;
  return invoke(target);
}
origin: wildfly/wildfly

public MethodCall(Method method, Object... arguments) {
  init(method);
  if(arguments != null) args=arguments;
}
origin: org.jboss.cluster/jboss-ha-server-core

 @Override
 public byte[] objectToByteBuffer(Object obj) throws Exception
 {
   // wrap MethodCall in Object[service_name, byte[]] so that service name is available during demarshalling
   if (obj instanceof MethodCall)
   {
    String name = ((MethodCall)obj).getName();
    int idx = name.lastIndexOf('.');
    String serviceName = name.substring(0, idx);
    return CoreGroupCommunicationService.this.objectToByteBufferInternal(new Object[]{serviceName, CoreGroupCommunicationService.this.objectToByteBufferInternal(obj)});
   }
   return CoreGroupCommunicationService.this.objectToByteBufferInternal(obj);
 }
}
origin: wildfly/wildfly

  break;
case TYPES:
  meth=getMethod(cl, method_name, types);
  break;
case ID:
origin: org.jboss.cluster/jboss-ha-server-core

if (handler != null)
  MethodCall call = new MethodCall(methodName, args, types);
  try
   Object result = call.invoke(handler);
   if (returnType != null && void.class != returnType)
origin: org.jboss.eap/wildfly-client-all

/**
 * Message contains MethodCall. Execute it against *this* object and return result.
 * Use MethodCall.invoke() to do this. Return result.
 */
public Object handle(Message req) throws Exception {
  if(server_obj == null) {
    log.error(Util.getMessage("NoMethodHandlerIsRegisteredDiscardingRequest"));
    return null;
  }
  if(req == null || req.getLength() == 0) {
    log.error(Util.getMessage("MessageOrMessageBufferIsNull"));
    return null;
  }
  MethodCall method_call=methodCallFromBuffer(req.getRawBuffer(), req.getOffset(), req.getLength(), marshaller);
  if(log.isTraceEnabled())
    log.trace("[sender=%s], method_call: %s", req.getSrc(), method_call);
  if(method_call.mode() == MethodCall.ID) {
    if(method_lookup == null)
      throw new Exception(String.format("MethodCall uses ID=%d, but method_lookup has not been set", method_call.methodId()));
    Method m=method_lookup.findMethod(method_call.methodId());
    if(m == null)
      throw new Exception("no method found for " + method_call.methodId());
    method_call.method(m);
  }
    
  return method_call.invoke(server_obj);
}
origin: org.jboss.as/jboss-as-clustering-impl

String methodName = method_call.getName();
method_call.setName(newMethodName);
  retval = method_call.invoke(handler);
  if (trace) {
    ClusteringImplLogger.ROOT_LOGGER.tracef("rpc call return value: %s", retval);
origin: org.jboss.eap/wildfly-client-all

protected static MethodCall methodCallFromBuffer(final byte[] buf, int offset, int length, Marshaller marshaller) throws Exception {
  ByteArrayDataInputStream in=new ByteArrayDataInputStream(buf, offset, length);
  MethodCall call=new MethodCall();
  call.readFrom(in, marshaller);
  return call;
}
org.jgroups.blocksMethodCall

Javadoc

A method call is the JGroups representation of a remote method. It includes the name of the method (case sensitive) and a list of arguments. A method call is serializable and can be passed over the wire.

Most used methods

  • <init>
  • invoke
  • findMethod
    Called by the ProbeHandler impl. All args are strings. Needs to find a method where all parameter ty
  • getAllMethods
    The method walks up the class hierarchy and returns all methods of this class and those inherited fr
  • getMethod
    Returns the first method that matches the specified name and parameter types. The overriding methods
  • getName
    returns the name of the method to be invoked using this method call object
  • init
  • args
  • isPrimitiveType
  • method
  • methodId
  • methodName
  • methodId,
  • methodName,
  • mode,
  • readArgs,
  • readFrom,
  • readMethod,
  • readTypes,
  • setName,
  • writeArgs,
  • writeMethod

Popular in Java

  • Making http post requests using okhttp
  • requestLocationUpdates (LocationManager)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • findViewById (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now