Package com.sun.enterprise.instance

Examples of com.sun.enterprise.instance.ServerManager


        return ( match );
    }

    private Object findServerInstance(String instanceName)
    {
        ServerManager sm = ServerManager.instance();
  Server serverInstance = null;
/*        boolean isAdminServer = instanceName.equals(
                                    ServerManager.ADMINSERVER_ID); */
        if (! sm.instanceExists(instanceName) /*&& !isAdminServer*/)
        {
            return null;
        }

        try
View Full Code Here


        {
      String msg = localStrings.getString( "admin.server.core.mbean.config.null_name" );
            throw new IllegalArgumentException( msg );
        }

        ServerManager sm = ServerManager.instance();
       
        /* get running status */
        if(!sm.instanceExists(instanceName))
        {
            String msg = localStrings.getString(
                    "admin.server.core.mbean.config.instance_does_not_exist",
                    instanceName);
            throw new ControlException(msg);
        }
        boolean alive = false;
        RMIClient serverInstancePinger = AdminChannel.getRMIClient(instanceName);
        alive = serverInstancePinger.isAlive();
        if(alive)
        {
      String msg = localStrings.getString(
                    "admin.server.core.mbean.config.delete_alive_instance",
                    instanceName);
            throw new ControlException(msg);
        }

       
        try
        {
            // Unregister all instance related MBeans
            MBeanServer mbs = MBeanServerFactory.getMBeanServer();
            ObjectName[] objectNames  = ObjectNameHelper.
                    getInstanceRelatedMBeans(mbs, instanceName);
            for(int i=0; i<objectNames.length; i++)
            {
                try
                {
                    mbs.unregisterMBean(objectNames[i]);
                }
                catch(Exception e)
                {
                    sLogger.log(Level.CONFIG, "delete_unregistration_failed",
                            objectNames[i]);
                }
            }
            // Message to Config to refresh contexts
            InstanceEnvironment instanceEnvironment = new
                    InstanceEnvironment(instanceName);
            String fileUrl  = instanceEnvironment.getConfigFilePath();
            ConfigFactory.removeConfigContext(fileUrl);

            String instanceRoot = instanceEnvironment.getInstancesRoot();
            deleteJMSProviderInstance(instanceRoot, instanceName);
           
            // Now stop it delete the files from file system */
            sm.deleteServerInstance(instanceName);
            sLogger.log(Level.INFO, "mbean.del_instance_ok", instanceName);
        }
        catch(Exception e)
        {
            sLogger.log(Level.WARNING, "mbean.del_instance_failed", e);
View Full Code Here

    return ( fOut );
  }

  public String[] listServerInstances()
  {
            ServerManager sm = ServerManager.instance();
            boolean countAdmin = false;
            String[] instanceNames =
                    sm.getInstanceNames (countAdmin); //do not count admin itself.
            return ( instanceNames );
  }
View Full Code Here

    mInstanceId = instanceId;
    }
   
    public void run()
    {
  ServerManager svrMgr  = ServerManager.instance();
  int testPort      = 9000;
  /* testPort is actually not used for stopping the instance,
    it's use is limited to construct the InstanceDefinition
    class
  */
  try
  {
    InstanceDefinition instanceDef = new InstanceDefinition(mInstanceId,
      testPort);
    svrMgr.stopServerInstance (instanceDef);
  }
  catch (Exception e)
  {
    //This Exception can be ignored.
  }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.instance.ServerManager

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.