本文整理汇总了Java中java.rmi.server.Skeleton类的典型用法代码示例。如果您正苦于以下问题:Java Skeleton类的具体用法?Java Skeleton怎么用?Java Skeleton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Skeleton类属于java.rmi.server包,在下文中一共展示了Skeleton类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSkelInstance
import java.rmi.server.Skeleton; //导入依赖的package包/类
/**
* Loads and instantiates skel class for the given remote class.
*
* @param c Class whose skel should be loaded and instantiated
*
* @return created skel class or null if any Exception occurred during
* skel loading or instantiating
*/
protected Skeleton getSkelInstance(Class c) {
String skelName = c.getName() + "_Skel"; //$NON-NLS-1$
ClassLoader cl = c.getClassLoader();
try {
Class skelClass;
if (cl != null) {
skelClass = cl.loadClass(skelName);
} else {
skelClass = Class.forName(skelName);
}
return (Skeleton) skelClass.newInstance();
} catch (Exception ex) {
}
return null;
}
示例2: exportClass
import java.rmi.server.Skeleton; //导入依赖的package包/类
/**
* Export object and ensure it is present in the server activation table as
* well.
*
* @param aClass the class being exported, must implement Remote.
*/
public Remote exportClass(Class aClass) throws RemoteException
{
if (!Remote.class.isAssignableFrom(aClass))
throw new InternalError(aClass.getName()+" must implement Remote");
String ignoreStubs;
ClassLoader loader =aClass.getClassLoader();
// Stubs are always searched for the bootstrap classes that may have
// obsolete pattern and may still need also skeletons.
if (loader==null)
ignoreStubs = "false";
else
ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses",
"false");
if (! ignoreStubs.equals("true"))
{
// Find and install the stub
Class cls = aClass;
// where ist the _Stub? (check superclasses also)
Class expCls = findStubSkelClass(cls);
if (expCls != null)
{
stub = (RemoteStub) getHelperClass(expCls, "_Stub");
// Find and install the skeleton (if there is one)
skel = (Skeleton) getHelperClass(expCls, "_Skel");
}
}
if (stub == null)
stub = createProxyStub(aClass, this);
// Build hash of methods which may be called.
buildMethodHash(aClass, true);
UnicastServer.registerActivatable(this);
return stub;
}
示例3: exportObject
import java.rmi.server.Skeleton; //导入依赖的package包/类
/**
* Export the object and return its remote stub. The method tries to locate
* existing stubs and skeletons. If this fails, the method instantiates the
* proxy stub class.
*
* Stubs and skeletons are always ignored (even if present) if the
* java.rmi.server.ignoreStubClasses property is set to true.
*
* @param obj the object being exported.
* @return the stub (existing class or proxy) of the exported object.
* @throws RemoteException if the export failed due any reason
*/
public Remote exportObject(Remote obj) throws RemoteException
{
if (myself == null)
{
myself = obj;
// Save it to server manager, to let client calls in the same VM to
// issue local call
manager.serverobj = obj;
String ignoreStubs;
ClassLoader loader =obj.getClass().getClassLoader();
// Stubs are always searched for the bootstrap classes that may have
// obsolete pattern and may still need also skeletons.
if (loader==null)
ignoreStubs = "false";
else
ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses",
"false");
if (! ignoreStubs.equals("true"))
{
// Find and install the stub
Class cls = obj.getClass();
// where ist the _Stub? (check superclasses also)
Class expCls = findStubSkelClass(cls);
if (expCls != null)
{
stub = (RemoteStub) getHelperClass(expCls, "_Stub");
// Find and install the skeleton (if there is one)
skel = (Skeleton) getHelperClass(expCls, "_Skel");
}
}
if (stub == null)
stub = createProxyStub(obj.getClass(), this);
// Build hash of methods which may be called.
buildMethodHash(obj.getClass(), true);
// Export it.
UnicastServer.exportObject(this);
}
return stub;
}
示例4: exportClass
import java.rmi.server.Skeleton; //导入依赖的package包/类
/**
* Export object and ensure it is present in the server activation table as
* well.
*
* @param aClass the class being exported, must implement Remote.
*/
public Remote exportClass(Class aClass) throws RemoteException
{
if (!Remote.class.isAssignableFrom(aClass))
throw new InternalError(aClass.getName()+" must implement Remote");
String ignoreStubs;
ClassLoader loader =aClass.getClassLoader();
// Stubs are always searched for the bootstrap classes that may have
// obsolete pattern and may still need also skeletons.
if (loader==null)
ignoreStubs = "false";
else
ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses",
"false");
if (! ignoreStubs.equals("true"))
{
// Find and install the stub
Class cls = aClass;
// where ist the _Stub? (check superclasses also)
Class expCls = findStubSkelClass(cls);
if (expCls != null)
{
stub = (RemoteStub) getHelperClass(expCls, "_Stub");
// Find and install the skeleton (if there is one)
skel = (Skeleton) getHelperClass(expCls, "_Skel");
}
}
if (stub == null)
stub = createProxyStub(aClass, this);
// Build hash of methods which may be called.
buildMethodHash(aClass, true);
UnicastServer.registerActivatable(this);
return stub;
}
示例5: exportObject
import java.rmi.server.Skeleton; //导入依赖的package包/类
/**
* Export the object and return its remote stub. The method tries to locate
* existing stubs and skeletons. If this fails, the method instantiates the
* proxy stub class.
*
* Stubs and skeletons are always ignored (even if present) if the
* java.rmi.server.ignoreStubClasses property is set to true.
*
* @param obj the object being exported.
* @return the stub (existing class or proxy) of the exported object.
* @throws RemoteException if the export failed due any reason
*/
public Remote exportObject(Remote obj) throws RemoteException
{
if (myself == null)
{
myself = obj;
// Save it to server manager, to let client calls in the same VM to
// issue local call
manager.serverobj = obj;
String ignoreStubs;
ClassLoader loader =obj.getClass().getClassLoader();
// Stubs are always searched for the bootstrap classes that may have
// obsolete pattern and may still need also skeletons.
if (loader==null)
ignoreStubs = "false";
else
ignoreStubs = System.getProperty("java.rmi.server.ignoreStubClasses",
"false");
if (! ignoreStubs.equals("true"))
{
// Find and install the stub
Class cls = obj.getClass();
// where ist the _Stub? (check superclasses also)
Class expCls = findStubSkelClass(cls);
if (expCls != null)
{
stub = (RemoteStub) getHelperClass(expCls, "_Stub");
// Find and install the skeleton (if there is one)
skel = (Skeleton) getHelperClass(expCls, "_Skel");
}
}
if (stub == null)
stub = createProxyStub(obj.getClass(), this);
// Build hash of methods which may be called.
buildMethodHash(obj.getClass(), true);
// Export it.
UnicastServer.exportObject(this);
}
return stub;
}