當前位置: 首頁>>代碼示例>>Java>>正文


Java NoSuchObjectException類代碼示例

本文整理匯總了Java中java.rmi.NoSuchObjectException的典型用法代碼示例。如果您正苦於以下問題:Java NoSuchObjectException類的具體用法?Java NoSuchObjectException怎麽用?Java NoSuchObjectException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NoSuchObjectException類屬於java.rmi包,在下文中一共展示了NoSuchObjectException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: unexportObject

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:32,代碼來源:PortableRemoteObject.java

示例2: unregisterTargetsForORB

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
public void unregisterTargetsForORB(org.omg.CORBA.ORB orb)
{
    for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
    {
        java.lang.Object key = e.nextElement();
        Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key);

        // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set.
        // We can ignore this because it means the tie is not connected to an ORB.
        try {
            if (orb == getTie(target).orb()) {
                try {
                    unexportObject(target);
                } catch( java.rmi.NoSuchObjectException ex ) {
                    // We neglect this exception if at all if it is
                    // raised. It is not harmful.
                }
            }
        } catch (BAD_OPERATION bad) {
            /* Ignore */
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:Util.java

示例3: unexportObject

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Remove the remote object, obj, from the RMI runtime. If
 * successful, the object can no longer accept incoming RMI calls.
 * If the force parameter is true, the object is forcibly unexported
 * even if there are pending calls to the remote object or the
 * remote object still has calls in progress.  If the force
 * parameter is false, the object is only unexported if there are
 * no pending or in progress calls to the object.
 *
 * @param obj the remote object to be unexported
 * @param force if true, unexports the object even if there are
 * pending or in-progress calls; if false, only unexports the object
 * if there are no pending or in-progress calls
 * @return true if operation is successful, false otherwise
 * @exception NoSuchObjectException if the remote object is not
 * currently exported
 */
public static boolean unexportObject(Remote obj, boolean force)
     throws java.rmi.NoSuchObjectException
 {
     synchronized (tableLock) {
         Target target = getTarget(obj);
         if (target == null) {
             throw new NoSuchObjectException("object not exported");
         } else {
             if (target.unexport(force)) {
                 removeTarget(target);
                 return true;
             } else {
                 return false;
             }
         }
     }
 }
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:35,代碼來源:ObjectTable.java

示例4: checkInactiveGroup

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
private void checkInactiveGroup() {
    boolean groupMarkedInactive = false;
    synchronized (this) {
        if (active.size() == 0 && lockedIDs.size() == 0 &&
            groupInactive == false)
        {
            groupInactive = true;
            groupMarkedInactive = true;
        }
    }

    if (groupMarkedInactive) {
        try {
            super.inactiveGroup();
        } catch (Exception ignoreDeactivateFailure) {
        }

        try {
            UnicastRemoteObject.unexportObject(this, true);
        } catch (NoSuchObjectException allowUnexportedGroup) {
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:ActivationGroupImpl.java

示例5: toStub

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
@Override
public Remote toStub(final Remote obj) throws NoSuchObjectException {
    if (System.getSecurityManager() == null) {
        return PortableRemoteObject.toStub(obj);
    } else {
        try {
            return AccessController.doPrivileged(new PrivilegedExceptionAction<Remote>() {

                @Override
                public Remote run() throws Exception {
                    return PortableRemoteObject.toStub(obj);
                }
            }, STUB_ACC);
        } catch (PrivilegedActionException e) {
            if (e.getException() instanceof NoSuchObjectException) {
                throw (NoSuchObjectException)e.getException();
            }
            throw new RuntimeException("Unexpected exception type", e.getException());
        }
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:IIOPProxyImpl.java

示例6: testNoConnect

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
private static void testNoConnect(int port, int rmiPort) throws Exception {
    try {
        testConnect(port, rmiPort);
        throw new Exception("Didn't expect the management agent running");
    } catch (Exception e) {
        Throwable t = e;
        while (t != null) {
            if (t instanceof NoSuchObjectException ||
                t instanceof ConnectException ||
                t instanceof SSLHandshakeException) {
                break;
            }
            t = t.getCause();
        }
        if (t == null) {
            throw new Exception("Unexpected exception", e);
        }
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:JMXStartStopTest.java

示例7: shutdown

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Terminates all {@link TLCWorker}s currently running concurrently by
 * gracefully unregistering with RMI. Additionally it terminates each
 * keep-alive timer.
 */
public static void shutdown() {
	// Exit the keepAliveTimer
	if (keepAliveTimer != null) {
		keepAliveTimer.cancel();
	}
	
	// Exit and unregister all worker threads
	for (int i = 0; i < runnables.length; i++) {
		TLCWorker worker = runnables[i].getTLCWorker();
		try {
			if (worker != null) {
				worker.exit();
			}
		} catch (NoSuchObjectException e) {
			// may happen, ignore
		}
	}
	
	fts = null;
	runnables = new TLCWorkerRunnable[0];
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:27,代碼來源:TLCWorker.java

示例8: stop

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
public void stop() throws IOException {
	if (connector != null) {
		try {
			connector.stop();
		} finally {
			connector = null;
		}
	}
	if (rmiRegistry != null) {
		try {
			UnicastRemoteObject.unexportObject(rmiRegistry, true);
		} catch (NoSuchObjectException e) {
			throw new IOException("Could not un-export our RMI registry", e);
		} finally {
			rmiRegistry = null;
		}
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:19,代碼來源:JMXReporter.java

示例9: destroy

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Unbind the RMI service from JNDI on bean factory shutdown.
 */
@Override
public void destroy() throws NamingException, NoSuchObjectException {
	if (logger.isInfoEnabled()) {
		logger.info("Unbinding RMI service from JNDI location [" + this.jndiName + "]");
	}
	this.jndiTemplate.unbind(this.jndiName);
	PortableRemoteObject.unexportObject(this.exportedObject);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:JndiRmiServiceExporter.java

示例10: unexportObjectSilently

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Unexport the registered RMI object, logging any exception that arises.
 */
private void unexportObjectSilently() {
	try {
		UnicastRemoteObject.unexportObject(this.exportedObject, true);
	}
	catch (NoSuchObjectException ex) {
		if (logger.isWarnEnabled()) {
			logger.warn("RMI object for service '" + this.serviceName + "' isn't exported anymore", ex);
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:RmiServiceExporter.java

示例11: toStub

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:44,代碼來源:PortableRemoteObject.java

示例12: toStub

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public static Remote toStub (Remote obj)
    throws NoSuchObjectException {

    if (proDelegate != null) {
        return proDelegate.toStub(obj);
    }
    return null;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:PortableRemoteObject.java

示例13: unexportObject

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public static void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (proDelegate != null) {
        proDelegate.unexportObject(obj);
    }

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:16,代碼來源:PortableRemoteObject.java

示例14: toStub

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Returns the stub for the remote object <code>obj</code> passed
 * as a parameter. This operation is only valid <i>after</i>
 * the object has been exported.
 * @param obj the remote object whose stub is needed
 * @return the stub for the remote object, <code>obj</code>.
 * @exception NoSuchObjectException if the stub for the
 * remote object could not be found.
 * @since 1.2
 */
public static Remote toStub(Remote obj) throws NoSuchObjectException {
    if (obj instanceof RemoteStub ||
        (obj != null &&
         Proxy.isProxyClass(obj.getClass()) &&
         Proxy.getInvocationHandler(obj) instanceof
         RemoteObjectInvocationHandler))
    {
        return obj;
    } else {
        return sun.rmi.transport.ObjectTable.getStub(obj);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:RemoteObject.java

示例15: incrementCallCount

import java.rmi.NoSuchObjectException; //導入依賴的package包/類
/**
 * Increment call count.
 */
synchronized void incrementCallCount() throws NoSuchObjectException {

    if (disp != null) {
        callCount ++;
    } else {
        throw new NoSuchObjectException("object not accepting new calls");
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:Target.java


注:本文中的java.rmi.NoSuchObjectException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。