Package com.sun.sgs.app

Examples of com.sun.sgs.app.ManagedReference


     * @param child to remove
     * @return true if the child was removed, false if the cell was not a child of
     * this cell.
     */
    public boolean removeChild(CellMO child) {
        ManagedReference childRef = AppContext.getDataManager().createReference(child);
       
        if (childCellRefs.remove(childRef)) {
            try {
                child.setParent(null);
                if (live) {
View Full Code Here


         * @return the protocol in use by that session, or null if the
         * sessionId does not exist
         */
        public CommunicationsProtocol get(ClientSession session) {
            DataManager dm = AppContext.getDataManager();
            ManagedReference sessionRef = dm.createReference(session);
           
            return protocolMap.get(sessionRef);
        }
View Full Code Here

    public void clientDisconnected(WonderlandClientSender sender, WonderlandClientID clientID) {
        logger.fine("SasProvider client disconnected.");
        SasServer server = (SasServer) serverRef.get();
          
        ManagedReference providerRef = server.providerDisconnected(sender, clientID);
        if (providerRef != null) {

            ProviderMessagesInFlight messagesInFlight = getProviderMessagesInFlight();
            if (messagesInFlight != null) {
                messagesInFlight.removeMessagesForProvider(providerRef);
            }

            RunningAppInfo runningApps = getRunningApps();
            if (runningApps != null) {
                runningApps.removeAppInfosForProvider(providerRef);
            }

            ProviderProxy provider = (ProviderProxy) providerRef.get();
            if (provider != null) {
                provider.cleanup();
            }
        }
    }
View Full Code Here

        throws InstantiationException
    {
        logger.severe("Provider tryLaunch, clientID = " + clientID);
        logger.severe("command = " + command);

        ManagedReference thisRef = AppContext.getDataManager().createReference(this);

        SasProviderLaunchMessage msg = new SasProviderLaunchMessage(executionCapability, appName, command, cellID);

        // Record this message so we can match it up with its corresponding status message
        logger.info("message ID = " + msg.getMessageID());
View Full Code Here

     * TODO: someday: currently assumes that there is only one app running per cell.
     */
    public void appStop (CellID cellID) {

        // Get the launch message ID which will identify the app to the provider
        ManagedReference thisRef = AppContext.getDataManager().createReference(this);
        MessageID launchMessageID = SasProviderConnectionHandler.getLaunchMessageIDForCellAndProvider(
                                                                      thisRef, cellID);

        // Send a stop message to the provider
        if (launchMessageID != null) {
View Full Code Here

       
        // TODO: for now everything uses xremwin
        String execCap = "xremwin";

        ProviderProxy provider = new ProviderProxy(clientID, sender);
        ManagedReference providerRef = AppContext.getDataManager().createReference(provider);
        provider.addExecutionCapability(execCap);

        // Add to execution capability list
        LinkedList<ManagedReference> providers = execCapToProviderList.get(execCap);
        if (providers == null) {
View Full Code Here

     * A reference to the provider proxy for that client is returned. It is the callers
     * responsibility to properly clean up the provider proxy.
     */
    ManagedReference providerDisconnected(WonderlandClientSender sender, WonderlandClientID clientID) {
        logger.info("Sas provider disconnnected, clientID = " + clientID);
        ManagedReference providerRefToRemove = null;

        // TODO: for now everything uses xremwin
        String execCap = "xremwin";

        // Remove provider from execution capability list
View Full Code Here

        // Construct the launch request
        // TODO: someday: allow multiple apps to be launched per cell.
        LaunchRequest launchReq = new LaunchRequest(cellID, executionCapability, appName, command);

        ManagedReference providerRef = requestLaunch(launchReq);
        return new SasLaunchInfo(launchReq.cellID, launchReq.executionCapability, providerRef);
    }
View Full Code Here

            AppContext.getDataManager().markForUpdate(this);
            return null;
        }

        // TODO: someday: Right now we just try only the first provider. Eventually try multiple providers.
        ManagedReference providerRef = providers.getFirst();
        if (providerRef == null) {
            throw new InstantiationException("Cannot find a provider for " +
                                             launchReq.executionCapability);
        }

        // Now request the provider to launch the app
        launchReq.setProvider(providerRef);
        launchesInFlight.put(launchReq.cellID, launchReq);
        ProviderProxy provider = (ProviderProxy) providerRef.get();
        provider.tryLaunch(launchReq.cellID, launchReq.executionCapability, launchReq.appName,
                           launchReq.command);

        return providerRef;
    }
View Full Code Here

            LinkedList<ManagedReference> providers = execCapToProviderList.get(executionCapability);
            if (providers == null || providers.size() <= 0) {
                continue;
            }
            // TODO: someday: weed out providers already tried
            ManagedReference providerRef = providers.getFirst();
            ProviderProxy provider = (ProviderProxy) providerRef.get();

            // Remove request from pending list while it is in flight */
            reqs.remove(req);

            // Now request the newly selected provider to launch the app
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.ManagedReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.