• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ResponseMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.spy.memcached.tapmessage.ResponseMessage的典型用法代码示例。如果您正苦于以下问题:Java ResponseMessage类的具体用法?Java ResponseMessage怎么用?Java ResponseMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResponseMessage类属于net.spy.memcached.tapmessage包,在下文中一共展示了ResponseMessage类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getNextMessage

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
/**
 * Gets the next tap message from the queue of received tap messages.
 *
 * @param time the amount of time to wait for a message.
 * @param timeunit the unit of time to use.
 * @return The tap message at the head of the queue or null if the queue is
 *         empty for the given amount of time.
 */
public ResponseMessage getNextMessage(long time, TimeUnit timeunit) {
  try {
    Object m = rqueue.poll(time, timeunit);
    if (m == null) {
      return null;
    } else if (m instanceof ResponseMessage) {
      return (ResponseMessage) m;
    } else if (m instanceof TapAck) {
      TapAck ack = (TapAck) m;
      tapAck(ack.getConn(), ack.getNode(), ack.getOpcode(), ack.getOpaque(),
          ack.getCallback());
      return null;
    } else {
      throw new RuntimeException("Unexpected tap message type");
    }
  } catch (InterruptedException e) {
    shutdown();
    return null;
  }
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:29,代码来源:TapClient.java


示例2: read

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
/**
 * read messages from CB TAP 
 * @return
 */
List<Event> read() {
	Event e;
	List<Event> result = new ArrayList<Event>(1);
	if(tapClient.hasMoreMessages()){
		//System.out.println("tap client has messages..");
		ResponseMessage resmessage=tapClient.getNextMessage();
		
		//System.out.println("[message]"+resmessage);
		if(resmessage!=null ) {
			e=CBMessageConverter.convert(filter,resmessage);
			if(e!=null)result.add(e);
		}
	}
	return result;
}
 
开发者ID:paypal,项目名称:cbflume,代码行数:20,代码来源:CBMessageConsumer.java


示例3: convert

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
public static Event convert(CBMessageFilter filter, ResponseMessage message) {
	//System.out.println("[message]"+message.getKey());
	Event event = new SimpleEvent();
	Map<String, String> headers = event.getHeaders();
	
	String key=message.getKey();
	key=key.substring(0,key.indexOf("_",key.indexOf("_")+1));
	//System.out.println("Key is "+key);
	
	if(filter.membershiptest(key)){
		String body="{ \"key\"={"+message.getKey()+"},\"value\"={"+ new String(message.getValue())+"}}";
		event.setBody(body.getBytes());
		return event;
	}else{
		return null;
	}
	
	/*
	//Logic specific to cookie . Generalize it.
	if(message.getKey().startsWith("cs_ca_")){
		headers.put("type", "analytics");
	}*/
	
	
}
 
开发者ID:paypal,项目名称:cbflume,代码行数:26,代码来源:CBMessageConverter.java


示例4: readFromBuffer

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
@Override
public void readFromBuffer(ByteBuffer data) throws IOException {
  while (data.remaining() > 0) {
    if (bytesProcessed < BaseMessage.HEADER_LENGTH) {
      header[bytesProcessed] = data.get();
      bytesProcessed++;
    } else {
      if (message == null) {
        bodylen = decodeInt(header, 8);
        message = new byte[BaseMessage.HEADER_LENGTH + bodylen];
        System.arraycopy(header, 0, message, 0, BaseMessage.HEADER_LENGTH);
      }

      if (bytesProcessed < message.length) {
        message[bytesProcessed] = data.get();
        bytesProcessed++;
      }
      if (bytesProcessed >= message.length) {
        ResponseMessage response = new ResponseMessage(message);
        for (TapResponseFlag flag : response.getFlags()) {
          if (flag == TapResponseFlag.TAP_ACK) {
            ((Callback) getCallback()).gotAck(getHandlingNode(),
                response.getOpcode(), response.getOpaque());
          }
        }
        if (response.getOpcode() != TapOpcode.OPAQUE && response.getOpcode()
          != TapOpcode.NOOP) {
          ((Callback) getCallback()).gotData(response);
        }
        message = null;
        bytesProcessed = 0;
      }
    }
  }
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:36,代码来源:TapOperationImpl.java


示例5: tapCustom

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
/**
 * Allows the user to specify a custom tap message.
 *
 * @param id the named tap id that can be used to resume a disconnected tap
 *          stream
 * @param message the custom tap message that will be used to initiate the tap
 *          stream.
 * @return the operation that controls the tap stream.
 * @throws ConfigurationException a bad configuration was received from the
 *           memcached cluster.
 * @throws IOException if there are errors connecting to the cluster.
 */
public TapStream tapCustom(final String id, final RequestMessage message)
  throws ConfigurationException, IOException {
  final TapConnectionProvider conn = new TapConnectionProvider(addrs);
  final TapStream ts = new TapStream();
  conn.broadcastOp(new BroadcastOpFactory() {
    public Operation newOp(final MemcachedNode n,
        final CountDownLatch latch) {
      Operation op =  conn.getOpFactory().tapCustom(id, message,
          new TapOperation.Callback() {
          public void receivedStatus(OperationStatus status) {
          }
          public void gotData(ResponseMessage tapMessage) {
            rqueue.add(tapMessage);
            messagesRead++;
          }
          public void gotAck(MemcachedNode node, TapOpcode opcode,
              int opaque) {
            rqueue.add(new TapAck(conn, node, opcode, opaque, this));
          }
          public void complete() {
            latch.countDown();
          }
        });
      ts.addOp((TapOperation)op);
      return op;
    }
  });
  synchronized (omap) {
    omap.put(ts, conn);
  }
  return ts;
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:45,代码来源:TapClient.java


示例6: tapDump

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
/**
 * Specifies a tap stream that will take a snapshot of items in memcached and
 * send them through a tap stream.
 *
 * @param id the named tap id that can be used to resume a disconnected tap
 *          stream
 * @return the operation that controls the tap stream.
 * @throws ConfigurationException a bad configuration was received from the
 *           memcached cluster.
 * @throws IOException If there are errors connecting to the cluster.
 */
public TapStream tapDump(final String id) throws IOException,
    ConfigurationException {
  final TapConnectionProvider conn = new TapConnectionProvider(addrs);
  final TapStream ts = new TapStream();
  conn.broadcastOp(new BroadcastOpFactory() {
    public Operation newOp(final MemcachedNode n,
        final CountDownLatch latch) {
      Operation op =  conn.getOpFactory().tapDump(id,
          new TapOperation.Callback() {
          public void receivedStatus(OperationStatus status) {
          }
          public void gotData(ResponseMessage tapMessage) {
            rqueue.add(tapMessage);
            messagesRead++;
          }
          public void gotAck(MemcachedNode node, TapOpcode opcode,
              int opaque) {
            rqueue.add(new TapAck(conn, node, opcode, opaque, this));
          }
          public void complete() {
            latch.countDown();
          }
        });
      ts.addOp((TapOperation)op);
      return op;
    }
  });
  synchronized (omap) {
    omap.put(ts, conn);
  }
  return ts;
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:44,代码来源:TapClient.java


示例7: add

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
@RequestMapping(value = "/{table}/add", method = RequestMethod.GET)
public ResponseMessage add(){
    return null;
}
 
开发者ID:blogshun,项目名称:ants-project,代码行数:5,代码来源:DynamicURLAjax.java


示例8: next

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
@Override
public int next() {
  Stopwatch watch = new Stopwatch();
  watch.start();

  keyVector.clear();
  keyVector.allocateNew();
  valueVector.clear();
  valueVector.allocateNew();
  int rowCount = 0;
  done:
  for (; rowCount < TARGET_RECORD_COUNT && tapClient.hasMoreMessages();) {
    ResponseMessage message = null;
    if (leftOver != null) {
      message = leftOver;
      leftOver = null;
    } else {
      if ((message = tapClient.getNextMessage()) == null) {
        continue;
      }
    }

    if (!keyVector.getMutator().setSafe(rowCount, message.getKey().getBytes())) {
      setOutputRowCount(rowCount);
      leftOver = message;
      break done;
    }

    if (!valueVector.getMutator().setSafe(rowCount, message.getValue())) {
      setOutputRowCount(rowCount);
      leftOver = message;
      break done;
    }

    rowCount++;
  }

  setOutputRowCount(rowCount);
  logger.debug("Took {} ms to get {} records", watch.elapsed(TimeUnit.MILLISECONDS), rowCount);
  return rowCount;
}
 
开发者ID:jacques-n,项目名称:drill-couchbase-plugin,代码行数:42,代码来源:CouchbaseRecordReader.java


示例9: gotData

import net.spy.memcached.tapmessage.ResponseMessage; //导入依赖的package包/类
/**
 * Callback for each result from a get.
 *
 * @param message the response message sent from the server
 */
void gotData(ResponseMessage message);
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:7,代码来源:TapOperation.java



注:本文中的net.spy.memcached.tapmessage.ResponseMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StringUtil类代码示例发布时间:2022-05-22
下一篇:
Java AddressDt类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap