@Override public String toString() { if (!detaching) { boolean isAttached = isAttached(); String string = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("path", getPath()).toString(); if (!isAttached) { detach(); } return string; } else { return super.toString(); } }
private void writeObject(ObjectOutputStream output) throws IOException { if (isAttached()) { log.warn("Undetached JcrItemModel "+getPath()); T object = this.getObject(); if (object != null) { TraceMonitor.trace(object); } if (RuntimeConfigurationType.DEPLOYMENT.equals(Application.get().getConfigurationType())) { detach(); } } output.defaultWriteObject(); }
@Override public void detach() { if (isAttached()) { T object = this.getObject(); if (object != null) { TraceMonitor.release(object); } } detaching = true; save(); super.detach(); detaching = false; }