Package com.sun.enterprise.admin.servermgmt

Examples of com.sun.enterprise.admin.servermgmt.RuntimeStatus


        int restartCount = 0;
        if(instances != null){
            List<Map> instanceMap = (List) instances;
            for(Map oneRow : instanceMap){
                String name = (String)oneRow.get("name");
    RuntimeStatus rsts = JMXUtil.getRuntimeStatus(name);
    int statusCode = JMXUtil.getRuntimeStatusCode(rsts);
    switch(statusCode) {
                  case Status.kInstanceRunningCode: {
                     boolean restart = rsts.isRestartNeeded();
                     if (restart){
                       restartCount++;
                     } else {
                       runningCount++;
                     }
View Full Code Here


        int running = 0;
        Map<String,ClusteredServerConfig> serverMap = AMXUtil.getDomainConfig().getClusterConfigMap().get(clusterName).getClusteredServerConfigMap();
        if(serverMap != null) {
            for(String key : serverMap.keySet()){
                String serverName = serverMap.get(key).getName();
    RuntimeStatus rsts = JMXUtil.getRuntimeStatus(serverName);
    int statusCode = JMXUtil.getRuntimeStatusCode(rsts);
                if(statusCode == Status.kInstanceStoppingCode || statusCode == Status.kInstanceNotRunningCode || statusCode == Status.kInstanceFailedCode) {
                    stopped++;
                   
                }
View Full Code Here

        List result = new ArrayList();
        try{
            Map<String,ClusteredServerConfig> serverMap = AMXUtil.getDomainConfig().getClusterConfigMap().get(cluster).getClusteredServerConfigMap();
            for(String key : serverMap.keySet()){
                String name = serverMap.get(key).getName();
    RuntimeStatus rsts = JMXUtil.getRuntimeStatus(name);
    int statusCode = JMXUtil.getRuntimeStatusCode(rsts);
                if (state == null)
                    result.add(name);
                else{
                    if(statusCode == Status.kInstanceRunningCode){
View Full Code Here

    {
        final MBeanServer mbeanServer = getMBeanServer();
        final OldServersMBean oldServers =
            OldConfigProxies.getInstance( mbeanServer ).getOldServersMBean( );
           
        final RuntimeStatus status = oldServers.getRuntimeStatus( serverName );
       
        return status;
    }
View Full Code Here

        //                AMXUtil.getJ2EEDomain().getJ2EEServerMap().get(instanceName), true);
        String status = JMXUtil.getStatusForDisplay("com.sun.appserv:type=server,name="+instanceName+",category=config");
        handlerCtx.setOutputValue("status", status);      
        handlerCtx.setOutputValue("nodeAgentStatus", sts);
        handlerCtx.setOutputValue("debugPort", msg);
  RuntimeStatus rsts = JMXUtil.getRuntimeStatus(instanceName);
        int state = JMXUtil.getRuntimeStatusCode(rsts);
        handlerCtx.setOutputValue("running", (state == Status.kInstanceRunningCode) ? true : false);
    }    
View Full Code Here

      * The String returned will be the <img .. > + state
      */
     public static String getStatusForDisplay(String objName){
                String status = null;
                try {
                    RuntimeStatus sts = (RuntimeStatus)JMXUtil.invoke(objName, "getRuntimeStatus", null, null);
                        boolean restartNeeded = ((RuntimeStatus)sts).isRestartNeeded();
                        Status s = ((RuntimeStatus)sts).getStatus();
                        int statusCode = s.getStatusCode();
                        String statusString = "";
                        String imageString = "";
View Full Code Here

      * The AMX API's do not give an accurate state when starting an instance.
      * This object must implmenent StateManageable.
      */
     public static RuntimeStatus getRuntimeStatus(String name) {
    String objName = "com.sun.appserv:type=server,name="+name+",category=config";
    RuntimeStatus sts = null;
                try {
                    sts = (RuntimeStatus)JMXUtil.invoke(objName, "getRuntimeStatus", null, null);
                }catch(Exception ex){
      //squelching it on purpose
     }
View Full Code Here

     * @param instanceName the server instance name. If the server instance does not exist
     * a newly constructed RuntimeStatus (in a not running state) will be returned.
     * @return The RuntimeStatus of the given server instance.
     */   
    public synchronized RuntimeStatus getStatus(String instanceName) {
        RuntimeStatus result = (RuntimeStatus)get(instanceName);
        if (result == null) {
            result = new RuntimeStatus(instanceName);
            result.setStatus(new Status(Status.kInstanceNotRunningCode));
            put(result.getName(), result);
        }
        //If we are in the state of running or not running, then we need to ensure
        //that our internal state is in sync with that of the admin channel. We need to
        //avoid our internal state getting out of sync.
        if (result.isRunning() || result.isStopped()) {
            updateStatusFromAdminChannel(instanceName, result.getStatus().getStatusCode());
        }
        return result;
    }
View Full Code Here

     * @return newly udated RuntimeStatus
     */   
    public synchronized RuntimeStatus updateStatus(String instanceName,
        int statusCode)
    {
        RuntimeStatus result = getStatus(instanceName);
        result.setStatus(new Status(statusCode));
        return result;
    }
View Full Code Here

    }
    private synchronized boolean updateStatusConditionally(String instanceName,
        int requiredStatusCode, int newStatusCode)        
    {              
        RuntimeStatus result = getStatus(instanceName);
        if (result.getStatus().getStatusCode() != requiredStatusCode) {       
            return false;
        } else {
            result.setStatus(new Status(newStatusCode));        
            return true;
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.admin.servermgmt.RuntimeStatus

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.