Package org.apache.tuscany.sca.binding.comet.runtime.callback

Examples of org.apache.tuscany.sca.binding.comet.runtime.callback.Status


  private CopyOnWriteArrayList<CometCallback> clients = new CopyOnWriteArrayList<CometCallback>();

  @Override
  public void postMessage(String user, String message) {
    for (CometCallback callback : new ArrayList<CometCallback>(clients)) {
      Status status = callback.sendMessage(user + ": " + message);
      if (status == Status.CLIENT_DISCONNECTED) {
        clients.remove(callback);
      }
    }
  }
View Full Code Here


                // client has unregistered from this event
                synchronized (eventListeners) {
                    eventListeners.remove(eventName, registrationId);
                }
            } else {
                Status status = client.sendMessage(event);
                if (status == Status.CLIENT_DISCONNECTED) {
                    unregister(registrationId);
                }
            }
        }
View Full Code Here

      @Override
      public void run() {
        final Response response = new Response();
        response.setDate(new Date());
        response.setData(Helper.randomInt(90) + "%");
        Status status = callback.sendMessage(response);
        if (status == Status.CLIENT_DISCONNECTED) {
          System.out.println("Client disconnected from HumidityService.");
          this.cancel();
        }
      }
View Full Code Here

      public void run() {
        final Response response = new Response();
        response.setDate(new Date());
        final String data = "" + Helper.randomInt(scale == TemperatureService.CELSIUS ? 40 : 150);
        response.setData(data);
        Status status = callback.sendMessage(response);
        if (status == Status.CLIENT_DISCONNECTED) {
          System.out.println("Client disconnected from TemperatureService.");
          this.cancel();
        }
      }
View Full Code Here

      @Override
      public void run() {
        Response response = new Response();
        response.setDate(new Date());
        response.setData(Helper.randomInt(100) + "%");
        Status status = client.sendMessage(response);
        if (status == Status.CLIENT_DISCONNECTED) {
          System.out.println("Client disconnected from PrecipitationService.");
          this.cancel();
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.comet.runtime.callback.Status

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.