public abstract class RMIServerImpl extends Object implements Closeable, RMIServer
表示连接器服务器的RMI对象。 远程客户端可以使用newClient(Object)方法进行连接。 此方法返回表示连接的RMI对象。
用户代码通常不直接引用此类。 RMI连接服务器通常用类别RMIConnectorServer创建。 远程客户端通常使用JMXConnectorFactory或通过实例化RMIConnector创建连接 。
这是一个抽象类。 具体的子类定义客户端连接对象的详细信息,例如是否使用JRMP或IIOP。
| Constructor and Description |
|---|
RMIServerImpl(Map<String,?> env)
构造一个新的
RMIServerImpl 。
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
clientClosed(RMIConnection client)
当创建一个客户端连接方法称为
makeClient关闭。
|
void |
close()
关闭此连接服务器。
|
protected abstract void |
closeClient(RMIConnection client)
关闭由
makeClient制作的客户端
连接 。
|
protected abstract void |
closeServer()
调用
close()关闭连接器服务器。
|
protected abstract void |
export()
导出此RMI对象。
|
ClassLoader |
getDefaultClassLoader()
获取此连接器服务器使用的默认值
ClassLoader 。
|
MBeanServer |
getMBeanServer()
所述
MBeanServer此连接器服务器连接。
|
protected abstract String |
getProtocol()
返回此对象的协议字符串。
|
String |
getVersion()
该连接器服务器了解的RMI连接器协议版本。
|
protected abstract RMIConnection |
makeClient(String connectionId, Subject subject)
创建一个新的客户端连接。
|
RMIConnection |
newClient(Object credentials)
创建一个新的客户端连接。
|
void |
setDefaultClassLoader(ClassLoader cl)
为此连接器服务器设置默认值
ClassLoader 。
|
void |
setMBeanServer(MBeanServer mbs)
设置
MBeanServer此连接器服务器连接。
|
abstract Remote |
toStub()
返回此服务器对象的远程存根。
|
protected abstract void export()
throws IOException
导出此RMI对象。
IOException - 如果此RMI对象无法导出。
public abstract Remote toStub() throws IOException
IOException - 如果无法获取存根 - 例如RMIServerImpl尚未导出。
public void setDefaultClassLoader(ClassLoader cl)
设置此连接器服务器的默认值ClassLoader 。 新的客户端连接将使用此类加载器。 现有的客户端连接不受影响。
cl - 这个连接器服务器使用的新的
ClassLoader 。
getDefaultClassLoader()
public ClassLoader getDefaultClassLoader()
获取此连接器服务器使用的默认值ClassLoader 。
ClassLoader 。
setDefaultClassLoader(java.lang.ClassLoader)
public void setMBeanServer(MBeanServer mbs)
设置MBeanServer此连接器服务器连接。 新的客户端连接将与此MBeanServer进行交互。 现有的客户端连接不受影响。
mbs - 新的MBeanServer 。
可以为null,但是只要新的客户端连接将被拒绝。
getMBeanServer()
public MBeanServer getMBeanServer()
所述MBeanServer此连接器服务器连接。 这是传递给此对象上的setMBeanServer(javax.management.MBeanServer)的最后一个值,如果该方法从未被调用,则为null。
MBeanServer此连接器附接。
setMBeanServer(javax.management.MBeanServer)
public String getVersion()
RMIServer复制
该连接器服务器了解的RMI连接器协议版本。 这是一个具有以下格式的字符串:
protocol-version implementation-name
protocol-version是由句点( . ) protocol-version的一系列两个或多个非负整数。 本文档描述的版本的实现必须在此处使用字符串1.0 。
协议版本后必须有一个空格,后跟执行名称。 实现名称的格式未指定。 建议包含一个实现版本号。 实现可以使用空字符串作为其实现名称,例如出于安全原因。
getVersion在界面
RMIServer
public RMIConnection newClient(Object credentials) throws IOException
创建一个新的客户端连接。 此方法调用makeClient并将返回的客户端连接对象添加到内部列表。 当此RMIServerImpl通过其close()方法关闭时,将调用剩余在列表中的每个对象的close()方法。
客户端连接对象在此内部列表中的事实并不能阻止它被垃圾回收。
newClient在界面
RMIServer
credentials - 此对象指定要传递到服务器的用户定义的凭据,以便在创建RMIConnection之前对呼叫者进行RMIConnection 。
可以为null。
RMIConnection 。
这通常是由makeClient创建的对象,尽管实现可以选择将该对象包含在实现RMIConnection的另一个对象中。
IOException - 如果新的客户端对象无法创建或导出。
SecurityException - 如果给定的凭据不允许服务器成功验证用户。
IllegalStateException - 如果
getMBeanServer()为空。
protected abstract RMIConnection makeClient(String connectionId, Subject subject) throws IOException
创建一个新的客户端连接。 该方法由公共方法newClient(Object)调用 。
connectionId - 新连接的ID。
此连接器服务器打开的每个连接将具有不同的ID。
如果此参数为空,则该行为是未指定的。
subject - 认证主题。
可以为null。
RMIConnection 。
IOException - 如果新的客户端对象无法创建或导出。
protected abstract void closeClient(RMIConnection client) throws IOException
关闭由makeClient制作的客户端连接 。
client - 以前由makeClient返回的makeClient , closeClient方法以前未被调用。
如果违反这些条件,则行为是未指定的,包括client为空的情况。
IOException - 如果客户端连接不能关闭。
protected abstract String getProtocol()
返回此对象的协议字符串。 该字符串是rmi为RMI / JRMP和iiop为RMI / IIOP。
protected void clientClosed(RMIConnection client) throws IOException
当创建一个客户端连接方法称为makeClient关闭。 定义makeClient的子类必须安排在调用最终对象的close方法时调用此方法。 这使它能够从RMIServerImpl的连接列表中删除。 client不是在列表中不是错误。
从连接列表中删除client后,此方法调用closeClient(client) 。
client - 已关闭的客户端连接。
IOException - 如果
closeClient(javax.management.remote.rmi.RMIConnection)抛出这个异常。
NullPointerException - 如果
client为空。
public void close()
throws IOException
关闭此连接服务器。 此方法首先调用closeServer()方法,以便不会接受新的客户端连接。 然后,对于makeClient返回的每个剩余的884899274873对象, 调用其close方法。
此方法被多次调用的行为是未指定的。
如果closeServer()抛出一个IOException ,则各个连接仍然关闭,然后IOException从此方法抛出。
如果closeServer()正常返回,但是一个或多个单个连接会引发一个IOException ,则在关闭所有连接后,将从该方法中抛出其中一个IOException 。 如果一个以上的连接引发了一个IOException ,那么这个方法是从哪个引用的。
close在界面
Closeable
close在界面
AutoCloseable
IOException - 如果
closeServer()或其中一个
RMIConnection.close()电话投掷
IOException 。
protected abstract void closeServer()
throws IOException
调用close()关闭连接器服务器。 从此方法返回后,连接器服务器不能接受任何新的连接。
IOException - 如果尝试关闭连接器服务器失败。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.