當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。