public Sequence<? extends Item> eval(Sequence<? extends Item> contextSeq, DynamicContext dynEnv)
throws XQueryException {
if(_result != null) {
return _result;
}
final ILock lock = _lock;
if(_exported && !lock.isLocked()) {
throw new IllegalStateException("ThreadVariable#" + getName()
+ " should not called by this thread: " + Thread.currentThread().getName());
}
lock.lock();
try {
if(_catchedException != null) {
throw _catchedException;
}
final Sequence result = _result;
if(result == null) {
throw new XQueryException("Result of ThreadedVariable#" + getName()
+ " was illegally null");
}
return result;
} finally {
lock.unlock();
this._dynEnv = null;
//this._result = null;
}
}