/** * Gets the time left to live of the IAttributes object. * <p> * This is the (max life + create time) - current time. * @return The TimeToLiveSeconds value */ @Override public long getTimeToLiveSeconds() { final long now = System.currentTimeMillis(); final long timeFactorForMilliseconds = getTimeFactorForMilliseconds(); return ( this.getCreateTime() + this.getMaxLife() * timeFactorForMilliseconds - now ) / 1000; }
/** * Gets the time left to live of the IAttributes object. * <p> * This is the (max life + create time) - current time. * @return The TimeToLiveSeconds value */ @Override public long getTimeToLiveSeconds() { final long now = System.currentTimeMillis(); final long timeFactorForMilliseconds = getTimeFactorForMilliseconds(); return ( this.getCreateTime() + this.getMaxLife() * timeFactorForMilliseconds - now ) / 1000; }
/** * For logging and debugging the element IElementAttributes. * <p> * @return String info about the values. */ @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append( "[ IS_LATERAL = " ).append( IS_LATERAL ); dump.append( ", IS_SPOOL = " ).append( IS_SPOOL ); dump.append( ", IS_REMOTE = " ).append( IS_REMOTE ); dump.append( ", IS_ETERNAL = " ).append( IS_ETERNAL ); dump.append( ", MaxLifeSeconds = " ).append( this.getMaxLife() ); dump.append( ", IdleTime = " ).append( this.getIdleTime() ); dump.append( ", CreateTime = " ).append( this.getCreateTime() ); dump.append( ", LastAccessTime = " ).append( this.getLastAccessTime() ); dump.append( ", getTimeToLiveSeconds() = " ).append( String.valueOf( getTimeToLiveSeconds() ) ); dump.append( ", createTime = " ).append( String.valueOf( createTime ) ).append( " ]" ); return dump.toString(); }
/** * For logging and debugging the element IElementAttributes. * <p> * @return String info about the values. */ @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append( "[ IS_LATERAL = " ).append( IS_LATERAL ); dump.append( ", IS_SPOOL = " ).append( IS_SPOOL ); dump.append( ", IS_REMOTE = " ).append( IS_REMOTE ); dump.append( ", IS_ETERNAL = " ).append( IS_ETERNAL ); dump.append( ", MaxLifeSeconds = " ).append( this.getMaxLife() ); dump.append( ", IdleTime = " ).append( this.getIdleTime() ); dump.append( ", CreateTime = " ).append( this.getCreateTime() ); dump.append( ", LastAccessTime = " ).append( this.getLastAccessTime() ); dump.append( ", getTimeToLiveSeconds() = " ).append( String.valueOf( getTimeToLiveSeconds() ) ); dump.append( ", createTime = " ).append( String.valueOf( createTime ) ).append( " ]" ); return dump.toString(); } }
/** * Copies the attributes, including references to event handlers. * <p> * @return a copy of the Attributes */ @Override public IElementAttributes copy() { try { // need to make this more efficient. Just want to insure // a proper copy ElementAttributes attr = new ElementAttributes(); attr.setIdleTime( this.getIdleTime() ); attr.setIsEternal( this.getIsEternal() ); attr.setIsLateral( this.getIsLateral() ); attr.setIsRemote( this.getIsRemote() ); attr.setIsSpool( this.getIsSpool() ); attr.setMaxLife(this.getMaxLife()); attr.addElementEventHandlers( this.eventHandlers ); return attr; } catch ( Exception e ) { return new ElementAttributes(); } }