{
/* Has the activation class changed? */
if (gc != ps.getActivationClass())
{
GeneratedClass newGC;
// 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();
}
/*
** If we get here, it means 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.