コード例 #1
0
  public static void startBuckets() {
    if (mNotesBucket != null) {
      mNotesBucket.start();
    }

    if (mMetaBucket != null) {
      mMetaBucket.start();
    }
  }
コード例 #2
0
  public static void resetBucketsAndDeauthorize() {
    if (mNotesBucket != null) {
      mNotesBucket.reset();
      mNotesBucket = null;
    }
    if (mMetaBucket != null) {
      mMetaBucket.reset();
      mMetaBucket = null;
    }

    // Reset user status
    if (mSimperium != null) {
      mSimperium.getUser().setStatus(User.Status.UNKNOWN);
      mSimperium = null;
    }
  }
コード例 #3
0
 /** Creates a channel for the bucket. Starts the websocket connection if not connected */
 @Override
 public Channel buildChannel(Bucket bucket) {
   // create a channel
   Channel channel = new Channel(mExecutor, appId, sessionId, bucket, mSerializer, this);
   int channelId = channels.size();
   channelIndex.put(channel, channelId);
   channels.put(channelId, channel);
   // If we're not connected then connect, if we don't have a user
   // access token we'll have to hold off until the user does have one
   if (!isConnected() && bucket.getUser().hasAccessToken()) {
     connect();
   } else if (isConnected()) {
     channel.onConnect();
   }
   return channel;
 }