Exemplo n.º 1
0
  /**
   * インスタンスを生成する
   *
   * @param messageBus スケジューラー
   * @param accountId アカウントID (long)
   */
  public TimelineChannel(MessageBus messageBus, String accountId) {
    this.messageBus = messageBus;
    this.accountId = accountId;
    listeners = messageBus.getListeners(accountId, "statuses/timeline");

    configuration = ClientConfiguration.getInstance();
    configProperties = configuration.getConfigProperties();
    intervalOfTimeline =
        configProperties.getInteger(ClientConfiguration.PROPERTY_INTERVAL_TIMELINE);
  }
Exemplo n.º 2
0
  @Override
  public synchronized void realConnect() {
    if (scheduledFuture == null) {
      twitter = new TwitterFactory(messageBus.getTwitterConfiguration(accountId)).getInstance();

      scheduledFuture =
          configuration
              .getTimer()
              .scheduleWithFixedDelay(
                  () -> configuration.addJob(JobQueue.Priority.LOW, this),
                  0,
                  intervalOfTimeline,
                  TimeUnit.SECONDS);
    }
  }