本文整理汇总了Java中java.rmi.activation.ActivationSystem类的典型用法代码示例。如果您正苦于以下问题:Java ActivationSystem类的具体用法?Java ActivationSystem怎么用?Java ActivationSystem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActivationSystem类属于java.rmi.activation包,在下文中一共展示了ActivationSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSystemStub
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
/**
* Waits for systemStub to be initialized and returns its
* initialized value. Any remote call that uses systemStub must
* call this method to get it instead of using direct field
* access. This is necessary because the super() call in the
* constructor exports this object before systemStub is initialized
* (see JDK-8023541), allowing remote calls to come in during this
* time. We can't use checkShutdown() like other nested classes
* because this is a static class.
*/
private synchronized ActivationSystem getSystemStub() {
boolean interrupted = false;
while (systemStub == null) {
try {
wait();
} catch (InterruptedException ie) {
interrupted = true;
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
return systemStub;
}
示例2: SystemRegistryImpl
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
SystemRegistryImpl(int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf,
ActivationSystem systemStub)
throws RemoteException
{
super(port, csf, ssf);
this.systemStub = systemStub;
}
示例3: SystemRegistryImpl
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
SystemRegistryImpl(int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf,
ActivationSystem systemStub)
throws RemoteException
{
super(port, csf, ssf);
assert systemStub != null;
synchronized (this) {
this.systemStub = systemStub;
notifyAll();
}
}
示例4: getInstance
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
/**
* Obtain the singleton instance of this class.
*
* @param folder the folder, where the activation system will keep its files.
* @param cold do the cold start if true, hot (usual) if false.
*/
public static ActivationSystem getInstance(File folder, boolean cold)
{
if (singleton2 == null)
singleton2 = new ActivationSystemImpl(folder, cold);
return singleton2;
}
示例5: getInstance
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
/**
* Obtain the singleton instance of this class.
*
* @param folder the folder, where the activation system will keep its files.
* @param cold do the cold start if true, hot (usual) if false.
*/
public static ActivationSystem getInstance(File folder, boolean cold)
{
if (singleton2 == null)
singleton2 = new ActivationSystemImpl(folder, cold);
return singleton2;
}
示例6: testGetSystemProxyObj
import java.rmi.activation.ActivationSystem; //导入依赖的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();
}
示例7: testStartup
import java.rmi.activation.ActivationSystem; //导入依赖的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();
}
示例8: testSimpleInstall
import java.rmi.activation.ActivationSystem; //导入依赖的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);
}
}
示例9: testEquals
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
public void testEquals() throws ActivationException {
ActivationSystem as = new MyActivationSystem();
ActivationGroupID agid = new ActivationGroupID(as);
ActivationGroupID agid2 = agid;
ActivationGroupID agid3 = new ActivationGroupID(as);
assertSame(agid2, agid);
assertFalse(agid.equals(agid3));
}
示例10: testHashcode
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
public void testHashcode() throws ActivationException {
ActivationSystem as = new MyActivationSystem();
ActivationGroupID agid = new ActivationGroupID(as);
ActivationGroupID agid3 = new ActivationGroupID(as);
assertTrue(agid.hashCode() != agid3.hashCode());
}
示例11: testToString
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
public void testToString() throws ActivationException {
ActivationSystem as = new MyActivationSystem();
ActivationGroupID agid = new ActivationGroupID(as);
ActivationGroupID agid3 = new ActivationGroupID(as);
assertTrue(!agid.toString().equals(agid3.toString()));
}
示例12: init
import java.rmi.activation.ActivationSystem; //导入依赖的package包/类
/**
* Initialize the Activation instantiation; start activation
* services.
*/
private void init(int port,
RMIServerSocketFactory ssf,
ReliableLog log,
String[] childArgs)
throws Exception
{
// initialize
this.log = log;
numUpdates = 0;
shutdownHook = new ShutdownHook();
groupSemaphore = getInt("sun.rmi.activation.groupThrottle", 3);
groupCounter = 0;
Runtime.getRuntime().addShutdownHook(shutdownHook);
// Use array size of 0, since the value from calling size()
// may be out of date by the time toArray() is called.
ActivationGroupID[] gids =
groupTable.keySet().toArray(new ActivationGroupID[0]);
synchronized (startupLock = new Object()) {
// all the remote methods briefly synchronize on startupLock
// (via checkShutdown) to make sure they don't happen in the
// middle of this block. This block must not cause any such
// incoming remote calls to happen, or deadlock would result!
activator = new ActivatorImpl(port, ssf);
activatorStub = (Activator) RemoteObject.toStub(activator);
system = new ActivationSystemImpl(port, ssf);
systemStub = (ActivationSystem) RemoteObject.toStub(system);
monitor = new ActivationMonitorImpl(port, ssf);
initCommand(childArgs);
registry = new SystemRegistryImpl(port, null, ssf, systemStub);
if (ssf != null) {
synchronized (initLock) {
initDone = true;
initLock.notifyAll();
}
}
}
startupLock = null;
// restart services
for (int i = gids.length; --i >= 0; ) {
try {
getGroupEntry(gids[i]).restartServices();
} catch (UnknownGroupException e) {
System.err.println(
getTextResource("rmid.restart.group.warning"));
e.printStackTrace();
}
}
}
示例13: main
import java.rmi.activation.ActivationSystem; //导入依赖的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);
}
}
示例14: main
import java.rmi.activation.ActivationSystem; //导入依赖的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);
}
}
示例15: main
import java.rmi.activation.ActivationSystem; //导入依赖的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();
}
}
}