zoukankan      html  css  js  c++  java
  • 随想 20180811

    Distributor Software Desgin:

    Netty RPC (Reactor Model) -->  Proxy or Reflection --> Busisness Logic 

    1. Configuration

    2. BuildFactory --> Context or Env

    3. BuildFactory --> Serialize & Deserialize Instance with Poxy or Reflection ( Class.forName().newInstance())

    4. ThreadPool Generation

    5. Dispatcher Generation

    5.1 Register itself to master or zookeeper / Master-Slave / NameServer

    5.2 Register Handler 

    5.3 Create receiver to save msg

    5.4 Create ThreadPool to handle msg from receiver

    5.5 Memory Allocation/Persistent, Syn/Ack

    6. Netty Server Start

    7. Future --> ListenerFuture<?>, ChannelFuture<?>, FutureTask<?>

    public class JavassistProxyFactory extends AbstractProxyFactory {    
        @SuppressWarnings("unchecked")
        public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) {
            return (T) Proxy.getProxy(interfaces).newInstance(
                       new InvokerInvocationHandler(invoker)
                    );
        }
    
        public <T> Invoker<T> getInvoker(T proxy, Class<T> type, URL url) {
            final Wrapper wrapper = Wrapper.getWrapper(
                          proxy.getClass().getName().indexOf('$') < 0 ? 
                          proxy.getClass() : type);
            return new AbstractProxyInvoker<T>(proxy, type, url) {
                @Override
                protected Object doInvoke(T proxy, String methodName, 
                                          Class<?>[] parameterTypes, 
                                          Object[] arguments) throws Throwable {
                    return wrapper.invokeMethod(proxy, methodName, parameterTypes, arguments);
                }
            };
        }
    }
  • 相关阅读:
    93. Restore IP Addresses
    92. Reverse Linked List II
    阿里巴巴 内推 面试
    hulu
    287. Find the Duplicate Number *HARD*
    89. Gray Code
    87. Scramble String *HARD* 动态规划
    84. Largest Rectangle in Histogram *HARD* -- 柱状图求最大面积 85. Maximal Rectangle *HARD* -- 求01矩阵中的最大矩形
    BZOJ2693jzptab
    最大公约数和
  • 原文地址:https://www.cnblogs.com/iiiDragon/p/9458517.html
Copyright © 2011-2022 走看看