| New file | 
 |  |  | 
 |  |  | package com.dy.common.mw.channel.rmi; | 
 |  |  |  | 
 |  |  | import java.io.Serial; | 
 |  |  | import java.rmi.RemoteException; | 
 |  |  | import java.rmi.server.UnicastRemoteObject; | 
 |  |  |  | 
 |  |  | import com.dy.common.threadPool.ThreadPool; | 
 |  |  | import com.dy.common.threadPool.TreadPoolFactory; | 
 |  |  |  | 
 |  |  | public class RmiFrameWorkImpl extends UnicastRemoteObject implements RmiFrameWork { | 
 |  |  |  | 
 |  |  |    @Serial | 
 |  |  |    private static final long serialVersionUID = 201807220009001L; | 
 |  |  | 	 | 
 |  |  |    private RmiUnitAdapter adapter ; | 
 |  |  |    /** | 
 |  |  |     * 构造方法 | 
 |  |  |     * @throws RemoteException 异常 | 
 |  |  |     */ | 
 |  |  |    protected RmiFrameWorkImpl(RmiUnitAdapter adapter) throws RemoteException { | 
 |  |  |       super(); | 
 |  |  |       this.adapter = adapter ; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    /** | 
 |  |  |     * 同步请求 | 
 |  |  |     * @param obj 命令参数 | 
 |  |  |     * @return 返回命令结果 | 
 |  |  |     * @throws RemoteException 异常 | 
 |  |  |     */ | 
 |  |  |    @Override | 
 |  |  |    public Object syncRequest(Object obj) throws RemoteException { | 
 |  |  |       if(obj == null){ | 
 |  |  |          throw new RemoteException("严重错误,输入命令参数为空!") ; | 
 |  |  |       } | 
 |  |  |       return adapter.newRequestCallback().syncRequest(obj) ; | 
 |  |  |    } | 
 |  |  | 	 | 
 |  |  |    /** | 
 |  |  |     * 异步请求 | 
 |  |  |     * @param obj 参数 | 
 |  |  |     * @return 命令结果的ID,如果为空,则说明邮错 | 
 |  |  |     * @throws RemoteException 异常 | 
 |  |  |     */ | 
 |  |  |    @Override | 
 |  |  |    public String asyncRequest(Object obj) throws RemoteException { | 
 |  |  |       try { | 
 |  |  |          TreadPoolFactory.getThreadPoolShort().putJob(new ThreadPool.Job() { | 
 |  |  |             public void execute() throws RemoteException { | 
 |  |  |                throw new RemoteException("此方法未实现") ; | 
 |  |  |             } | 
 |  |  |             @Override | 
 |  |  |             public void destroy() { | 
 |  |  |             } | 
 |  |  |             @Override | 
 |  |  |             public boolean isDestroy() { | 
 |  |  |                return false; | 
 |  |  |             } | 
 |  |  | 				 | 
 |  |  |          }); | 
 |  |  |       }catch (RemoteException ee) { | 
 |  |  |          throw ee ; | 
 |  |  |       }catch (Exception e) { | 
 |  |  |          e.printStackTrace(); | 
 |  |  |       } | 
 |  |  |       return null; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    /** | 
 |  |  |     * 关闭服务的请求 | 
 |  |  |     */ | 
 |  |  |    @Override | 
 |  |  |    public String shutRequest() throws RemoteException { | 
 |  |  |       throw new RemoteException("此方法未实现") ; | 
 |  |  |    } | 
 |  |  | 	 | 
 |  |  |  | 
 |  |  | } |