Examples of WriteCallback


Examples of org.apache.bookkeeper.proto.WriteCallback

    public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
        if (args.length != 3) {
            System.err.println("USAGE: BookieClient bookieHost port ledger#");
            return;
        }
        WriteCallback cb = new WriteCallback() {

            public void writeComplete(int rc, long ledger, long entry, Object ctx) {
                Counter counter = (Counter)ctx;
                counter.dec();
                if (rc != 0) {
View Full Code Here

Examples of org.apache.wicket.request.resource.AbstractResource.WriteCallback

  /**
   */
  public void testWriteStream()
  {
    WriteCallback callback = new WriteCallback()
    {

      @Override
      public void writeData(Attributes attributes)
      {

      }
    };
    ByteArrayResponse response = new ByteArrayResponse();
    Attributes attributes = new Attributes(new MockWebRequest(new Url()), response);
    byte[] srcData = new byte[5000];
    for (int i = 0; i < srcData.length; i++)
    {
      srcData[i] = (byte)i;
    }
    InputStream in = new ByteArrayInputStream(srcData);
    callback.writeStream(attributes, in);
    assertTrue("Content not equal", Arrays.equals(response.getBytes(), srcData));
  }
View Full Code Here

Examples of org.apache.wicket.request.resource.AbstractResource.WriteCallback

  /**
   */
  @Test
  public void writeStream() throws IOException
  {
    WriteCallback callback = new WriteCallback()
    {

      @Override
      public void writeData(Attributes attributes)
      {

      }
    };
    ByteArrayResponse response = new ByteArrayResponse();
    Attributes attributes = new Attributes(new MockWebRequest(new Url()), response);
    byte[] srcData = new byte[5000];
    for (int i = 0; i < srcData.length; i++)
    {
      srcData[i] = (byte)i;
    }
    InputStream in = new ByteArrayInputStream(srcData);
    callback.writeStream(attributes, in);
    assertTrue("Content not equal", Arrays.equals(response.getBytes(), srcData));
  }
View Full Code Here

Examples of org.apache.wicket.request.resource.AbstractResource.WriteCallback

  protected ResourceResponse newResourceResponse(Attributes attributes) {
    ResourceResponse resourceResponse = new ResourceResponse();
    resourceResponse.setContentType("text/xml");
    resourceResponse.setTextEncoding("utf-8");
   
    resourceResponse.setWriteCallback(new WriteCallback()
    {
      @Override
      public void writeData(Attributes attributes) throws IOException
      {
        OutputStream outputStream = attributes.getResponse().getOutputStream();
View Full Code Here

Examples of org.apache.wicket.request.resource.AbstractResource.WriteCallback

  /**
   */
  @Test
  public void writeStream()
  {
    WriteCallback callback = new WriteCallback()
    {

      @Override
      public void writeData(Attributes attributes)
      {

      }
    };
    ByteArrayResponse response = new ByteArrayResponse();
    Attributes attributes = new Attributes(new MockWebRequest(new Url()), response);
    byte[] srcData = new byte[5000];
    for (int i = 0; i < srcData.length; i++)
    {
      srcData[i] = (byte)i;
    }
    InputStream in = new ByteArrayInputStream(srcData);
    callback.writeStream(attributes, in);
    assertTrue("Content not equal", Arrays.equals(response.getBytes(), srcData));
  }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WriteCallback

        }
    }

    private void notifySuccess()
    {
        WriteCallback callback;
        synchronized (this)
        {
            callback = this.callback;
        }
        if (callback != null)
        {
            callback.writeSuccess();
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WriteCallback

        }
    }

    private void notifyFailure(Throwable failure)
    {
        WriteCallback callback;
        synchronized (this)
        {
            callback = this.callback;
        }
        if (callback != null)
        {
            callback.writeFailed(failure);
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WriteCallback

        }
    }

    private void notifySuccess()
    {
        WriteCallback callback;
        synchronized (this)
        {
            callback = this.callback;
        }
        if (callback != null)
        {
            callback.writeSuccess();
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WriteCallback

        }
    }

    private void notifyFailure(Throwable failure)
    {
        WriteCallback callback;
        synchronized (this)
        {
            callback = this.callback;
        }
        if (callback != null)
        {
            callback.writeFailed(failure);
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.api.WriteCallback

//                throw (IOException)cause;
//            throw new IOException(cause);
//        }

        // Async version.
        wsSession.getRemote().sendString(data, new WriteCallback()
        {
            @Override
            public void writeSuccess()
            {
                callback.succeeded();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.