Last active
          August 29, 2015 14:24 
        
      - 
      
 - 
        
Save yishai-glide/a7e2f3d6910892d49f7c to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | mScheduler = new ScheduledThreadPoolExecutor(1, new ThreadFactory() { | |
| @Override | |
| public Thread newThread(Runnable r) { | |
| Thread th = Executors.defaultThreadFactory().newThread(r); | |
| th.setPriority(Process.THREAD_PRIORITY_BACKGROUND); | |
| th.setName("presence_thread"); | |
| return th; | |
| } | |
| }); | |
| HandlerThread thread = new HandlerThread("presence-parser", Process.THREAD_PRIORITY_BACKGROUND); | |
| thread.start(); | |
| mPresenceParsingHandler = new Handler(thread.getLooper()); | |
| mPresenceTask = new Runnable() { | |
| @Override | |
| public void run() { | |
| //Utils.log(TAG, "mPresenceTask", 0); | |
| try { | |
| handlePresenceTask(); | |
| handleActionsTask(); | |
| clearAndUpdate(); | |
| } catch (Exception e) { | |
| Utils.log(TAG, Log.getStackTraceString(e), 5); | |
| } | |
| } | |
| }; | |
| mScheduleFuture = mScheduler.scheduleAtFixedRate(mPresenceTask, TIME_OF_SLEEP_CYCLE, TIME_OF_SLEEP_CYCLE, TimeUnit.SECONDS); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment