if (callback == null) {
callback = new NullCallback();
} else if (callback instanceof ProcedureArgumentCacher) {
((ProcedureArgumentCacher)callback).setArgs(parameters);
}
StoredProcedureInvocation invocation =
new StoredProcedureInvocation(m_handle.getAndIncrement(), procName, parameters);
Integer site_id = null;
if (m_catalog != null) {
Procedure catalog_proc = m_catalogContext.procedures.getIgnoreCase(procName);
if (catalog_proc != null) {
// OPTIMIZATION: If we have the the catalog, then we'll send just
// the procId. This reduces the number of strings that we need to
// allocate on the server side.
invocation.setProcedureId(catalog_proc.getId());
// OPTIMIZATION: If this isn't a sysproc, then we can tell them
// what the base partition for this request will be
if ((hints == null || hints.basePartition == HStoreConstants.NULL_PARTITION_ID) &&
catalog_proc.getSystemproc() == false) {
try {
int partition = m_pEstimator.getBasePartition(invocation);
if (partition != HStoreConstants.NULL_PARTITION_ID) {
site_id = m_partitionSiteXref[partition];
invocation.setBasePartition(partition);
}
} catch (Exception ex) {
throw new RuntimeException("Failed to estimate base partition for new invocation of '" + procName + "'", ex);
}
}
}
}
if (hints != null && hints.basePartition != HStoreConstants.NULL_PARTITION_ID) {
invocation.setBasePartition(hints.basePartition);
}
if (m_blockingQueue) {
long start = ProfileMeasurement.getTime();
while (!m_distributer.queue(invocation, callback, expectedSerializedSize, true, site_id)) {