/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* https://glassfish.dev.java.net/public/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* https://glassfish.dev.java.net/public/CDDLv1.0.html.
*
* If applicable add the following below this CDDL HEADER,
* with the fields enclosed by brackets "[]" replaced with
* your own identifying information: Portions Copyright
* [year] [name of copyright owner]
*/
/*
* @(#)BrokerInfo.java 1.12 05/02/06
*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*/
package com.sun.messaging.jmq.jmsserver.multibroker;
import java.io.*;
import java.net.InetAddress;
import com.sun.messaging.jmq.jmsserver.core.BrokerAddress;
import com.sun.messaging.jmq.util.UID;
/**
* This class encapsulates general information about a broker.
* Each broker maintains a list of <code> BrokerInfo </code> objects
* representing the brokers known to be in the same cluster.
*/
public class BrokerInfo implements Serializable {
static final long serialVersionUID = 6384851141864345643L;
public static boolean DEBUG = false;
private BrokerAddress brokerAddr = null;
private String description = null;
private long startTime = 0;
private boolean storeDirtyFlag = false;
private String heartbeatHostAddress = null ;
private int heartbeatPort = -1;
private int heartbeatInterval = 0;
private Integer clusterProtocolVersion = null;
public BrokerInfo() {
}
public Integer getClusterProtocolVersion() {
return clusterProtocolVersion;
}
public void setClusterProtocolVersion(Integer v) {
this.clusterProtocolVersion = v;
}
public void setBrokerAddr(BrokerAddress brokerAddr) {
this.brokerAddr = brokerAddr;
}
public BrokerAddress getBrokerAddr() {
return brokerAddr;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setStartTime(long startTime) {
this.startTime = startTime;
}
public long getStartTime() {
return startTime;
}
public void setStoreDirtyFlag(boolean storeDirtyFlag) {
this.storeDirtyFlag = storeDirtyFlag;
}
public boolean getStoreDirtyFlag() {
return storeDirtyFlag;
}
public void setHeartbeatHostAddress(String ip) {
heartbeatHostAddress = ip;
}
public String getHeartbeatHostAddress() {
return heartbeatHostAddress;
}
public void setHeartbeatPort(int p) {
heartbeatPort = p;
}
public int getHeartbeatPort() {
return heartbeatPort;
}
public void setHeartbeatInterval(int s) {
heartbeatInterval = s;
}
public int getHeartbeatInterval() {
return heartbeatInterval;
}
public String toString() {
StringBuffer sb = new StringBuffer(
"\n\tAddress = " + brokerAddr +
"\n\tStartTime = " + startTime +
((DEBUG == true) ? ("\n\tDescription = " + description +
"\n\tStoreDirty = " + storeDirtyFlag): "")+
"\n\tProtocolVersion = " + clusterProtocolVersion);
if (heartbeatHostAddress != null) {
sb.append("\n\tHeartbeatHost = " + heartbeatHostAddress +
"\n\tHeartbeatPort = " + heartbeatPort);
}
return sb.toString();
}
}
/*
* EOF
*/
|