Package network

Source Code of network.StatusManager

package network;

import msg.Message;
import msg.MessageSender;
import util.Constants;
import util.Globals;

public class StatusManager
{
    boolean newStatus;
   
    public StatusManager(boolean status)
    {
        newStatus = status;
    }
   

    /**
     * Entrada principal a la actualizacion de estados al resto de hosts
     * @param status
     */
    public static void broadCastNewStatus(boolean status)
    {
        Globals.online = status;  
    }

   
    public static void updateAnotherHostStatus(Host host, boolean status)
    {
        // Nuevo mensaje de estado
        Message errorMessage = new Message();
        errorMessage.setSender(host.getHostName());
        errorMessage.setSenderIP(host.getHostIP());
        errorMessage.setReceiver(Globals.localHostName);
        errorMessage.setReceiverIP(Globals.localIP);
        errorMessage.setMessageContent(status);
        errorMessage.setMessageKind(Constants.MESSAGE_KIND_STATUS);
        errorMessage.setToAll(false);
       
        new Thread(new MessageSender(errorMessage)).start();

    }
   
   
}
TOP

Related Classes of network.StatusManager

TOP
Copyright © 2018 www.massapi.com. 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.