Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2012 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.kuali.rice.ksb.messaging.serviceproxies;
 import java.util.List;

Standard default proxy used to call services asynchronously. Persists the method call to the db so call is never lost and only sent when transaction is committed.

Kuali Rice Team (
     private static final Logger LOG = Logger.getLogger(AsynchronousServiceCallProxy.class);
     private AsynchronousCallback callback;
     private List<Endpointendpoints;
     private Serializable context;
     private String value1;
     private String value2;
     protected AsynchronousServiceCallProxy(List<EndpointendpointsAsynchronousCallback callback,
             Serializable contextString value1String value2) {
         this. = endpoints;
         this. = callback;
         this. = context;
         this. = value1;
         this. = value2;
     public static Object createInstance(List<EndpointendpointsAsynchronousCallback callbackSerializable context,
             String value1String value2) {
         if (endpoints == null || endpoints.isEmpty()) {
             throw new RuntimeException("Cannot create service proxy, no service(s) passed in.");
         try {
             return Proxy.newProxyInstance(ClassLoaderUtils.getDefaultClassLoader(),
                     new AsynchronousServiceCallProxy(endpointscallbackcontextvalue1value2));
         } catch (Exception e) {
             throw new RiceRuntimeException(e);
     protected Object invokeInternal(Object proxyMethod methodObject[] argumentsthrows Throwable {
         if (.isDebugEnabled()) {
             .debug("creating messages for method invocation: " + method.getName());
         // there are multiple service calls to make in the case of topics.
         AsynchronousCall methodCall = null;
         PersistedMessageBO message = null;
         synchronized (this) {
             // consider moving all this topic invocation stuff to the service
             // invoker for speed reasons
             for (Endpoint endpoint : this.) {
                 ServiceConfiguration serviceConfiguration = endpoint.getServiceConfiguration();
                 methodCall = new AsynchronousCall(method.getParameterTypes(), argumentsserviceConfiguration,
                         method.getName(), this.this.);
                 message = PersistedMessageBO.buildMessage(serviceConfigurationmethodCall);
                // only do one iteration if this is a queue. The load balancing
                // will be handled when the service is
                // fetched by the MessageServiceInvoker through the GRL (and
                // then through the RemoteResourceServiceLocatorImpl)
                if (serviceConfiguration.isQueue()) {
        if (.isDebugEnabled()) {
            .debug("finished creating messages for method invocation: " + method.getName());
        return null;
    protected String proxyToString(Object proxy) {
        StringBuilder builder = new StringBuilder();
        builder.append("Service call proxy (" + getClass().getName() + ") - for endpoints with service name: ");
        if (CollectionUtils.isNotEmpty(this.)) {
        } else {
            builder.append("<< no endpoints on this proxy!!! >>");
        return builder.toString();
    protected void saveMessage(PersistedMessageBO message) {
    protected void executeMessage(PersistedMessageBO messagethrows Exception {

Returns the List<RemotedServiceHolder> of asynchronous services which will be invoked by calls to this proxy. This is a List because, in the case of Topics, there can be more than one service invoked.
    public Object getTarget() {
        return this.;
    public AsynchronousCallback getCallback() {
        return this.;
    public void setCallback(AsynchronousCallback callback) {
        this. = callback;
New to GrepCode? Check out our FAQ X