public static void executeOnLeadNode(SnappySelectResultSet rs, GfxdResultCollector<Object> rc, String sql, boolean enableStreaming , long connId) throws StandardException { // TODO: KN probably username, statement id and connId to be sent in // execution and of course tx id when transaction will be supported. LeadNodeExecutionContext ctx = new LeadNodeExecutionContext(connId); LeadNodeExecutorMsg msg = new LeadNodeExecutorMsg(sql, ctx, rc); try { msg.executeFunction(enableStreaming, false, rs, true); } catch (SQLException se) { throw Misc.processFunctionException( "SnappyActivation::execute", se, null, null); } }
@Override protected void executeFunction(boolean enableStreaming) throws StandardException, SQLException { try { super.executeFunction(enableStreaming); } catch (RuntimeException re) { throw handleLeadNodeRuntimeException(re); } }
@Override protected LeadNodeExecutorMsg clone() { final LeadNodeExecutorMsg msg = new LeadNodeExecutorMsg(this.sql, this.schema, this.ctx, (GfxdResultCollector<Object>)this.userCollector, this.pvs, this.isPreparedStatement(), this.isPreparedPhase(), this.isUpdateOrDelete()); msg.exec = this.exec; return msg; }
CallbackFactoryProvider.getClusterCallbacks().setLeadClassLoader(); try { if (isPreparedStatement() && !isPreparedPhase()) { getParams(); appendFields(str); SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_QUERYDISTRIB, "LeadNodeExecutorMsg.execute: Got sql = " + str.toString()); InternalDistributedMember m = this.getSenderForReply(); final Version v = m.getVersionObject(); exec = CallbackFactoryProvider.getClusterCallbacks().getSQLExecute( sql, schema, ctx, v, this.isPreparedStatement(), this.isPreparedPhase(), this.pvs); SnappyResultHolder srh = new SnappyResultHolder(exec, isUpdateOrDelete()); this.endMessage(); if (GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_QUERYDISTRIB, throw getExceptionToSendToServer(ex); } finally { Thread.currentThread().setContextClassLoader(origLoader);
private static void prepareOnLeadNode(SnappyPrepareResultSet rs, GfxdResultCollector<Object> rc, String sql, long connId, String schema, ParameterValueSet pvs, boolean isUpdateOrDelete, LanguageConnectionContext lcc) throws StandardException { // TODO: KN probably username, statement id and connId to be sent in // execution and of course tx id when transaction will be supported. LeadNodeExecutionContext ctx = new LeadNodeExecutionContext(connId); LeadNodeExecutorMsg msg = new LeadNodeExecutorMsg(sql, schema, ctx, rc, pvs, true, true, isUpdateOrDelete); if (lcc != null) { lcc.getTransactionExecute().releaseAllLocks(true, true); } try { msg.executeFunction(false, false, rs, true); } catch (RuntimeException | SQLException ex) { Exception e = LeadNodeExecutorMsg.handleLeadNodeException(ex, sql); throw Misc.processFunctionException( "SnappyActivation::prepareOnLeadNode", e, null, null); } }
InternalDistributedMember m = this.getSenderForReply(); final Version v = m.getVersionObject(); exec = CallbackFactoryProvider.getClusterCallbacks().getSQLExecute( this.endMessage(); if (GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_QUERYDISTRIB,
@Override protected LeadNodeExecutorMsg clone() { final LeadNodeExecutorMsg msg = new LeadNodeExecutorMsg(this.sql, this.ctx, (GfxdResultCollector<Object>)this.userCollector); msg.exec = this.exec; return msg; }
@Override protected void execute() throws Exception { if (GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_QUERYDISTRIB, "GetLeadNodeInfoAsStringMessage.execute: "); } try { String result = null; switch (this.requestType) { case GET_JARS: result = handleGetJarsRequest(); break; default: throw new IllegalArgumentException("GetLeadNodeInfoAsStringMessage:" + " Unknown data request type: " + this.requestType); } lastResult(result, false, false, true); } catch (Exception ex) { throw LeadNodeExecutorMsg.getExceptionToSendToServer(ex); } }
private static void executeOnLeadNode(SnappySelectResultSet rs, GfxdResultCollector<Object> rc, String sql, boolean enableStreaming, long connId, String schema, ParameterValueSet pvs, boolean isPreparedStatement, boolean isUpdateOrDelete, LanguageConnectionContext lcc) throws StandardException { // TODO: KN probably username, statement id and connId to be sent in // execution and of course tx id when transaction will be supported. LeadNodeExecutionContext ctx = new LeadNodeExecutionContext(connId); LeadNodeExecutorMsg msg = new LeadNodeExecutorMsg(sql, schema, ctx, rc, pvs, isPreparedStatement, false, isUpdateOrDelete); // release all locks before sending the message else it can lead to deadlocks if (lcc != null) { lcc.getTransactionExecute().releaseAllLocks(true, true); } // wait for any pending transactions before routing new operations to lead final TXManagerImpl.TXContext txContext = TXManagerImpl .currentTXContext(); if (txContext != null) { txContext.waitForPendingCommit(); } try { msg.executeFunction(enableStreaming, false, rs, true); } catch (RuntimeException | SQLException ex) { Exception e = LeadNodeExecutorMsg.handleLeadNodeException(ex, sql); throw Misc.processFunctionException( "SnappyActivation::executeOnLeadNode", e, null, null); } }
InternalDistributedMember m = this.getSenderForReply(); final Version v = m.getVersionObject(); exec = CallbackFactoryProvider.getClusterCallbacks().getSQLExecute( this.endMessage(); if (GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_QUERYDISTRIB,
@Override protected LeadNodeExecutorMsg clone() { final LeadNodeExecutorMsg msg = new LeadNodeExecutorMsg(this.sql, this.ctx, (GfxdResultCollector<Object>)this.userCollector); msg.exec = this.exec; return msg; }
@Override protected void execute() throws Exception { if (GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_QUERYDISTRIB, "LeadNodeGetStatsMessage.execute: "); } try { Object stats = CallbackFactoryProvider.getStoreCallbacks().getSnappyTableStats(); lastResult(stats, false, false, true); } catch (Exception ex) { throw LeadNodeExecutorMsg.getExceptionToSendToServer(ex); } }
public static void executeOnLeadNode(SnappySelectResultSet rs, GfxdResultCollector<Object> rc, String sql, boolean enableStreaming , long connId) throws StandardException { // TODO: KN probably username, statement id and connId to be sent in // execution and of course tx id when transaction will be supported. LeadNodeExecutionContext ctx = new LeadNodeExecutionContext(connId); LeadNodeExecutorMsg msg = new LeadNodeExecutorMsg(sql, ctx, rc); try { msg.executeFunction(enableStreaming, false, rs, true); } catch (SQLException se) { throw Misc.processFunctionException( "SnappyActivation::execute", se, null, null); } }
() -> new LeadNodeExecutionContext()); DSFIDFactory.registerGemFireXDClass(LEAD_NODE_EXN_MSG, () -> new LeadNodeExecutorMsg()); DSFIDFactory.registerGemFireXDClass(SNAPPY_RESULT_HOLDER, () -> new SnappyResultHolder());
public void setup(Object res, int numMembers) throws StandardException { Collection<?> resultHolderList = (Collection<?>)res; try { Iterator<?> srhIterator = resultHolderList.iterator(); // expect at least one result (for metadata) this.firstResultHolder = (SnappyResultHolder)srhIterator.next(); } catch (RuntimeException ex) { ex = LeadNodeExecutorMsg.handleLeadNodeRuntimeException(ex); throw Misc.processFunctionException("SnappyPrepareResultSet:setup", ex, null, null); } }
@Override protected void execute() throws Exception { if (GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_QUERYDISTRIB, "LeadNodeSmartConnectorOpMsg.execute: "); } try { CallbackFactoryProvider.getStoreCallbacks().performConnectorOp(this.ctx); lastResult(Boolean.TRUE, false, false, true); } catch (Exception ex) { throw LeadNodeExecutorMsg.getExceptionToSendToServer(ex); } }
@Override protected void executeFunction(boolean enableStreaming) throws StandardException, SQLException { try { super.executeFunction(enableStreaming); } catch (RuntimeException re) { throw LeadNodeExecutorMsg.handleLeadNodeRuntimeException(re); } }
public static Exception handleLeadNodeException(Exception e, String sql) { final Exception cause; if (e instanceof RuntimeException) { cause = handleLeadNodeRuntimeException((RuntimeException)e); } else { cause = e; } return GemFireXDRuntimeException.newRuntimeException("Failure for " + sql, cause); }
@Override protected void executeFunction(boolean enableStreaming) throws StandardException, SQLException { try { super.executeFunction(enableStreaming); } catch (RuntimeException re) { throw LeadNodeExecutorMsg.handleLeadNodeRuntimeException(re); } }
@Override protected void executeFunction(boolean enableStreaming) throws StandardException, SQLException { try { super.executeFunction(enableStreaming); } catch (RuntimeException re) { throw LeadNodeExecutorMsg.handleLeadNodeRuntimeException(re); } }