Package com.aphyr.riemann.Proto

Examples of com.aphyr.riemann.Proto.Msg


                final int len = in.readInt();
               
                // Read message
                final byte[] data = new byte[len];
                in.readFully(data);
                final Msg request = Msg.parseFrom(data);
               
                // Log request
                received.put(request);

                // Handle message
                final Msg response = handle(request);
               
                // Write response
                out.writeInt(response.getSerializedSize());
                response.writeTo(out);
              }
            }
          } catch (EOFException e) {
            // Socket closed.
          } finally {
View Full Code Here


      public Boolean deref(long time, TimeUnit unit) throws IOException {
        validate(p.deref(time, unit));
        return true;
      }
      public Boolean deref(long time, TimeUnit unit, Boolean timeoutValue) throws IOException {
        final Msg message = p.deref(time, unit, null);
        if (message != null && validate(message) != null) {
          return true;
        } else {
          return false;
        }
View Full Code Here

              .description(desc.toString())
              .send();
  }

  public List<Event> query(String q) throws IOException, ServerError, MsgTooLargeException {
    Msg m = sendRecvMessage(Msg.newBuilder()
        .setQuery(
          Query.newBuilder().setString(q).build())
        .build());

    validate(m);

    return Collections.unmodifiableList(m.getEventsList());
  }
View Full Code Here

      client = RiemannClient.tcp(server.start());
      client.connect();
      for (int i = 0; i < 10; i++) {
        final List<Event> events = client.query("hi");
        assertEquals(0, events.size());
        final Msg m = server.received.poll();
        assertEquals("hi", m.getQuery().getString());
      }
    } finally {
      if (client != null) {
        client.disconnect();
      }
View Full Code Here

      return;
    }

    // Destructure the write
    final Write write = (Write) me.getMessage();
    final Msg message = write.message;
    final Promise promise = write.promise;

    // If we're over capacity, abort the promise and drop the message here.
    if (maxInflightRequests.get() <= queue.size) {
      promise.deliver(
View Full Code Here

  }

  // When messages are received, deliver them to the next queued promise.
  @Override
  public void messageReceived(ChannelHandlerContext c, MessageEvent e) {
    Msg message = (Msg) e.getMessage();
    queue.take().deliver(message);
  }
View Full Code Here

TOP

Related Classes of com.aphyr.riemann.Proto.Msg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.