/* Has the activation class changed or has the activation been
* invalidated? */
if (gc != ps.getActivationClass() || !ac.isValid())
{
GeneratedClass newGC;
if (gc != ps.getActivationClass()) {
// ensure the statement is valid by rePreparing it.
// DERBY-3260: If someone else reprepares the statement at
// the same time as we do, there's a window between the
// calls to rePrepare() and getActivationClass() when the
// activation class can be set to null, leading to
// NullPointerException being thrown later. Therefore,
// synchronize on ps to close the window.
synchronized (ps) {
ps.rePrepare(getLanguageConnectionContext());
newGC = ps.getActivationClass();
}
} else {
// Reuse the generated class, we just want a new activation
// since the old is no longer valid.
newGC = gc;
}
/*
** If we get here, it means the Activation has been invalidated
** or the PreparedStatement has been recompiled. Get a new
** Activation and check whether the parameters are compatible.
** If so, transfer the parameters from the old Activation to
** the new one, and make that the current Activation. If not,
** throw an exception.
*/
BaseActivation newAC = (BaseActivation) newGC.newInstance(lcc);
DataTypeDescriptor[] newParamTypes = ps.getParameterTypes();
/*
** Link the new activation to the prepared statement.