List of usage examples for org.springframework.remoting RemoteLookupFailureException RemoteLookupFailureException
public RemoteLookupFailureException(String msg)
From source file:com.turbospaces.network.ServerCommunicationDispatcher.java
/** * get the remove server nodes(block if 0 nodes discovered) * //from w w w .ja va 2s.c o m * @return the remote server side jspace nodes * @throws RemoteLookupFailureException * if no remote server nodes are discovered */ public final Address[] getServerNodes() throws RemoteLookupFailureException { Address[] nodes = serverNodes; long communicationTimeout = configuration.getCommunicationTimeoutInMillis(); if (nodes.length == 0) synchronized (monitor) { try { monitor.wait(communicationTimeout); } catch (InterruptedException e) { logger.error(e.getMessage(), e); Thread.currentThread().interrupt(); throw new SpaceException(e.getMessage(), e); } } if (nodes.length == 0) throw new RemoteLookupFailureException(String.format(LOOKUP_TIMEOUT, communicationTimeout)); return nodes; }
From source file:org.openspaces.remoting.SpaceRemotingServiceExporter.java
/** * Receives a {@link SpaceRemotingEntry} which holds all the relevant invocation information. * Looks up (based on {@link SpaceRemotingEntry#getLookupName()} the interface the service is * registered against (which is the interface the service implements) and then invokes the * relevant method within it using the provided method name and arguments. Write the result * value or invocation exception back to the space using {@link SpaceRemotingEntry}. * * @param remotingEntry The remote entry object * @param gigaSpace The GigaSpace interface * @param txStatus A transactional status * @param source An optional source event information *///from w w w . j a v a2 s . com public void onEvent(SpaceRemotingEntry remotingEntry, GigaSpace gigaSpace, TransactionStatus txStatus, Object source) throws RemoteAccessException { waitTillInitialized(); String lookupName = remotingEntry.getLookupName(); if (lookupName.endsWith(asyncInterfaceSuffix)) { lookupName = lookupName.substring(0, lookupName.length() - asyncInterfaceSuffix.length()); } Object service = interfaceToService.get(lookupName); if (service == null) { // we did not get an interface, maybe it is a bean name? try { service = applicationContext.getBean(lookupName); } catch (NoSuchBeanDefinitionException e) { // do nothing, write back a proper exception } if (service == null) { writeResponse(gigaSpace, remotingEntry, new RemoteLookupFailureException( "Failed to find service for lookup [" + remotingEntry.getLookupName() + "]")); return; } } autowireArguments(service, remotingEntry.getArguments()); IMethod method = null; try { if (remotingEntry instanceof HashedSpaceRemotingEntry && ((HashedSpaceRemotingEntry) remotingEntry).getMethodHash() != null) { method = methodInvocationLookup.get(lookupName) .get(((HashedSpaceRemotingEntry) remotingEntry).getMethodHash()); } if (method == null) { method = methodInvocationCache.findMethod(lookupName, service, remotingEntry.getMethodName(), remotingEntry.getArguments()); } } catch (Exception e) { failedExecution(service); writeResponse(gigaSpace, remotingEntry, new RemoteLookupFailureException("Failed to find method [" + remotingEntry.getMethodName() + "] for lookup [" + remotingEntry.getLookupName() + "]", e)); return; } try { Object retVal; if (serviceExecutionAspect != null) { retVal = serviceExecutionAspect.invoke(remotingEntry, new InternalMethodInvocation(method), service); } else { retVal = method.invoke(service, remotingEntry.getArguments()); } writeResponse(gigaSpace, remotingEntry, retVal); processedExecution(service); } catch (InvocationTargetException e) { failedExecution(service); writeResponse(gigaSpace, remotingEntry, e.getTargetException()); } catch (IllegalAccessException e) { failedExecution(service); writeResponse(gigaSpace, remotingEntry, new RemoteLookupFailureException("Failed to access method [" + remotingEntry.getMethodName() + "] for lookup [" + remotingEntry.getLookupName() + "]", e)); } catch (Throwable e) { failedExecution(service); writeResponse(gigaSpace, remotingEntry, e); } }