org.fabric3.spi.container.invocation.Message.setWorkContext()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(220)

本文整理了Java中org.fabric3.spi.container.invocation.Message.setWorkContext()方法的一些代码示例,展示了Message.setWorkContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setWorkContext()方法的具体详情如下:
包路径:org.fabric3.spi.container.invocation.Message
类名称:Message
方法名:setWorkContext

Message.setWorkContext介绍

[英]Sets the context associated with this invocation.
[中]设置与此调用关联的上下文。

代码示例

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-zeromq

public void run() {
    Message request = MessageCache.getAndResetMessage();
    try {
      request.setBody(frames[0]);
      int methodIndex = ByteBuffer.wrap(frames[1]).getInt();
      WorkContext context = setWorkContext(frames[2]);
      request.setWorkContext(context);
      Interceptor interceptor = interceptors[methodIndex];
      interceptor.invoke(request);
    } finally {
      request.reset();
    }
  }
});

代码示例来源:origin: org.fabric3/fabric3-binding-ws-metro

public Object invoke(Packet packet, Method method, Object... args) throws InvocationTargetException {
  // the work context is populated by the current tubeline
  WorkContext workContext = (WorkContext) packet.invocationProperties.get(MetroConstants.WORK_CONTEXT);
  if (workContext == null) {
    // programming error
    throw new AssertionError("Work context not set");
  }
  Message input = MessageCache.getAndResetMessage();
  try {
    input.setWorkContext(workContext);
    input.setBody(args);
    Interceptor head = chains.get(method.getName()).getHeadInterceptor();
    Message ret = head.invoke(input);
    if (!ret.isFault()) {
      return ret.getBody();
    } else {
      Throwable th = (Throwable) ret.getBody();
      throw new InvocationTargetException(th);
    }
  } finally {
    input.reset();
  }
}

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-ws

public Object invoke(Packet packet, Method method, Object... args) throws InvocationTargetException {
  // the work context is populated by the current tubeline
  WorkContext workContext = (WorkContext) packet.invocationProperties.get(MetroConstants.WORK_CONTEXT);
  if (workContext == null) {
    // programming error
    throw new AssertionError("Work context not set");
  }
  Message input = MessageCache.getAndResetMessage();
  try {
    input.setWorkContext(workContext);
    input.setBody(args);
    Interceptor head = chains.get(method.getName()).getHeadInterceptor();
    Message ret = head.invoke(input);
    if (!ret.isFault()) {
      return ret.getBody();
    } else {
      Throwable th = (Throwable) ret.getBody();
      throw new InvocationTargetException(th);
    }
  } finally {
    input.reset();
  }
}

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-zeromq

public void run() {
    Message request = MessageCache.getAndResetMessage();
    try {
      request.setBody(frames[0]);
      int methodIndex = ByteBuffer.wrap(frames[1]).getInt();
      WorkContext context = setWorkContext(frames[2]);
      request.setWorkContext(context);
      Interceptor interceptor = interceptors[methodIndex];
      // invoke the service
      Message response = interceptor.invoke(request);
      Object responseBody = response.getBody();
      if (!(responseBody instanceof byte[])) {
        throw new ServiceRuntimeException("Return value not serialized");
      }
      // queue the response
      try {
        queue.put(new Response(clientId, (byte[]) responseBody));
      } catch (InterruptedException e) {
        Thread.interrupted();
      }
    } finally {
      request.reset();
      //                    context.reset();
    }
  }
});

代码示例来源:origin: org.fabric3/fabric3-binding-ws-metro

Node node = soapMessage.getSOAPBody().extractContentAsDocument();
input.setWorkContext(workContext);
input.setBody(node);
String operationName = packet.getWSDLOperation().getLocalPart();

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-rs-jersey

public Object invoke(Method method, Object[] args) throws Throwable {
  InvocationChain invocationChain = chains.get(method.getName());
  if (invocationChain == null) {
    throw new ServiceRuntimeException("Unknown resource method: " + method.toString());
  }
  WorkContext context = WorkContextCache.getThreadWorkContext();   // work context set previously in RsContainer
  Message message = MessageCache.getAndResetMessage();
  try {
    message.setWorkContext(context);
    message.setBody(args);
    if (invocationChain != null) {
      Interceptor headInterceptor = invocationChain.getHeadInterceptor();
      Message ret = headInterceptor.invoke(message);
      if (ret.isFault()) {
        return handleFault(ret);
      } else {
        return ret.getBody();
      }
    } else {
      return null;
    }
  } catch (RuntimeException e) {
    throw new InvocationTargetException(e);
  } finally {
    message.reset();
  }
}

代码示例来源:origin: org.fabric3/fabric3-binding-rs-jersey

public Object invoke(Method method, Object[] args) throws Throwable {
  InvocationChain invocationChain = chains.get(method.getName());
  if (invocationChain == null) {
    throw new ServiceRuntimeException("Unknown resource method: " + method.toString());
  }
  WorkContext context = WorkContextCache.getThreadWorkContext();   // work context set previously in RsContainer
  Message message = MessageCache.getAndResetMessage();
  try {
    message.setWorkContext(context);
    message.setBody(args);
    if (invocationChain != null) {
      Interceptor headInterceptor = invocationChain.getHeadInterceptor();
      Message ret = headInterceptor.invoke(message);
      if (ret.isFault()) {
        return handleFault(ret);
      } else {
        return ret.getBody();
      }
    } else {
      return null;
    }
  } catch (RuntimeException e) {
    throw new InvocationTargetException(e);
  } finally {
    message.reset();
  }
}

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-jms

WorkContext workContext = setWorkContext(request);
org.fabric3.spi.container.invocation.Message inMessage = MessageCache.getAndResetMessage();
inMessage.setWorkContext(workContext);
inMessage.setBody(payload);

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-file

Message message = MessageCache.getAndResetMessage();
try {
  message.setWorkContext(workContext);
  Message response = dispatch(payload, message);
  afterInvoke(file, payload);

代码示例来源:origin: org.fabric3/fabric3-binding-ws-metro

public boolean handleMessage(SOAPMessageContext smc) {
  Boolean outbound = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  WorkContext workContext = WorkContextCache.getThreadWorkContext();
  workContext = (WorkContext) (workContext == null ? smc.get(MetroConstants.WORK_CONTEXT) : workContext);
  if (workContext == null) {
    throw new ServiceRuntimeException("Work context not set");
  }
  if (outbound) {
    // reference proxy outbound or service invocation return
    Message msg = MessageCache.getMessage();
    if (msg.getWorkContext() == null) {
      // service invocation return
      msg.setBody(smc.getMessage());
      msg.setWorkContext(workContext);
    }
    delegateHandler.handleOutbound(msg, smc.getMessage());
  } else {
    // reference proxy invocation return or service invocation
    Message msg = MessageCache.getMessage();
    if (msg.getWorkContext() == null) {
      // reference proxy return
      msg.setBody(smc.getMessage());
      msg.setWorkContext(workContext);
    }
    delegateHandler.handleInbound(smc.getMessage(), msg);
    msg.reset();
  }
  return true;
}

代码示例来源:origin: com.carecon.fabric3/fabric3-binding-ws

public boolean handleMessage(SOAPMessageContext smc) {
  Boolean outbound = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  WorkContext workContext = WorkContextCache.getThreadWorkContext();
  workContext = (WorkContext) (workContext == null ? smc.get(MetroConstants.WORK_CONTEXT) : workContext);
  if (workContext == null) {
    throw new ServiceRuntimeException("Work context not set");
  }
  if (outbound) {
    // reference proxy outbound or service invocation return
    Message msg = MessageCache.getMessage();
    if (msg.getWorkContext() == null) {
      // service invocation return
      msg.setBody(smc.getMessage());
      msg.setWorkContext(workContext);
    }
    delegateHandler.handleOutbound(msg, smc.getMessage());
  } else {
    // reference proxy invocation return or service invocation
    Message msg = MessageCache.getMessage();
    if (msg.getWorkContext() == null) {
      // reference proxy return
      msg.setBody(smc.getMessage());
      msg.setWorkContext(workContext);
    }
    delegateHandler.handleInbound(smc.getMessage(), msg);
    msg.reset();
  }
  return true;
}

代码示例来源:origin: org.fabric3/fabric3-jdk-proxy

message.setWorkContext(workContext);
try {

代码示例来源:origin: com.carecon.fabric3/fabric3-async

public void run() {
  WorkContext workContext = WorkContextCache.getAndResetThreadWorkContext();
  workContext.addCallbackReferences(stack);
  workContext.addHeaders(headers);
  workContext.setSubject(subject);
  Message message = MessageCache.getAndResetMessage();
  message.setBody(payload);
  message.setWorkContext(workContext);
  Message response = next.invoke(message);
  if (response.isFault()) {
    // log the exception
    monitor.onError((Throwable) response.getBody());
  }
  message.reset();
  workContext.reset();
}

代码示例来源:origin: com.carecon.fabric3/fabric3-jdk-proxy

message.setWorkContext(workContext);
try {

代码示例来源:origin: org.fabric3/fabric3-binding-ftp

public boolean onUpload(String fileName, String contentType, InputStream uploadData) throws Exception {
  Object[] args = new Object[]{fileName, uploadData};
  WorkContext workContext = WorkContextCache.getAndResetThreadWorkContext();
  Message input = MessageCache.getAndResetMessage();
  try {
    // set the header value for the request context
    workContext.setHeader(FtpConstants.HEADER_CONTENT_TYPE, contentType);
    input.setWorkContext(workContext);
    input.setBody(args);
    Message response = getInterceptor().invoke(input);
    if (response.isFault()) {
      monitor.fileProcessingError(servicePath, (Throwable) response.getBody());
      input.reset();
      return false;
    }
    return true;
  } finally {
    input.reset();
    workContext.reset();
  }
}

代码示例来源:origin: com.carecon.fabric3/fabric3-jdk-proxy

message.setWorkContext(workContext);
try {

代码示例来源:origin: org.fabric3/fabric3-jdk-proxy

message.setWorkContext(workContext);
try {

相关文章