@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getProcessName() == null) ? 0 : getProcessName().hashCode()); hashCode = prime * hashCode + ((getSuspensionReason() == null) ? 0 : getSuspensionReason().hashCode()); return hashCode; }
/** * <p> * The name of the suspended process. * </p> * * @param processName * The name of the suspended process. * @return Returns a reference to this object so that method calls can be chained together. */ public SuspendedProcess withProcessName(String processName) { setProcessName(processName); return this; }
/** * <p> * The reason that the process was suspended. * </p> * * @param suspensionReason * The reason that the process was suspended. * @return Returns a reference to this object so that method calls can be chained together. */ public SuspendedProcess withSuspensionReason(String suspensionReason) { setSuspensionReason(suspensionReason); return this; }
/** * Checks if the load balancer addition is disabled or not. * * @param asg * - The ASG object for which the status needs to be checked * @return - true, if the load balancer addition is suspended, false * otherwise. */ private boolean isAddToLoadBalancerSuspended(AutoScalingGroup asg) { List<SuspendedProcess> suspendedProcesses = asg.getSuspendedProcesses(); for (SuspendedProcess process : suspendedProcesses) { if (PROP_ADD_TO_LOAD_BALANCER.equals(process.getProcessName())) { return true; } } return false; }
public SuspendedProcess unmarshall(StaxUnmarshallerContext context) throws Exception { SuspendedProcess suspendedProcess = new SuspendedProcess(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return suspendedProcess; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("ProcessName", targetDepth)) { suspendedProcess.setProcessName(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("SuspensionReason", targetDepth)) { suspendedProcess.setSuspensionReason(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return suspendedProcess; } } } }
/** * Checks if the load balancer addition is disabled or not. * * @param asg * - The ASG object for which the status needs to be checked * @return - true, if the load balancer addition is suspended, false * otherwise. */ private boolean isAddToLoadBalancerSuspended(AutoScalingGroup asg) { List<SuspendedProcess> suspendedProcesses = asg.getSuspendedProcesses(); for (SuspendedProcess process : suspendedProcesses) { if (PROP_ADD_TO_LOAD_BALANCER.equals(process.getProcessName())) { return true; } } return false; }
public SuspendedProcess unmarshall(StaxUnmarshallerContext context) throws Exception { SuspendedProcess suspendedProcess = new SuspendedProcess(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 2; while (true) { int xmlEvent = context.nextEvent(); if (xmlEvent == XmlPullParser.END_DOCUMENT) break; if (xmlEvent == XmlPullParser.START_TAG) { if (context.testExpression("ProcessName", targetDepth)) { suspendedProcess.setProcessName(StringStaxUnmarshaller.getInstance() .unmarshall(context)); continue; } if (context.testExpression("SuspensionReason", targetDepth)) { suspendedProcess.setSuspensionReason(StringStaxUnmarshaller.getInstance() .unmarshall(context)); continue; } } else if (xmlEvent == XmlPullParser.END_TAG) { if (context.getCurrentDepth() < originalDepth) { break; } } } return suspendedProcess; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SuspendedProcess == false) return false; SuspendedProcess other = (SuspendedProcess) obj; if (other.getProcessName() == null ^ this.getProcessName() == null) return false; if (other.getProcessName() != null && other.getProcessName().equals(this.getProcessName()) == false) return false; if (other.getSuspensionReason() == null ^ this.getSuspensionReason() == null) return false; if (other.getSuspensionReason() != null && other.getSuspensionReason().equals(this.getSuspensionReason()) == false) return false; return true; }
private void checkSuspendedProcesses(AutoScalingGroup asg) throws ECSException { if (asg.getSuspendedProcesses() == null || !asg.getSuspendedProcesses().stream() .map((SuspendedProcess t) -> t.getProcessName()) //it's a pity aws lib doesn't have these as constants or enums .filter((String t) -> "AZRebalance".equals(t)) .findAny().isPresent()) { schedulerBackend.suspendProcess(asg.getAutoScalingGroupName(), "AZRebalance"); } }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getProcessName() != null) sb.append("ProcessName: ").append(getProcessName()).append(","); if (getSuspensionReason() != null) sb.append("SuspensionReason: ").append(getSuspensionReason()); sb.append("}"); return sb.toString(); }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getProcessName() == null) ? 0 : getProcessName().hashCode()); hashCode = prime * hashCode + ((getSuspensionReason() == null) ? 0 : getSuspensionReason().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SuspendedProcess == false) return false; SuspendedProcess other = (SuspendedProcess) obj; if (other.getProcessName() == null ^ this.getProcessName() == null) return false; if (other.getProcessName() != null && other.getProcessName().equals(this.getProcessName()) == false) return false; if (other.getSuspensionReason() == null ^ this.getSuspensionReason() == null) return false; if (other.getSuspensionReason() != null && other.getSuspensionReason().equals(this.getSuspensionReason()) == false) return false; return true; } }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getProcessName() != null) sb.append("ProcessName: " + getProcessName() + ","); if (getSuspensionReason() != null) sb.append("SuspensionReason: " + getSuspensionReason()); sb.append("}"); return sb.toString(); }
public void marshall(SuspendedProcess _suspendedProcess, Request<?> request, String _prefix) { String prefix; if (_suspendedProcess.getProcessName() != null) { prefix = _prefix + "ProcessName"; String processName = _suspendedProcess.getProcessName(); request.addParameter(prefix, StringUtils.fromString(processName)); } if (_suspendedProcess.getSuspensionReason() != null) { prefix = _prefix + "SuspensionReason"; String suspensionReason = _suspendedProcess.getSuspensionReason(); request.addParameter(prefix, StringUtils.fromString(suspensionReason)); } }