|
@@ -16,30 +16,32 @@
|
|
* limitations under the License.
|
|
* limitations under the License.
|
|
*/
|
|
*/
|
|
|
|
|
|
-package org.apache.ambari.server.state.live;
|
|
|
|
|
|
+package org.apache.ambari.server.state.live.svccomphost;
|
|
|
|
|
|
import org.apache.ambari.server.state.ConfigVersion;
|
|
import org.apache.ambari.server.state.ConfigVersion;
|
|
import org.apache.ambari.server.state.StackVersion;
|
|
import org.apache.ambari.server.state.StackVersion;
|
|
|
|
|
|
public class ServiceComponentHostState {
|
|
public class ServiceComponentHostState {
|
|
|
|
|
|
|
|
+ private final int hashCodePrime = 131;
|
|
|
|
+
|
|
private ConfigVersion configVersion;
|
|
private ConfigVersion configVersion;
|
|
private StackVersion stackVersion;
|
|
private StackVersion stackVersion;
|
|
- private ServiceComponentHostLiveState state;
|
|
|
|
|
|
+ private ServiceComponentHostLiveState liveState;
|
|
|
|
|
|
public ServiceComponentHostState(ConfigVersion configVersion,
|
|
public ServiceComponentHostState(ConfigVersion configVersion,
|
|
StackVersion stackVersion, ServiceComponentHostLiveState state) {
|
|
StackVersion stackVersion, ServiceComponentHostLiveState state) {
|
|
super();
|
|
super();
|
|
this.configVersion = configVersion;
|
|
this.configVersion = configVersion;
|
|
this.stackVersion = stackVersion;
|
|
this.stackVersion = stackVersion;
|
|
- this.state = state;
|
|
|
|
|
|
+ this.liveState = state;
|
|
}
|
|
}
|
|
|
|
|
|
public ServiceComponentHostState() {
|
|
public ServiceComponentHostState() {
|
|
super();
|
|
super();
|
|
this.configVersion = null;
|
|
this.configVersion = null;
|
|
this.stackVersion = null;
|
|
this.stackVersion = null;
|
|
- this.state = ServiceComponentHostLiveState.INIT;
|
|
|
|
|
|
+ this.liveState = ServiceComponentHostLiveState.INIT;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -71,13 +73,13 @@ public class ServiceComponentHostState {
|
|
* @return the state
|
|
* @return the state
|
|
*/
|
|
*/
|
|
public ServiceComponentHostLiveState getLiveState() {
|
|
public ServiceComponentHostLiveState getLiveState() {
|
|
- return state;
|
|
|
|
|
|
+ return liveState;
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* @param state the state to set
|
|
* @param state the state to set
|
|
*/
|
|
*/
|
|
public void setState(ServiceComponentHostLiveState state) {
|
|
public void setState(ServiceComponentHostLiveState state) {
|
|
- this.state = state;
|
|
|
|
|
|
+ this.liveState = state;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -95,7 +97,38 @@ public class ServiceComponentHostState {
|
|
} else {
|
|
} else {
|
|
out += "null";
|
|
out += "null";
|
|
}
|
|
}
|
|
- out += ", state=" + state;
|
|
|
|
|
|
+ out += ", state=" + liveState;
|
|
return out;
|
|
return out;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean equals(Object object) {
|
|
|
|
+ if (!(object instanceof ServiceComponentHostState)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (this == object) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ ServiceComponentHostState s = (ServiceComponentHostState) object;
|
|
|
|
+
|
|
|
|
+ if (configVersion != null ?
|
|
|
|
+ !configVersion.equals(s.configVersion) : s.configVersion != null) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (stackVersion != null ?
|
|
|
|
+ !stackVersion.equals(s.stackVersion) : s.stackVersion != null) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return liveState.equals(s.liveState);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int hashCode() {
|
|
|
|
+ int result = configVersion != null ? configVersion.hashCode() : 0;
|
|
|
|
+ result += hashCodePrime * result +
|
|
|
|
+ ( stackVersion != null ? stackVersion.hashCode() : 0 );
|
|
|
|
+ result += liveState.hashCode();
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|