⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 remotemodelmgrimpl.java

📁 java rmi技术实例
💻 JAVA
字号:
// Copyright MageLang Institute; Version $Id: //depot/main/src/edu/modules/RMI-mml2/magercises/LocalRemoteServer/Solution/RemoteModelMgrImpl.java#2 $
/**
 * Class:        RemoteModelMgrImpl
 *
 * Purpose:      Provides an implementation for the RemoteModelMgr
 *               RMI Service.
 *
 * Notes:        RemoteModel is an RMI "Remote" interface.
 *               LocalModel is a local interface
 */
public class RemoteModelMgrImpl
  extends    java.rmi.server.UnicastRemoteObject
  implements RemoteModelMgr
{
   LocalModel      lm;
   RemoteModelImpl rmImpl;

   /**
    * Constructor
   */
   public RemoteModelMgrImpl()
     throws java.rmi.RemoteException
   {
      super();
   }


   public RemoteModelRef getRemoteModelRef()
     throws java.rmi.RemoteException
   {
      // Lazy instantiation of delgatee
      if ( null == lm )
      {
         lm = new LocalModel();
      }

      // Lazy instantiation of Remote Interface Wrapper
      if ( null == rmImpl )
      {
         rmImpl = new RemoteModelImpl( lm );
      }

      return ( (RemoteModelRef) rmImpl );
   }


   /**
    * Returns a reference to the the object that performs
    * the real operations. If this is an RMI call, it will
    * return a copy.
   */
   public LocalModel getLocalModel()
     throws java.rmi.RemoteException
   {
      // Lazy instantiation of delgatee
      if ( null == lm )
      {
         lm = new LocalModel();
      }

      return lm;
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -