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
。可以是空的,但新的客户端连接将被拒绝,只要它是。
getMBeanServer()
public MBeanServer getMBeanServer()
的MBeanServer
这种连接器服务器连接。这是最后的值传递给setMBeanServer(javax.management.MBeanServer)
这个对象,或null如果方法从来没有被称为。
MBeanServer
这种连接器连接。
setMBeanServer(javax.management.MBeanServer)
public String getVersion()
RMIServer
RMI的连接器协议通过此连接器服务器理解版。这是一个有下列格式的字符串:
协议版本实现名称
的protocol-version
是一系列的两个或两个以上的非负整数之间用句点分隔(.
)。该版本由本文档中描述的实现必须在这里使用字符串1.0
。
协议版本后必须有一个空格,其次是实现名称。执行名称的格式是未指定的。它建议它包括一个实现版本号。一个实现可以使用一个空字符串作为它的实现名称,例如出于安全原因。
getVersion
接口
RMIServer
public RMIConnection newClient(Object credentials) throws IOException
创建一个新的客户端连接。此方法调用makeClient
增加返回客户端连接对象的内部列表。当这RMIServerImpl
关闭通过其close()
方法,方法的close()
每个对象保留在列表称为。
一个客户端连接对象在这个内部列表中的事实并不能阻止它被收集到的垃圾。
newClient
接口
RMIServer
credentials
这个对象指定用户定义的凭据被传递到服务器进行验证调用者之前创建的
RMIConnection
。可以为空。
RMIConnection
。这通常是由
makeClient
对象,虽然实现的可能选择包,在另一个对象实现
RMIConnection
对象。
IOException
-如果新的客户端对象不能被创造或出口。
SecurityException
如果提供的凭据不允许服务器验证用户成功。
IllegalStateException
-如果
getMBeanServer()
是空的。
protected abstract RMIConnection makeClient(String connectionId, Subject subject) throws IOException
创建一个新的客户端连接。这种方法被称为公共方法newClient(Object)
。
connectionId
-新连接的ID。由该连接器服务器打开的每一个连接都将有一个不同的身份。如果这个参数为空,则该行为是未指定的。
subject
-认证的主体。可以为空。
RMIConnection
。
IOException
-如果新的客户端对象不能被创造或出口。
protected abstract void closeClient(RMIConnection client) throws IOException
关闭一个由makeClient
客户端连接。
client
-连接之前返回
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()
方法,没有新的客户端的连接将被接受。然后,每个剩余RMIConnection
makeClient
返回的对象,其close
方法称为。
这种方法被调用时,不止一次的行为是未指定的。
如果closeServer()
抛出一个IOException
,个人的联系仍然是封闭的,然后从这个方法抛出IOException
。
如果closeServer()
返回正常但一个或多个单个连接抛出一个IOException
,然后关闭所有连接后,其中的一个IOException
s是从这个方法引发。如果有多个连接抛出一个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.