Package com.caucho.bam

Examples of com.caucho.bam.ActorStream


   * Returns the current stream to the actor, throwing an exception if
   * it's unavailable
   */
  public ActorStream getActorStream()
  {
    ActorStream stream = _actorStream;

    if (stream != null)
      return stream;
    else
      throw new RemoteConnectionFailedException("connection has been closed");
View Full Code Here


          // _hmtpWriter.setId(getRequestId());
          _hmtpWriter.setAutoFlush(true);
        }

        Broker broker = _server.getAdminBroker();
        ActorStream brokerStream = broker.getBrokerStream();

        _hmtpWriter.setJid("server-" + getConnectionId() + "-hmtp");

        _linkStream = new HempMemoryQueue(_hmtpWriter, brokerStream, 1);
        boolean isUnidir = code == HMUX_TO_UNIDIR_HMTP;
View Full Code Here

  /**
   * Close when the socket closes.
   */
  public void onCloseConnection()
  {
    ActorStream brokerStream = _brokerStream;
    _brokerStream = null;

    ActorStream linkStream = _linkStream;
    _linkStream = null;

    if (brokerStream != null)
      brokerStream.close();

    if (linkStream != null)
      linkStream.close();

    HmtpWriter writer = _hmtpWriter;

    if (writer != null)
      writer.close();
View Full Code Here

  public void addActor(ActorStream actor)
  {
    String jid = actor.getJid();

    synchronized (_actorMap) {
      ActorStream oldActor = _actorMap.get(jid);

      if (oldActor != null)
        throw new IllegalStateException(L.l("duplicated jid='{0}' is not allowed",
                                            jid));
View Full Code Here

  /**
   * Sends a message
   */
  public void message(String to, String from, Serializable value)
  {
    ActorStream stream = findActorStream(to);

    if (stream != null)
      stream.message(to, from, value);
    else {
      log.fine(this + " sendMessage to=" + to + " from=" + from
               + " is an unknown actor stream.");
    }
  }
View Full Code Here

  public void messageError(String to,
                               String from,
                               Serializable value,
                               ActorError error)
  {
    ActorStream stream = findActorStream(to);

    if (stream != null)
      stream.messageError(to, from, value, error);
    else {
      log.fine(this + " sendMessageError to=" + to + " from=" + from
               + " error=" + error + " is an unknown actor stream.");
    }
  }
View Full Code Here

   * Query an entity
   */
  public void queryGet(long id, String to, String from,
                              Serializable payload)
  {
    ActorStream stream = findActorStream(to);

    if (stream != null) {
      try {
        stream.queryGet(id, to, from, payload);
      } catch (Exception e) {
        log.log(Level.FINER, e.toString(), e);

        ActorError error = ActorError.create(e);

View Full Code Here

  public void querySet(long id,
                       String to,
                       String from,
                       Serializable payload)
  {
    ActorStream stream = findActorStream(to);

    if (stream == null) {
      if (log.isLoggable(Level.FINE)) {
        log.fine(this + " querySet to unknown stream '" + to
                 + "' from=" + from);
      }

      String msg = L.l("'{0}' is an unknown actor for querySet", to);

      ActorError error = new ActorError(ActorError.TYPE_CANCEL,
                                      ActorError.SERVICE_UNAVAILABLE,
                                      msg);

      queryError(id, from, to, payload, error);

      return;
    }

    stream.querySet(id, to, from, payload);
  }
View Full Code Here

  /**
   * Query an entity
   */
  public void queryResult(long id, String to, String from, Serializable value)
  {
    ActorStream stream = findActorStream(to);

    if (stream != null)
      stream.queryResult(id, to, from, value);
    else
      throw new RuntimeException(L.l("{0}: {1} is an unknown actor stream.",
                                     this, to));
  }
View Full Code Here

                         String to,
                         String from,
                         Serializable payload,
                         ActorError error)
  {
    ActorStream stream = findActorStream(to);

    if (stream != null)
      stream.queryError(id, to, from, payload, error);
    else
      throw new RuntimeException(L.l("{0} is an unknown actor stream.", to));
  }
View Full Code Here

TOP

Related Classes of com.caucho.bam.ActorStream

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.