Invokes the dataReceived method.  If the callback throws an exception
than the connection associated with it is invalidated.
340393
protected synchronized void invoke()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "invoke");
      try
      {
         // Pass details to implementor's conversation receive listener.
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBuffer(this, tc, data, 16, "data passed to dataReceived method");
         listener.dataReceived(data,
                               segmentType,
                               requestNumber,
                               priority,
                               allocatedFromPool,
                               partOfExchange,
                               conversation);
      }
      catch(Throwable t)
      {
         FFDCFilter.processException
            (t, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ReceiveListenerDataReceivedInvocation", JFapChannelConstants.RLDATARECEIVEDINVOKE_INVOKE_01);
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown by dataReceived");
         if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, t);

         // User has thrown an exception from data received method.  Probably
         // the best way to deal with this is to invalidate their connection.
         // That'll learn 'em.
         connection.invalidate(true, t, "exception thrown by dataReceived - "+t.getLocalizedMessage());  // D224570

      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "invoke");
   }
64804
function onSingleEntityReceived( serverResponse ) {
			if( !serverResponse.data[ configuration.entityName ] ) {
				throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
			}

			self.__entityCacheRaw = serverResponse.data;
			self.__onDataAvailable( serverResponse.data );
		}
903304
public void queueErrorOccurredInvocation(Connection connection,
                                               ReceiveListener listener,
                                               SIConnectionLostException exception,
                                               int segmentType,
                                               int requestNumber,
                                               int priority,
                                               Conversation conversation)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "queueErrorOccurredInvocation", new Object[] {connection, listener, exception, ""+segmentType, ""+requestNumber, ""+priority, conversation});

      AbstractInvocation invocation =
         allocateErrorOccurredInvocation(connection,
                                         listener,
                                         exception,
                                         segmentType,
                                         requestNumber,
                                         priority,
                                         conversation);
      queueInvocationCommon(invocation, (ConversationImpl)conversation);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "queueErrorOccurredInvocation");
   }
233274
@Override
	public boolean packetReceived(AbstractPacket packet)
    {
        AbstractQueryPacket query = (AbstractQueryPacket)packet;
    	AbstractResponsePacket response = null;
    	
    	// Process packet
        try
        {
            try
            {
                response = process(query);
            }
            catch (JMSException e)
            {
            	log.debug("#"+id+" process() failed with "+e.toString());
                response = new ErrorResponse(e);
            }
        }
        catch (Exception e)
        {
            log.error("#"+id+" Cannot process command",e);
        }
        
        // Send response
        if (response != null && query.isResponseExpected())
        {        	
            // Map endpoint id on response
            response.setEndpointId(query.getEndpointId());
            
	        try
	        {   
	            if (traceEnabled)
	                log.trace("#"+id+" Sending "+response);
	            transport.send(response);
	        }
	        catch (Exception e)
	        {
	            log.warn("#"+id+" Cannot send response to client : "+e.toString());
	            transport.close();
	        }
        }
        
        return localConnection != null; // Connection still valid ?
    }
1127277
public void hangupReceived() {
        if (!isHangingUp) {
            isHangingUp = true;

            if (null != listenerReference) {
                // Disconnect will clear the listenerReference, so grab a reference to the
                // listener while it's still alive since the listener will be notified in a
                // different (UI) thread
                final Listener listener = listenerReference.get();

                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    public void run() {
                        if (null != listener) {
                            listener.onHangup(RespokeCall.this);
                        }
                    }
                });
            }

            disconnect();
        }
    }
202679
public void invokeRequest (ClientObject caller, byte[] serializedAction,
        InvocationService.ResultListener listener)
    {
        NodeRequest request = null;
        try {
            ObjectInputStream oin =
                new ObjectInputStream(new ByteArrayInputStream(serializedAction));
            request = (NodeRequest)oin.readObject();
            _injector.injectMembers(request);
            request.invoke(listener);

        } catch (Exception e) {
            log.warning("Failed to execute node request",
                        "from", (caller == null) ? "self" : caller.who(),
                        "request", request, "serializedSize", serializedAction.length, e);
            listener.requestFailed("Failed to execute node request");
        }
    }
371193
public void onStateChange() {
        switch (dataChannel.state()) {
            case CONNECTING:
                break;

            case OPEN: {
                    if (null != callReference) {
                        RespokeCall call = callReference.get();
                        if (null != call) {
                            call.directConnectionDidOpen(this);
                        }
                    }

                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    public void run() {
                        if (null != listenerReference) {
                            Listener listener = listenerReference.get();
                            if (null != listener) {
                                listener.onOpen(RespokeDirectConnection.this);
                            }
                        }
                    }
                });
                }
                break;

            case CLOSING:
                break;

            case CLOSED: {
                    if (null != callReference) {
                        RespokeCall call = callReference.get();
                        if (null != call) {
                            call.directConnectionDidClose(this);
                        }
                    }

                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        public void run() {
                            if (null != listenerReference) {
                                Listener listener = listenerReference.get();
                                if (null != listener) {
                                    listener.onClose(RespokeDirectConnection.this);
                                }
                            }
                        }
                    });
                }
                break;
        }
    }
529896
private void handleInvoke(InvokeInstruction obj) {
        if (obj instanceof INVOKEDYNAMIC) {
            // should not happen
            return;
        }
        Type returnType = obj.getReturnType(getCPG());

        Location location = getLocation();

        if (trackValueNumbers) {
            try {
                ValueNumberFrame vnaFrame = vnaDataflow.getFactAtLocation(location);
                Set<ValueNumber> nonnullParameters = UnconditionalValueDerefAnalysis.checkAllNonNullParams(location, vnaFrame,
                        cpg, null, null, typeDataflow);

                if (!nonnullParameters.isEmpty()) {
                    IsNullValue kaboom = IsNullValue.noKaboomNonNullValue(location);
                    IsNullValueFrame frame = getFrame();
                    for (ValueNumber vn : nonnullParameters) {
                        IsNullValue knownValue = frame.getKnownValue(vn);
                        if (knownValue != null && !knownValue.isDefinitelyNotNull()) {
                            if (knownValue.isDefinitelyNull()) {
                                frame.setTop();
                                return;
                            }
                            frame.setKnownValue(vn, kaboom);
                        }
                        for (int i = 0; i < vnaFrame.getNumSlots(); i++) {
                            IsNullValue value = frame.getValue(i);
                            if (vnaFrame.getValue(i).equals(vn) && !value.isDefinitelyNotNull()) {
                                frame.setValue(i, kaboom);
                                if (value.isDefinitelyNull()) {
                                    frame.setTop();
                                    return;
                                }
                            }
                        }
                    }

                }
            } catch (DataflowAnalysisException e) {
                AnalysisContext.logError("Error looking up nonnull parameters for invoked method", e);
            }
        }
        // Determine if we are going to model the return value of this call.
        boolean modelCallReturnValue = MODEL_NONNULL_RETURN && returnType instanceof ReferenceType;

        if (!modelCallReturnValue) {
            // Normal case: Assume returned values are non-reporting non-null.
            handleNormalInstruction(obj);
        } else {
            // Special case: some special value is pushed on the stack for the
            // return value
            IsNullValue result = null;
            TypeFrame typeFrame;
            try {
                typeFrame = typeDataflow.getFactAtLocation(location);

                Set<XMethod> targetSet = Hierarchy2.resolveMethodCallTargets(obj, typeFrame, cpg);

                if (targetSet.isEmpty()) {
                    XMethod calledMethod = XFactory.createXMethod(obj, getCPG());
                    result = getReturnValueNullness(calledMethod);
                } else {
                    for (XMethod calledMethod : targetSet) {
                        IsNullValue pushValue = getReturnValueNullness(calledMethod);
                        if (result == null) {
                            result = pushValue;
                        } else {
                            result = IsNullValue.merge(result, pushValue);
                        }
                    }
                }
            } catch (DataflowAnalysisException e) {
                result = IsNullValue.nonReportingNotNullValue();
            } catch (ClassNotFoundException e) {
                result = IsNullValue.nonReportingNotNullValue();
            }
            modelInstruction(obj, getNumWordsConsumed(obj), getNumWordsProduced(obj), result);
            newValueOnTOS();
        }

    }
615811
def __callback(self, data):
        
        method = self.__cb_message
        if method is not None:
            try:
                method(data)
            except Exception as ex:
                _logger.exception("Error calling method: %s", ex)
634189
def _event_received(self, ref, data):
        
        match = self._resolve_match_data(ref, data)
        if match:
            if self.flag_to_set:
                self.flag_to_set.set()
            if self.callback:
                self.callback(EventMatch(ref, data, match))
            if self.__forget:
                self.forget()
943613
private void postProcess(ProcessMethodCallback callback, TransactionContext txContext,
                           InputDatum input, ProcessMethod.ProcessResult result) {
    InputContext inputContext = input.getInputContext();
    Throwable failureCause = null;
    FailureReason.Type failureType = FailureReason.Type.IO_ERROR;
    try {
      if (result.isSuccess()) {
        // If it is a retry input, force the dequeued entries into current transaction.
        if (input.getRetry() > 0) {
          input.reclaim();
        }
        txContext.finish();
      } else {
        failureCause = result.getCause();
        failureType = FailureReason.Type.USER;
        txContext.abort();
      }
    } catch (Throwable e) {
      LOG.error("Transaction operation failed: {}", e.getMessage(), e);
      failureType = FailureReason.Type.IO_ERROR;
      if (failureCause == null) {
        failureCause = e;
      }
      try {
        if (result.isSuccess()) {
          txContext.abort();
        }
      } catch (Throwable ex) {
        LOG.error("Fail to abort transaction: {}", inputContext, ex);
      }
    }

    try {
      if (failureCause == null) {
        callback.onSuccess(result.getEvent(), inputContext);
      } else {
        callback.onFailure(result.getEvent(), inputContext,
                           new FailureReason(failureType, failureCause.getMessage(), failureCause),
                           createInputAcknowledger(input));
      }
    } catch (Throwable t) {
      LOG.error("Failed to invoke callback.", t);
    }
  }
10411
void callErrorCallback(VirtualConnection inVC, IOException ioe) {
        // otherwise pass the error along to the channel above us, or close
        // the connection if nobody is above
        setPersistent(false);
        if (this.bEarlyReads && null != getAppReadCallback()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Early read failure calling error() on appside");
            }
            getAppReadCallback().error(inVC, ioe);
        } else if (null != getAppWriteCallback()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Calling write.error() on appside");
            }
            getAppWriteCallback().error(inVC, ioe);
        } else {
            // nobody above us, just close the connection
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "No appside, closing connection");
            }
            getLink().getDeviceLink().close(inVC, ioe);
        }
    }
927882
public void invokeMethod(String method, Object[] methodParams, IRemotingCallback callback) {
        try {
            RemotingWorker worker = new RemotingWorker(this, method, methodParams, callback);
            executor.execute(worker);
        } catch (Exception err) {
            log.warn("Exception invoking method: {}", method, err);
        }
    }
233040
public void accept(Context context) {
        if (null != callReference) {
            RespokeCall call = callReference.get();
            if (null != call) {
                call.directConnectionDidAccept(context);
            }
        }
    }
650042
public void queueDataReceivedInvocation(Connection connection,
                                              ReceiveListener listener,
                                              WsByteBuffer data,
                                              int segmentType,
                                              int requestNumber,
                                              int priority,
                                              boolean allocatedFromBufferPool,
                                              boolean partOfExchange,
                                              Conversation conversation)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "queueDataReceivedInvocation", new Object[] {connection, listener, data, ""+segmentType, ""+requestNumber, ""+priority, ""+allocatedFromBufferPool, ""+partOfExchange, conversation});

      int dataSize = 0;
      if (dispatcherEnabled)
         dataSize = data.position();                                                                                                      // D240062

      AbstractInvocation invocation =
         allocateDataReceivedInvocation(connection,
                                        listener,
                                        data,
                                        dataSize,
                                        segmentType,
                                        requestNumber,
                                        priority,
                                        allocatedFromBufferPool,
                                        partOfExchange,
                                        conversation);

      queueInvocationCommon(invocation, (ConversationImpl)conversation);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "queueDataReceivedInvocation");
   }
59400
private void onConnectSucceeded(){
        LOGGER.info("Accepted the connection.");

        isConnected = true;
        isConnecting = false;
        enableReadOnly();
        synchronized(connectHolder){
            connectHolder.notifyAll();
        }
    }
897452
@Override
	public void invoke(IN value) throws Exception {
		byte[] msg = schema.serialize(value);

		try {
			outputStream.write(msg);
			if (autoFlush) {
				outputStream.flush();
			}
		}
		catch (IOException e) {
			// if no re-tries are enable, fail immediately
			if (maxNumRetries == 0) {
				throw new IOException("Failed to send message '" + value + "' to socket server at "
						+ hostName + ":" + port + ". Connection re-tries are not enabled.", e);
			}

			LOG.error("Failed to send message '" + value + "' to socket server at " + hostName + ":" + port +
					". Trying to reconnect..." , e);

			// do the retries in locked scope, to guard against concurrent close() calls
			// note that the first re-try comes immediately, without a wait!

			synchronized (lock) {
				IOException lastException = null;
				retries = 0;

				while (isRunning && (maxNumRetries < 0 || retries < maxNumRetries)) {

					// first, clean up the old resources
					try {
						if (outputStream != null) {
							outputStream.close();
						}
					}
					catch (IOException ee) {
						LOG.error("Could not close output stream from failed write attempt", ee);
					}
					try {
						if (client != null) {
							client.close();
						}
					}
					catch (IOException ee) {
						LOG.error("Could not close socket from failed write attempt", ee);
					}

					// try again
					retries++;

					try {
						// initialize a new connection
						createConnection();

						// re-try the write
						outputStream.write(msg);

						// success!
						return;
					}
					catch (IOException ee) {
						lastException = ee;
						LOG.error("Re-connect to socket server and send message failed. Retry time(s): " + retries, ee);
					}

					// wait before re-attempting to connect
					lock.wait(CONNECTION_RETRY_DELAY);
				}

				// throw an exception if the task is still running, otherwise simply leave the method
				if (isRunning) {
					throw new IOException("Failed to send message '" + value + "' to socket server at "
							+ hostName + ":" + port + ". Failed after " + retries + " retries.", lastException);
				}
			}
		}
	}