1 /*
2 * Copyright (C) 2003-2014 eXo Platform SAS.
3 *
4 * This is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as
6 * published by the Free Software Foundation; either version 3 of
7 * the License, or (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this software; if not, write to the Free
16 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18 */
19 package org.exoplatform.ui.login.tasks;
20
21 import org.apache.http.client.HttpClient;
22 import org.exoplatform.ui.login.LoginProxy;
23
24 import android.os.AsyncTask;
25
26 /**
27 * Created by The eXo Platform SAS
28 * Author : Philippe Aristote
29 * paristote@exoplatform.com
30 * May 12, 2014
31 *
32 * Logout async task performs Logout action on a background thread
33 *
34 */
35 public class LogoutTask extends AsyncTask<Void, Void, Void> {
36
37 private HttpClient httpClient;
38
39 /**
40 * Calls getConnectionManager().shutdown() on the given HttpClient, in a background thread
41 * @param _client the HttpClient to shutdown
42 */
43 public LogoutTask(HttpClient _client) {
44 httpClient = _client;
45 }
46
47 @Override
48 protected Void doInBackground(Void... params) {
49 httpClient.getConnectionManager().shutdown();
50 return null;
51 }
52
53 @Override
54 protected void onPostExecute(Void result) {
55 httpClient = null;
56 LoginProxy.userIsLoggedIn = false;
57 super.onPostExecute(result);
58 }
59
60
61 }