We need this method in here because of putForExternalRead
329170
final Object visitNonTxDataWriteCommand(InvocationContext ctx, DataWriteCommand command) {
      if (hasSkipLocking(command) || !shouldLockKey(command)) {
         return invokeNext(ctx, command);
      }

      LockPromise lockPromise = lockAndRecord(ctx, command.getKey(), getLockTimeoutMillis(command));
      return nonTxLockAndInvokeNext(ctx, command, lockPromise, unlockAllReturnHandler);
   }
1080314
private void waitForThread() {
        if ((this.thread != null) && this.thread.isAlive()) {
            try {
                this.thread.join();
            } catch (final InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
80828
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
	boolean pcCreated = false;
	PageContext pc = ThreadLocalPageContext.get();
	try {
	    if (pc == null) {
		pcCreated = true;
		ConfigWeb config = (ConfigWeb) ThreadLocalPageContext.getConfig();
		Pair[] parr = new Pair[0];
		pc = ThreadUtil.createPageContext(config, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, "localhost", "/", "", new Cookie[0], parr, null, parr, new StructImpl(), true,
			-1);

	    }

	    // reading fails for serialized data from Lucee version 4.1.2.002
	    String name = in.readUTF();

	    // oldest style of serialisation
	    if (name.startsWith("evaluateComponent('") && name.endsWith("})")) {
		readExternalOldStyle(pc, name);
		return;
	    }

	    // newest version (5.2.8.16) also holds the path
	    String path = null;
	    int index = name.indexOf('|');
	    if (index != -1) {
		path = name.substring(index + 1);
		name = name.substring(0, index);
	    }

	    String md5 = in.readUTF();
	    Struct _this = Caster.toStruct(in.readObject(), null);
	    Struct _var = Caster.toStruct(in.readObject(), null);
	    String template = in.readUTF();

	    if (pc != null && pc.getBasePageSource() == null && !StringUtil.isEmpty(template)) {
		Resource res = ResourceUtil.toResourceNotExisting(pc, template);
		PageSource ps = pc.toPageSource(res, null);
		if (ps != null) {
		    ((PageContextImpl) pc).setBase(ps);
		}
	    }

	    try {
		ComponentImpl other = (ComponentImpl) EvaluateComponent.invoke(pc, name, md5, _this, _var);
		_readExternal(other);
	    }
	    catch (PageException pe) {
		boolean done = false;
		if (!StringUtil.isEmpty(path)) {
		    Resource res = ResourceUtil.toResourceExisting(pc, path, false, null);
		    if (res != null) {
			PageSource ps = pc.toPageSource(res, null);
			if (ps != null) {
			    try {
				ComponentImpl other = ComponentLoader.loadComponent(pc, ps, name, false, true);
				_readExternal(other);
				done = true;
			    }
			    catch (PageException pe2) {
				throw ExceptionUtil.toIOException(pe2);
			    }
			}
		    }
		}
		if (!done) throw ExceptionUtil.toIOException(pe);
	    }
	}
	finally {
	    if (pcCreated) ThreadLocalPageContext.release();
	}
    }
889511
public void readExternal(PofReader reader) throws IOException {
        super.readExternal(reader);
        language = reader.readString(10);
        init();
    }
133284
@Override
    public void readExternal(PofReader reader) throws IOException {
        factory  = (Factory<List<E>>) reader.readObject(0);
        delegate = factory.create();
        reader.readCollection(1, delegate);
    }
1013119
@Override
    public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException {
	out.writeObject(new LinkedHashMap(this));
    }
432912
public void writeExternal(ObjectOutput out) throws IOException
   {
      out.writeInt(eventType);

      byte[] buff = sessionId.getBytes(Constants.DEFAULT_ENCODING);
      out.writeInt(buff.length);
      out.write(buff);

      int listSize = items.size();
      out.writeInt(listSize);
      for (int i = 0; i < listSize; i++)
      {
         out.writeObject(items.get(i));
      }

      if (pairId != null)
      {
         out.writeInt(NOT_NULL_VALUE);
         buff = pairId.getBytes(Constants.DEFAULT_ENCODING);
         out.writeInt(buff.length);
         out.write(buff);
      }
      else
      {
         out.writeInt(NULL_VALUE);
      }
   }
713303
void writeFinished(Object error) {
        checkThread();
        writingBuffer = null;
        Promise wp = this.writePromise;
        writePromise = null;
        if ( ! wp.isSettled() ) {
            if ( error != null )
                wp.reject(error);
            else
                wp.resolve();
        }
    }
601350
@Override
    public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException {
	try {
	    out.writeObject(new HashMap(this));
	}
	catch (NotSerializableException nse) {
	    NotSerializableException tmp = new NotSerializableException(nse.getMessage() + ":" + entries());
	    tmp.initCause(nse);
	    throw tmp;
	}
    }
1087771
@Override
  public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    int k_max = knnDistances.length;
    out.writeInt(k_max);
    for(int i = 0; i < k_max; i++) {
      out.writeDouble(knnDistances[i]);
    }
  }
1315496
public void readExternal(PofReader reader)
            throws IOException {
        super.readExternal(reader);
        numInc = (Number) reader.readObject(10);
        fPostInc = reader.readBoolean(11);
    }
477787
@Override
    public void readExternal(ObjectInput s) throws IOException, ClassNotFoundException {
        // writeExternal has already mapped filechannel content into a real buffer
        // so on reading it back, we just set up as though convert() was already
        // called
        this.status = WsByteBuffer.STATUS_BUFFER;
        super.readExternal(s);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "readExternal(ObjectInput)");
        }
    }
915213
@SuppressWarnings("unchecked")
    @Override
    public void readExternal(ObjectInput in) throws IOException,
            ClassNotFoundException {
        this.functions = (Map<String, Function>) in.readObject();
    }
812463
public synchronized void setReadOnly()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setReadOnly");

      // And actually mark the real buffers as read-only too
      for (int x = 0; x < dataList.size(); x++)
      {
         WsByteBuffer buff = dataList.get(x);
         buff.setReadOnly(true);
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setReadOnly");
   }
47723
@Override
  public void writeExternal(ObjectOutput out) throws IOException {
    super.writeExternal(out);
    splitHistory.writeExternal(out);
  }
324640
@Override
    public void readExternal(PofReader reader)
            throws IOException {
        name = reader.readString(0);
        mutator = reader.readBoolean(1);
        args = reader.readObjectArray(2, new Object[0]);
    }
135128
@Override
    public void readExternal(ObjectInput s) throws IOException, ClassNotFoundException {
        super.readExternal(s);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(this, tc, "Deserializing " + this);
        }
    }