当前位置: 首页>>代码示例>>Java>>正文


Java ExportException类代码示例

本文整理汇总了Java中java.rmi.server.ExportException的典型用法代码示例。如果您正苦于以下问题:Java ExportException类的具体用法?Java ExportException怎么用?Java ExportException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExportException类属于java.rmi.server包,在下文中一共展示了ExportException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exportObject

import java.rmi.server.ExportException; //导入依赖的package包/类
/**
 * Export this object, create the skeleton and stubs for this
 * dispatcher.  Create a stub based on the type of the impl,
 * initialize it with the appropriate remote reference. Create the
 * target defined by the impl, dispatcher (this) and stub.
 * Export that target via the Ref.
 */
public Remote exportObject(Remote impl, Object data,
                           boolean permanent)
    throws RemoteException
{
    Class<?> implClass = impl.getClass();
    Remote stub;

    try {
        stub = Util.createProxy(implClass, getClientRef(), forceStubUse);
    } catch (IllegalArgumentException e) {
        throw new ExportException(
            "remote object implements illegal remote interface", e);
    }
    if (stub instanceof RemoteStub) {
        setSkeleton(impl);
    }

    Target target =
        new Target(impl, this, stub, ref.getObjID(), permanent);
    ref.exportObject(target);
    hashToMethod_Map = hashToMethod_Maps.get(implClass);
    return stub;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:UnicastServerRef.java

示例2: exportObject

import java.rmi.server.ExportException; //导入依赖的package包/类
/**
 * Export this object, create the skeleton and stubs for this
 * dispatcher.  Create a stub based on the type of the impl,
 * initialize it with the appropriate remote reference. Create the
 * target defined by the impl, dispatcher (this) and stub.
 * Export that target via the Ref.
 */
public Remote exportObject(Remote impl, Object data,
                           boolean permanent)
    throws RemoteException
{
    Class implClass = impl.getClass();
    Remote stub;

    try {
        stub = Util.createProxy(implClass, getClientRef(), forceStubUse);
    } catch (IllegalArgumentException e) {
        throw new ExportException(
            "remote object implements illegal remote interface", e);
    }
    if (stub instanceof RemoteStub) {
        setSkeleton(impl);
    }

    Target target =
        new Target(impl, this, stub, ref.getObjID(), permanent);
    ref.exportObject(target);
    hashToMethod_Map = hashToMethod_Maps.get(implClass);
    return stub;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:31,代码来源:UnicastServerRef.java

示例3: Listener

import java.rmi.server.ExportException; //导入依赖的package包/类
public Listener() throws ConfigurationException, ExportException {
    exporter = (Exporter) Config.getNonNullEntry(config, BROWSER, "listenerExporter",
            Exporter.class,
            new BasicJeriExporter(
            TcpServerEndpoint.getInstance(0),
            new BasicILFactory(),
            false, false));
    proxy = (RemoteEventListener) exporter.export(this);
}
 
开发者ID:apache,项目名称:river-container,代码行数:10,代码来源:Browser.java

示例4: testRegistration

import java.rmi.server.ExportException; //导入依赖的package包/类
@Test
public void testRegistration() throws MonitorException, ExportException {
    MonitorRegistration registration = monitor.register("spacely-sprockets",
                                                        System.getProperty("user.name"),
                                                        TimeUnit.MINUTES.toMillis(5));
    assertNotNull(registration.getMonitor());
    assertNotNull(registration);
    MonitorListener monitorListener = new MonitorListener();
    EventRegistration eventRegistration = monitor.register(new MonitorEventFilter(System.getProperty("user.name")),
                                                           monitorListener.getRemoteEventListener(),
                                                           TimeUnit.MINUTES.toMillis(5));
    assertNotNull(eventRegistration);
    monitor.update(registration, Monitor.Status.SUBMITTED, null);
    monitor.update(registration, Monitor.Status.COMPLETED, null);

    registration = monitor.register("spacely-sprockets",
                                    System.getProperty("user.name"),
                                    TimeUnit.MINUTES.toMillis(5));
    monitor.update(registration, Monitor.Status.SUBMITTED, null);
    monitor.update(registration, Monitor.Status.FAILED, null);
    assertTrue(monitorListener.states.size()==4);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:23,代码来源:MonitorImplTest.java

示例5: testRegistrationWithNames

import java.rmi.server.ExportException; //导入依赖的package包/类
@Test
public void testRegistrationWithNames() throws MonitorException, ExportException {
    MonitorRegistration registration = monitor.register("spacely-sprockets",
                                                        System.getProperty("user.name"),
                                                        TimeUnit.MINUTES.toMillis(5));
    assertNotNull(registration.getMonitor());
    assertNotNull(registration);
    MonitorListener monitorListener = new MonitorListener();
    List<String> names = new ArrayList<>();
    names.add(registration.getIdentifier());
    EventRegistration eventRegistration = monitor.register(new MonitorEventFilter(null, names),
                                                           monitorListener.getRemoteEventListener(),
                                                           TimeUnit.MINUTES.toMillis(5));
    assertNotNull(eventRegistration);
    monitor.update(registration, Monitor.Status.SUBMITTED, null);
    monitor.update(registration, Monitor.Status.COMPLETED, null);

    monitor.update(registration, Monitor.Status.SUBMITTED, null);
    monitor.update(registration, Monitor.Status.FAILED, null);
    assertTrue(monitorListener.states.size()==4);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:22,代码来源:MonitorImplTest.java

示例6: testRegistrationWithBadNames

import java.rmi.server.ExportException; //导入依赖的package包/类
@Test
public void testRegistrationWithBadNames() throws MonitorException, ExportException {
    MonitorRegistration registration = monitor.register("spacely-sprockets",
                                                        System.getProperty("user.name"),
                                                        TimeUnit.MINUTES.toMillis(5));
    assertNotNull(registration.getMonitor());
    assertNotNull(registration);
    MonitorListener monitorListener = new MonitorListener();
    List<String> names = new ArrayList<>();
    names.add(registration.getIdentifier()+"foo");
    EventRegistration eventRegistration = monitor.register(new MonitorEventFilter(System.getProperty("user.name"), names),
                                                           monitorListener.getRemoteEventListener(),
                                                           TimeUnit.MINUTES.toMillis(5));
    assertNotNull(eventRegistration);
    monitor.update(registration, Monitor.Status.SUBMITTED, null);
    monitor.update(registration, Monitor.Status.COMPLETED, null);

    monitor.update(registration, Monitor.Status.SUBMITTED, null);
    monitor.update(registration, Monitor.Status.FAILED, null);
    assertTrue(monitorListener.states.size()==0);
}
 
开发者ID:mwsobol,项目名称:SORCER,代码行数:22,代码来源:MonitorImplTest.java

示例7: putTarget

import java.rmi.server.ExportException; //导入依赖的package包/类
/**
 * Add target to object table.  If it is not a permanent entry, then
 * make sure that reaper thread is running to remove collected entries
 * and keep VM alive.
 */
static void putTarget(Target target) throws ExportException {
    ObjectEndpoint oe = target.getObjectEndpoint();
    WeakRef weakImpl = target.getWeakImpl();

    if (DGCImpl.dgcLog.isLoggable(Log.VERBOSE)) {
        DGCImpl.dgcLog.log(Log.VERBOSE, "add object " + oe);
    }

    synchronized (tableLock) {
        /**
         * Do nothing if impl has already been collected (see 6597112). Check while
         * holding tableLock to ensure that Reaper cannot process weakImpl in between
         * null check and put/increment effects.
         */
        if (target.getImpl() != null) {
            if (objTable.containsKey(oe)) {
                throw new ExportException(
                    "internal error: ObjID already in use");
            } else if (implTable.containsKey(weakImpl)) {
                throw new ExportException("object already exported");
            }

            objTable.put(oe, target);
            implTable.put(weakImpl, target);

            if (!target.isPermanent()) {
                incrementKeepAliveCount();
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:ObjectTable.java

示例8: start

import java.rmi.server.ExportException; //导入依赖的package包/类
public static String start() throws Exception {
    int serverPort = 12345;
    ObjectName name = new ObjectName("test", "foo", "bar");
    MBeanServer jmxServer = ManagementFactory.getPlatformMBeanServer();
    SteMBean bean = new Ste();
    jmxServer.registerMBean(bean, name);
    boolean exported = false;
    Random rnd = new Random(System.currentTimeMillis());
    do {
        try {
            LocateRegistry.createRegistry(serverPort);
            exported = true;
        } catch (ExportException ee) {
            if (ee.getCause() instanceof BindException) {
                serverPort = rnd.nextInt(10000) + 4096;
            } else {
                throw ee;
            }
        }

    } while (!exported);
    JMXServiceURL serverUrl = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + serverPort + "/test");
    JMXConnectorServer jmxConnector = JMXConnectorServerFactory.newJMXConnectorServer(serverUrl, null, jmxServer);
    jmxConnector.start();

    return serverUrl.toString();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:Server.java

示例9: createOrMakeRegistry

import java.rmi.server.ExportException; //导入依赖的package包/类
protected Registry createOrMakeRegistry(int port) throws RemoteException {
    try {
        return LocateRegistry.createRegistry(port);
    } catch (ExportException e) {
        return LocateRegistry.getRegistry(addr.getPort());
    }
}
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:8,代码来源:RmiServer.java

示例10: export

import java.rmi.server.ExportException; //导入依赖的package包/类
public Object export(Remote server, Class<?> remoteClass)
  throws RemoteException
{
  try {
    PortableRemoteObject.exportObject(server);
    POA poa = getPOA();
    Object servant = Util.getTie(server);
    Object ref = poa.servant_to_reference((Servant)servant);
    return PortableRemoteObject.narrow(ref, remoteClass);
  } catch(UserException e) {
    throw new ExportException("could not export corba stream servant", e);
  }
}
 
开发者ID:jahlborn,项目名称:rmiio,代码行数:14,代码来源:IIOPRemoteStreamExporter.java

示例11: exportObject

import java.rmi.server.ExportException; //导入依赖的package包/类
/**
 * Exports specified remote object through pre-initialized UnicastServerRef.
 * Returns info for exported object. If object has already been exported,
 * ExportException will be thrown.
 *
 * @param obj remote object to be exported
 * @param sref initialized UnicastServerRef to export object through
 * @param useProxyStubs If true then Proxy stubs will be generated if stub
 *        class could not be found in classpath and codebase; if false Proxy
 *        stubs will not be tried (this is needed for
 *        UnicastRemoteObject.exportObject(Remote) method because it
 *        returns RemoteStub class (but Proxy class could not be casted
 *        to it)
 * @param startListen if false, ServerSocket listening thread will not be
 *        started (this is used for DGC, for example); otherwise listening
 *        thread will be started and object becomes available for
 *        connections from clients
 * @param isSystem if true then existence of this object will not prevent
 *        VM from exiting (for example, for rmiregistry)
 *
 * @return stub for exported object
 *
 * @throws RemoteException if any exception occurred while exporting
 *         specified remote object
 */
public static Remote exportObject(Remote obj,
                                  UnicastServerRef sref,
                                  boolean useProxyStubs,
                                  boolean startListen,
                                  boolean isSystem)
        throws RemoteException {
    if (isExported(obj)) {
        // rmi.7B=Object {0} has already been exported.
        throw new ExportException(Messages.getString("rmi.7B", obj)); //$NON-NLS-1$
    }
    Remote stub = sref.exportObject(obj, null, useProxyStubs, startListen,
            isSystem);
    RMIReference rref = new RMIReference(obj, dgcQueue);
    RMIObjectInfo info = new RMIObjectInfo(
            rref, sref.getObjId(), sref, stub);
    exportedObjs.add(info);

    if (scav == null) {
        (scav = (Thread) AccessController.doPrivileged(
                new CreateThreadAction(new Scavenger(),
                        "Scavenger", false))).start(); //$NON-NLS-1$
    }

    if (isSystem) {
        rref.makeStrong(true);
    } else {
        ++nonSystemObjsNum;
    }
    return stub;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:56,代码来源:ExportManager.java

示例12: setUp

import java.rmi.server.ExportException; //导入依赖的package包/类
/**
 * Sets up the fixture, for example, open a network connection. This method
 * is called before a test is executed.
 */
@Override
protected void setUp() {
    errorMessage = "Connectin Error";
    causeMessage = "Caused Exception";
    cause = new ExportException(causeMessage);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:ExportExceptionTest.java


注:本文中的java.rmi.server.ExportException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。