Пример #1
0
 /** {@inheritDoc} */
 @Override
 public boolean equals(Object obj) {
   if (obj == null) {
     return false;
   }
   if (!(obj instanceof Notify)) {
     return false;
   }
   Notify other = (Notify) obj;
   if (getConnectionParams() == null && other.getConnectionParams() != null) {
     return false;
   }
   if (getConnectionParams() != null && other.getConnectionParams() == null) {
     return false;
   }
   if (getConnectionParams() != null
       && !getConnectionParams().equals(other.getConnectionParams())) {
     return false;
   }
   if (getInvokeId() != other.getInvokeId()) {
     return false;
   }
   if (getCall() == null && other.getCall() != null) {
     return false;
   }
   if (getCall() != null && other.getCall() == null) {
     return false;
   }
   if (getCall() != null && !getCall().equals(other.getCall())) {
     return false;
   }
   return true;
 }
Пример #2
0
 public synchronized void onStreamEvent(Notify notify) {
   ObjectMap<?, ?> map = (ObjectMap<?, ?>) notify.getCall().getArguments()[0];
   String code = (String) map.get("code");
   if (StatusCodes.NS_PUBLISH_START.equals(code)) {
     setState(PUBLISHED);
     while (frameBuffer.size() > 0) {
       rtmpClient.publishStreamData(streamId, frameBuffer.remove(0));
     }
   }
 }
Пример #3
0
  /**
   * Duplicate this Notify message to future injection Serialize to memory and deserialize, safe
   * way.
   *
   * @return duplicated Notify event
   */
  public Notify duplicate() throws IOException, ClassNotFoundException {
    Notify result = new Notify();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(baos);
    writeExternal(oos);
    oos.close();

    byte[] buf = baos.toByteArray();
    baos.close();

    ByteArrayInputStream bais = new ByteArrayInputStream(buf);
    ObjectInputStream ois = new ObjectInputStream(bais);

    result.readExternal(ois);
    ois.close();
    bais.close();

    return result;
  }
Пример #4
0
 /** {@inheritDoc} */
 public void notify(IServiceCall call, int channel) {
   Notify notify = new Notify();
   notify.setCall(call);
   getChannel(channel).write(notify);
 }