本文整理汇总了Java中java.rmi.activation.ActivationGroup.getSystem方法的典型用法代码示例。如果您正苦于以下问题:Java ActivationGroup.getSystem方法的具体用法?Java ActivationGroup.getSystem怎么用?Java ActivationGroup.getSystem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.rmi.activation.ActivationGroup
的用法示例。
在下文中一共展示了ActivationGroup.getSystem方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetSystem001
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public final void testGetSystem001() {
SecurityManager smOld = System.getSecurityManager();
try{
SecurityManager sm = new SecurityManager() {
boolean allow = false;
public void checkPermission(Permission perm) {
if (!allow) {
allow= true;
// throw new SecurityException("No, No, No, you can't do that.");
}
}
};
System.setSecurityManager(sm);
ActivationGroup.getSystem();
//} catch (ActivationException e) {
} catch (Throwable e) {
fail(msgNoException+e);
} finally {
System.setSecurityManager(smOld);
}
}
示例2: testGetSystemProxyObj
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
/**
* Tests if getSystem() method successfully returns if this system was previously
* set to a proxy value (which is possible in real application when dynamic remote
* stub is created for it) - regression test for HARMONY-1970.
*/
public void testGetSystemProxyObj() throws Exception {
ActivationSystem system = (ActivationSystem) Proxy.newProxyInstance(null,
new Class[] { ActivationSystem.class }, new TestInvocationHandler());
ActivationGroup.setSystem(system);
ActivationGroup.getSystem();
}
示例3: testStartup
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public void testStartup() throws Exception {
SubProcess rmid = JavaInvoker.invokeSimilar((String[]) null,
"org.apache.harmony.rmi.activation.Rmid", (String[]) null, true, true);
rmid.pipeError();
rmid.pipeInput();
rmid.closeOutput();
Thread.sleep(5000);
ActivationSystem as = ActivationGroup.getSystem();
assertNotNull(as);
rmid.destroy();
}
示例4: testSimpleInstall
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public void testSimpleInstall() throws Exception {
try {
Properties props = new Properties();
ActivationGroupDesc groupDesc = new ActivationGroupDesc(props, null);
System.out.println("groupDesc = " + groupDesc);
System.out.flush();
ActivationSystem as = ActivationGroup.getSystem();
System.out.println("ActivationSystem = " + as);
ActivationGroupID groupID = as.registerGroup(groupDesc);
System.out.println("groupID = " + groupID);
System.out.println("Activation group descriptor registered.");
MarshalledObject data = new MarshalledObject("HelloImpl");
System.out.println("MarshalledObject data = " + data);
ActivationDesc desc = new ActivationDesc(groupID, "org.apache.harmony.rmi.tests.java.rmi.activation.HelloImpl", "", null);
System.out.println("Registering ActivationDesc:");
Remote stub = Activatable.register(desc);
System.out.println("Activation descriptor registered: " + stub);
Registry reg = LocateRegistry.getRegistry();
System.out.println("Registry = " + reg);
reg.rebind("HelloImpl_Stub", stub);
System.out.println("Stub bound in registry.");
} catch (Throwable t) {
System.out.println("Exception in HelloInstaller: " + t);
t.printStackTrace();
fail("Exception in HelloInstaller: " + t);
}
}
示例5: main
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.setProperty("java.rmi.activation.port",
Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
RMID rmid = null;
Callback obj = null;
try {
/*
* Export callback object and bind in registry.
*/
System.err.println("export callback object and bind in registry");
obj = new RmidViaInheritedChannel();
Callback proxy = (Callback)
UnicastRemoteObject.exportObject(obj, 0);
Registry registry =
LocateRegistry.createRegistry(
TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
registry.bind("Callback", proxy);
/*
* Start rmid.
*/
System.err.println("start rmid with inherited channel");
RMID.removeLog();
rmid = RMID.createRMID(System.out, System.err, true, false,
TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
rmid.addOptions(new String[]{
"-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
if (System.getProperty("os.name").startsWith("Windows") &&
System.getProperty("os.version").startsWith("5."))
{
/* Windows XP/2003 or older
* Need to expand ephemeral range to include RMI test ports
*/
rmid.addOptions(new String[]{
"-Djdk.net.ephemeralPortRange.low=1024",
"-Djdk.net.ephemeralPortRange.high=64000"
});
}
rmid.start();
/*
* Get activation system and wait to be notified via callback
* from rmid's selector provider.
*/
System.err.println("get activation system");
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("ActivationSystem = " + system);
synchronized (lock) {
while (!notified) {
lock.wait();
}
}
System.err.println("TEST PASSED");
} finally {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
ActivationLibrary.rmidCleanup(rmid);
}
}
示例6: main
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 6261402\n");
System.setProperty("java.rmi.activation.port",
Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
RMID rmid = null;
Callback obj = null;
try {
/*
* Export callback object and bind in registry.
*/
System.err.println("export callback object and bind in registry");
obj = new CallbackImpl();
Callback proxy =
(Callback) UnicastRemoteObject.exportObject(obj, 0);
Registry registry =
LocateRegistry.createRegistry(
TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
registry.bind("Callback", proxy);
/*
* Start rmid.
*/
System.err.println("start rmid with inherited channel");
RMID.removeLog();
rmid = RMID.createRMID(System.out, System.err, true, true,
TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
rmid.addOptions(new String[]{
"-Djava.nio.channels.spi.SelectorProvider=" +
"InheritedChannelNotServerSocket$SP"});
rmid.start();
/*
* Get activation system and wait to be notified via callback
* from rmid's selector provider.
*/
System.err.println("get activation system");
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("ActivationSystem = " + system);
synchronized (lock) {
while (!notified) {
lock.wait();
}
}
System.err.println("TEST PASSED");
} finally {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
ActivationLibrary.rmidCleanup(rmid);
}
}
示例7: main
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 6261402\n");
System.setProperty("java.rmi.activation.port",
Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
RMID rmid = null;
Callback obj = null;
try {
/*
* Export callback object and bind in registry.
*/
System.err.println("export callback object and bind in registry");
obj = new CallbackImpl();
Callback proxy =
(Callback) UnicastRemoteObject.exportObject(obj, 0);
Registry registry = TestLibrary.createRegistryOnEphemeralPort();
int registryPort = TestLibrary.getRegistryPort(registry);
registry.bind("Callback", proxy);
/*
* Start rmid.
*/
System.err.println("start rmid with inherited channel");
RMID.removeLog();
rmid = RMID.createRMID(System.out, System.err, true, true,
TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
rmid.addOptions(
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
"-Djava.nio.channels.spi.SelectorProvider=InheritedChannelNotServerSocket$SP",
"-Dtest.java.rmi.rmidViaInheritedChannel.registry.port=" + registryPort);
rmid.start();
/*
* Get activation system and wait to be notified via callback
* from rmid's selector provider.
*/
System.err.println("get activation system");
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("ActivationSystem = " + system);
synchronized (lock) {
while (!notified) {
lock.wait();
}
}
System.err.println("TEST PASSED");
} finally {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
if (rmid != null) {
rmid.cleanup();
}
}
}
示例8: main
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.setProperty("java.rmi.activation.port",
Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
RMID rmid = null;
Callback obj = null;
try {
/*
* Export callback object and bind in registry.
*/
System.err.println("export callback object and bind in registry");
obj = new RmidViaInheritedChannel();
Callback proxy = (Callback)
UnicastRemoteObject.exportObject(obj, 0);
Registry registry =
LocateRegistry.createRegistry(
TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
registry.bind("Callback", proxy);
/*
* Start rmid.
*/
System.err.println("start rmid with inherited channel");
RMID.removeLog();
rmid = RMID.createRMID(System.out, System.err, true, false,
TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
rmid.addOptions(
"-XaddExports:java.base/sun.nio.ch=ALL-UNNAMED",
"-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider");
if (System.getProperty("os.name").startsWith("Windows") &&
System.getProperty("os.version").startsWith("5."))
{
/* Windows XP/2003 or older
* Need to expand ephemeral range to include RMI test ports
*/
rmid.addOptions(new String[]{
"-Djdk.net.ephemeralPortRange.low=1024",
"-Djdk.net.ephemeralPortRange.high=64000"
});
}
rmid.start();
/*
* Get activation system and wait to be notified via callback
* from rmid's selector provider.
*/
System.err.println("get activation system");
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("ActivationSystem = " + system);
synchronized (lock) {
while (!notified) {
lock.wait();
}
}
System.err.println("TEST PASSED");
} finally {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
if (rmid != null) {
rmid.cleanup();
}
}
}
示例9: main
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 6261402\n");
System.setProperty("java.rmi.activation.port",
Integer.toString(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT));
RMID rmid = null;
Callback obj = null;
try {
/*
* Export callback object and bind in registry.
*/
System.err.println("export callback object and bind in registry");
obj = new CallbackImpl();
Callback proxy =
(Callback) UnicastRemoteObject.exportObject(obj, 0);
Registry registry =
LocateRegistry.createRegistry(
TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
registry.bind("Callback", proxy);
/*
* Start rmid.
*/
System.err.println("start rmid with inherited channel");
RMID.removeLog();
rmid = RMID.createRMID(System.out, System.err, true, true,
TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_ACTIVATION_PORT);
rmid.addOptions(
"-XaddExports:java.base/sun.nio.ch=ALL-UNNAMED",
"-Djava.nio.channels.spi.SelectorProvider=InheritedChannelNotServerSocket$SP");
rmid.start();
/*
* Get activation system and wait to be notified via callback
* from rmid's selector provider.
*/
System.err.println("get activation system");
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("ActivationSystem = " + system);
synchronized (lock) {
while (!notified) {
lock.wait();
}
}
System.err.println("TEST PASSED");
} finally {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
if (rmid != null) {
rmid.cleanup();
}
}
}
示例10: main
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
RMID rmid = null;
Callback obj = null;
try {
/*
* Export callback object and bind in registry.
*/
System.err.println("export callback object and bind in registry");
obj = new RmidViaInheritedChannel();
Callback proxy = (Callback)
UnicastRemoteObject.exportObject(obj, 0);
Registry registry =
LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
registry.bind("Callback", proxy);
/*
* Start rmid.
*/
System.err.println("start rmid with inherited channel");
RMID.removeLog();
rmid = RMID.createRMID(System.out, System.err, true, false, PORT);
rmid.addOptions(new String[]{
"-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
rmid.start();
/*
* Get activation system and wait to be notified via callback
* from rmid's selector provider.
*/
System.err.println("get activation system");
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("ActivationSystem = " + system);
synchronized (lock) {
while (!notified) {
lock.wait();
}
}
System.err.println("TEST PASSED");
} finally {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
ActivationLibrary.rmidCleanup(rmid, PORT);
}
}
示例11: main
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 6261402\n");
RMID rmid = null;
Callback obj = null;
try {
/*
* Export callback object and bind in registry.
*/
System.err.println("export callback object and bind in registry");
obj = new CallbackImpl();
Callback proxy =
(Callback) UnicastRemoteObject.exportObject(obj, 0);
Registry registry =
LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT);
registry.bind("Callback", proxy);
/*
* Start rmid.
*/
System.err.println("start rmid with inherited channel");
RMID.removeLog();
rmid = RMID.createRMID(System.out, System.err, true, true, PORT);
rmid.addOptions(new String[]{
"-Djava.nio.channels.spi.SelectorProvider=" +
"InheritedChannelNotServerSocket$SP"});
rmid.start();
/*
* Get activation system and wait to be notified via callback
* from rmid's selector provider.
*/
System.err.println("get activation system");
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("ActivationSystem = " + system);
synchronized (lock) {
while (!notified) {
lock.wait();
}
}
System.err.println("TEST PASSED");
} finally {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
ActivationLibrary.rmidCleanup(rmid, PORT);
}
}
示例12: main
import java.rmi.activation.ActivationGroup; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
System.setProperty("java.rmi.activation.port",
Integer.toString(TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
RMID rmid = null;
Callback obj = null;
try {
/*
* Export callback object and bind in registry.
*/
System.err.println("export callback object and bind in registry");
obj = new RmidViaInheritedChannel();
Callback proxy = (Callback)
UnicastRemoteObject.exportObject(obj, 0);
Registry registry =
LocateRegistry.createRegistry(
TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
registry.bind("Callback", proxy);
/*
* Start rmid.
*/
System.err.println("start rmid with inherited channel");
RMID.removeLog();
rmid = RMID.createRMID(System.out, System.err, true, false,
TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT);
rmid.addOptions(new String[]{
"-Djava.nio.channels.spi.SelectorProvider=RmidViaInheritedChannel$RmidSelectorProvider"});
rmid.start();
/*
* Get activation system and wait to be notified via callback
* from rmid's selector provider.
*/
System.err.println("get activation system");
ActivationSystem system = ActivationGroup.getSystem();
System.err.println("ActivationSystem = " + system);
synchronized (lock) {
while (!notified) {
lock.wait();
}
}
System.err.println("TEST PASSED");
} finally {
if (obj != null) {
UnicastRemoteObject.unexportObject(obj, true);
}
ActivationLibrary.rmidCleanup(rmid);
}
}