private static <T> void calls(Server<T> server, Client client) {
   Client client2 = new Client(client.getHost(), client.getPort() + 1, client.getAppId());
   calls(
       server,
       client,
       getStatelessContext(client).toString(),
       new Server<T>(
           client2.getHost(),
           client2.getPort(),
           server.getAuthenticator(),
           server.getSessionManager()),
       client2,
       getStatelessContext(client2).toString());
 }
Esempio n. 2
0
 public Connection(
     Client client,
     String protocol,
     String format,
     String implementation,
     Class<T> i,
     LinkedHashSet<Interceptor> is,
     BeanFactory beanFactory,
     StreamFactory sf)
     throws Exception {
   super();
   this.client = client;
   this.protocol = protocol;
   this.format = format;
   this.implementation = implementation;
   this.host = client.getHost();
   this.port = client.getPort();
   this.timeout = client.getTimeout();
   this.interfase = i;
   this.interceptors = new LinkedHashSet<Interceptor>(is);
   this.interceptors.add(this);
   this.beanFactory = beanFactory;
   this.streamFactory = sf;
   this.open = i.getAnnotation(Open.class);
   this.processings = new HashMap<Method, TreeMap<Class<? extends Annotation>, Step>>();
   this.correspondences = new HashMap<Method, Method>();
   Set<Method> set =
       interfase.isAnnotationPresent(Correspond.class)
           ? Pigeons.getInterfaceDeclaredOpenableMethods(
               interfase.getAnnotation(Correspond.class).value())
           : new HashSet<Method>();
   Map<String, Method> map = new HashMap<String, Method>();
   for (Method method : set) {
     String path = Pigeons.getOpenPath(method);
     map.put(path, method);
   }
   Set<Method> methods = Pigeons.getClassAllOpenableMethods(interfase);
   for (Method method : methods) {
     processings.put(method, Pigeons.getMethodProcessings(method));
     String path = Pigeons.getOpenPath(method);
     correspondences.put(method, map.containsKey(path) ? map.get(path) : method);
   }
   this.proxy =
       interfase.cast(
           Proxy.newProxyInstance(client.getClassLoader(), new Class<?>[] {interfase}, this));
 }