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

📄 activatableserverref.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
字号:
/* ActivatableServerRef.java -- The activatable server reference   Copyright (C) 2006 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING.  If not, write to theFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version. */package gnu.java.rmi.server;import java.rmi.Remote;import java.rmi.RemoteException;import java.rmi.activation.ActivationID;import java.rmi.server.ObjID;import java.rmi.server.RMIServerSocketFactory;/** * The activatable server reference works like UnicastServerReference, but it * additionally activates the associated object on demand, during the first * incoming call. When UnicastServerReference takes the working reference, * the ActivatableServerRef takes the activation id instead. *  * @author Audrius Meskauskas (Audriusa@Bioinformatics.org) */public class ActivatableServerRef extends UnicastServerRef{  /**   * Use SVUID for interoperability   */  private static final long serialVersionUID = 1;    /**   * The object activation id.   */  public ActivationID actId;  /**   * Used by serialization only   */  public ActivatableServerRef()  {    super();  }    /**   * Create the new activatable server reference that will activate object on   * the first call using the given activation id.   */  public ActivatableServerRef(ObjID id, ActivationID anId, int aPort,                              RMIServerSocketFactory ssFactory)      throws RemoteException  {    super(id, aPort, ssFactory);    actId = anId;        // The object ID will be placed in the object map and should deliver    // incoming call to {@link #incommingMessageCall}. The object itself    // is currently null.    UnicastServer.exportActivatableObject(this);  }    /**   * Inactivate the object (stop the server).   */  public void inactivate()  {    manager.stopServer();  }    /**   * Activate the object (normally during the first call).   */  protected void activate() throws RemoteException  {    try      {        Remote self = actId.activate(false);                // This will call UnicastServer.exportObject, replacing null by        // the activated object (self) in the object map.        exportObject(self);      }    catch (RemoteException rex)      {        throw rex;      }    catch (Exception exc)      {        RemoteException rx = new RemoteException("Activation failed.");        rx.initCause(exc);        throw rx;      }  }  /**   * If the object is not active, activate it first.   */  public Object incomingMessageCall(UnicastConnection conn, int method,                                    long hash) throws Exception  {    if (myself == null)      activate();    return super.incomingMessageCall(conn, method, hash);  }  /**   * Export object and ensure it is present in the server activation table    * as well.   */  public Remote exportObject(Remote obj) throws RemoteException  {    Remote r = super.exportObject(obj);    UnicastServer.registerActivatable(this);    return r;  }}

⌨️ 快捷键说明

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