protected boolean isStopped() { return getStopTimestamp() != null; }
@Override protected void onStop(Session session) { if (session instanceof SimpleSession) { SimpleSession ss = (SimpleSession) session; Date stopTs = ss.getStopTimestamp(); ss.setLastAccessTime(stopTs); } onChange(session); }
/** * Returns the hashCode. If the {@link #getId() id} is not {@code null}, its hashcode is returned immediately. * If it is {@code null}, an attributes-based hashCode will be calculated and returned. * <p/> * Do your best to ensure {@code SimpleSession} instances receive an ID very early in their lifecycle to * avoid the more expensive attributes-based calculation. * * @return this object's hashCode * @since 1.0 */ @Override public int hashCode() { Serializable id = getId(); if (id != null) { return id.hashCode(); } int hashCode = getStartTimestamp() != null ? getStartTimestamp().hashCode() : 0; hashCode = 31 * hashCode + (getStopTimestamp() != null ? getStopTimestamp().hashCode() : 0); hashCode = 31 * hashCode + (getLastAccessTime() != null ? getLastAccessTime().hashCode() : 0); hashCode = 31 * hashCode + Long.valueOf(Math.max(getTimeout(), 0)).hashCode(); hashCode = 31 * hashCode + Boolean.valueOf(isExpired()).hashCode(); hashCode = 31 * hashCode + (getHost() != null ? getHost().hashCode() : 0); hashCode = 31 * hashCode + (getAttributes() != null ? getAttributes().hashCode() : 0); return hashCode; }
/** * Provides an attribute-based comparison (no ID comparison) - incurred <em>only</em> when 'this' or the * session object being compared for equality do not have a session id. * * @param ss the SimpleSession instance to compare for equality. * @return true if all the attributes, except the id, are equal to this object's attributes. * @since 1.0 */ protected boolean onEquals(SimpleSession ss) { return (getStartTimestamp() != null ? getStartTimestamp().equals(ss.getStartTimestamp()) : ss.getStartTimestamp() == null) && (getStopTimestamp() != null ? getStopTimestamp().equals(ss.getStopTimestamp()) : ss.getStopTimestamp() == null) && (getLastAccessTime() != null ? getLastAccessTime().equals(ss.getLastAccessTime()) : ss.getLastAccessTime() == null) && (getTimeout() == ss.getTimeout()) && (isExpired() == ss.isExpired()) && (getHost() != null ? getHost().equals(ss.getHost()) : ss.getHost() == null) && (getAttributes() != null ? getAttributes().equals(ss.getAttributes()) : ss.getAttributes() == null); }
protected boolean isStopped() { return getStopTimestamp() != null; }
@Override protected void onStop(Session session) { if (session instanceof SimpleSession) { SimpleSession ss = (SimpleSession) session; Date stopTs = ss.getStopTimestamp(); ss.setLastAccessTime(stopTs); } onChange(session); }
/** * Returns the hashCode. If the {@link #getId() id} is not {@code null}, its hashcode is returned immediately. * If it is {@code null}, an attributes-based hashCode will be calculated and returned. * <p/> * Do your best to ensure {@code SimpleSession} instances receive an ID very early in their lifecycle to * avoid the more expensive attributes-based calculation. * * @return this object's hashCode * @since 1.0 */ @Override public int hashCode() { Serializable id = getId(); if (id != null) { return id.hashCode(); } int hashCode = getStartTimestamp() != null ? getStartTimestamp().hashCode() : 0; hashCode = 31 * hashCode + (getStopTimestamp() != null ? getStopTimestamp().hashCode() : 0); hashCode = 31 * hashCode + (getLastAccessTime() != null ? getLastAccessTime().hashCode() : 0); hashCode = 31 * hashCode + Long.valueOf(Math.max(getTimeout(), 0)).hashCode(); hashCode = 31 * hashCode + Boolean.valueOf(isExpired()).hashCode(); hashCode = 31 * hashCode + (getHost() != null ? getHost().hashCode() : 0); hashCode = 31 * hashCode + (getAttributes() != null ? getAttributes().hashCode() : 0); return hashCode; }
/** * Provides an attribute-based comparison (no ID comparison) - incurred <em>only</em> when 'this' or the * session object being compared for equality do not have a session id. * * @param ss the SimpleSession instance to compare for equality. * @return true if all the attributes, except the id, are equal to this object's attributes. * @since 1.0 */ protected boolean onEquals(SimpleSession ss) { return (getStartTimestamp() != null ? getStartTimestamp().equals(ss.getStartTimestamp()) : ss.getStartTimestamp() == null) && (getStopTimestamp() != null ? getStopTimestamp().equals(ss.getStopTimestamp()) : ss.getStopTimestamp() == null) && (getLastAccessTime() != null ? getLastAccessTime().equals(ss.getLastAccessTime()) : ss.getLastAccessTime() == null) && (getTimeout() == ss.getTimeout()) && (isExpired() == ss.isExpired()) && (getHost() != null ? getHost().equals(ss.getHost()) : ss.getHost() == null) && (getAttributes() != null ? getAttributes().equals(ss.getAttributes()) : ss.getAttributes() == null); }
protected boolean isStopped() { return getStopTimestamp() != null; }
@Override protected void onStop(Session session) { if (session instanceof SimpleSession) { SimpleSession ss = (SimpleSession) session; Date stopTs = ss.getStopTimestamp(); ss.setLastAccessTime(stopTs); } onChange(session); }
/** * Returns the hashCode. If the {@link #getId() id} is not {@code null}, its hashcode is returned immediately. * If it is {@code null}, an attributes-based hashCode will be calculated and returned. * <p/> * Do your best to ensure {@code SimpleSession} instances receive an ID very early in their lifecycle to * avoid the more expensive attributes-based calculation. * * @return this object's hashCode * @since 1.0 */ @Override public int hashCode() { Serializable id = getId(); if (id != null) { return id.hashCode(); } int hashCode = getStartTimestamp() != null ? getStartTimestamp().hashCode() : 0; hashCode = 31 * hashCode + (getStopTimestamp() != null ? getStopTimestamp().hashCode() : 0); hashCode = 31 * hashCode + (getLastAccessTime() != null ? getLastAccessTime().hashCode() : 0); hashCode = 31 * hashCode + Long.valueOf(Math.max(getTimeout(), 0)).hashCode(); hashCode = 31 * hashCode + Boolean.valueOf(isExpired()).hashCode(); hashCode = 31 * hashCode + (getHost() != null ? getHost().hashCode() : 0); hashCode = 31 * hashCode + (getAttributes() != null ? getAttributes().hashCode() : 0); return hashCode; }
/** * Provides an attribute-based comparison (no ID comparison) - incurred <em>only</em> when 'this' or the * session object being compared for equality do not have a session id. * * @param ss the SimpleSession instance to compare for equality. * @return true if all the attributes, except the id, are equal to this object's attributes. * @since 1.0 */ protected boolean onEquals(SimpleSession ss) { return (getStartTimestamp() != null ? getStartTimestamp().equals(ss.getStartTimestamp()) : ss.getStartTimestamp() == null) && (getStopTimestamp() != null ? getStopTimestamp().equals(ss.getStopTimestamp()) : ss.getStopTimestamp() == null) && (getLastAccessTime() != null ? getLastAccessTime().equals(ss.getLastAccessTime()) : ss.getLastAccessTime() == null) && (getTimeout() == ss.getTimeout()) && (isExpired() == ss.isExpired()) && (getHost() != null ? getHost().equals(ss.getHost()) : ss.getHost() == null) && (getAttributes() != null ? getAttributes().equals(ss.getAttributes()) : ss.getAttributes() == null); }
public void setSession(Session session) { this.id = session.getId(); this.startTimestamp = session.getStartTimestamp(); this.lastAccessTime = session.getLastAccessTime(); this.timeout = session.getTimeout(); this.host = session.getHost(); if (session instanceof SimpleSession) { this.stopTimestamp = ((SimpleSession) session).getStopTimestamp(); this.expired = ((SimpleSession) session).isExpired(); this.attributes = ((SimpleSession) session).getAttributes(); } }