List of usage examples for java.util.concurrent RejectedExecutionException printStackTrace
public void printStackTrace()
From source file:org.appspot.apprtc.util.ThumbnailsCacheManager.java
static public void ThumbnailsCacheManagerInit(Context context) { synchronized (mThumbnailsDiskCacheLock) { mAppContext = context;/*from ww w.ja v a 2 s .c o m*/ if (mThumbnailCacheStarting) { // initialise thumbnails cache on background thread try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { new InitDiskCacheTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null); } else { new InitDiskCacheTask().execute(); } } catch (RejectedExecutionException e) { e.printStackTrace(); } } } }
From source file:zlyh.dmitry.recaller.services.RecordService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { int command = intent.getIntExtra(Const.COMMAND, -1); switch (command) { case Const.RecordService.START: time_start = intent.getLongExtra(Const.CallReceiver.TIME_MARK, -1); File dir = getDir();//www . j a v a 2 s . com if (dir == null) { break; } phone = intent.getStringExtra(Const.CallReceiver.PHONE_NUM); file = new File(dir, "r_" + String.valueOf(time_start) + "_.pcm"); record = new RecordRunnable(this, file); try { executor.execute(record); localBroadcast(Const.RecordService.START); } catch (RejectedExecutionException e) { e.printStackTrace(); } break; case Const.RecordService.STOP: final String temp_phone = intent.getStringExtra(Const.CallReceiver.PHONE_NUM); if (temp_phone != null && !temp_phone.isEmpty()) { phone = temp_phone; } fullstop(false); saveSQL(intent.getLongExtra(Const.CallReceiver.TIME_MARK, -1), intent.getIntExtra(Const.CallReceiver.WAS_INCOMING, -1)); localBroadcast(Const.RecordService.STOP); popNotification(); break; } //start redeliver will ruin app if notification is alive return START_NOT_STICKY; }
From source file:edu.umass.cs.nio.AbstractPacketDemultiplexer.java
protected boolean handleMessageSuper(byte[] msg, NIOHeader header) throws JSONException { NIOInstrumenter.incrRcvd();/*w w w. j a v a2s. c om*/ MessageType message = null; Level level = Level.FINEST; try { message = processHeader(msg, header); } catch (Exception | Error e) { e.printStackTrace(); return false; } Integer type = message != null ? getPacketType(message) : null; log.log(level, "{0} handling type {1} message {2}:{3}", new Object[] { this, type, header, log.isLoggable(level) ? new Stringer(msg) : msg }); if (type == null || !this.demuxMap.containsKey(type)) { /* It is natural for some demultiplexers to not handle some packet * types, so it is not a "bad" thing that requires a warning log. */ log.log(Level.FINER, "{0} ignoring unknown packet type: {1}: {2}", new Object[] { this, type, message }); return false; } Tasker tasker = new Tasker(message, this.demuxMap.get(type)); if (this.myThreadPoolSize == 0 || isOrderPreserving(message)) { log.log(Level.FINER, "{0} handling message type {1} in selector thread; this can cause " + "deadlocks if the handler involves blocking operations", new Object[] { this, type }); // task better be lightning quick tasker.run(); } else try { log.log(Level.FINEST, "{0} invoking {1}.handleMessage({2})", new Object[] { this, tasker.pd, message }); // task should still be non-blocking executor.schedule(tasker, emulateDelays ? JSONDelayEmulator.getEmulatedDelay() : 0, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException ree) { if (!executor.isShutdown()) ree.printStackTrace(); return false; } /* Note: executor.submit() consistently yields poorer performance than * scheduling at 0 as above even though they are equivalent. Probably * garbage collection or heap optimization issues. */ return true; }
From source file:eu.siacs.conversations.ui.ServiceBrowserFragment.java
protected void startDiscovery() { mSubscription = mRxDnssd.browse(mReqType, mDomain).compose(mRxDnssd.resolve()) .compose(mRxDnssd.queryRecords()).subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()).subscribe(new Action1<BonjourService>() { @Override//from w ww . j ava 2s. co m public void call(BonjourService bonjourService) { int itemsCount = mAdapter.getItemCount(); if (!bonjourService.isLost()) { // query "/spreedbox-notify/api/v1/static/scripts/spreedbox-notify.js" String url = ""; if (bonjourService.getInet4Address() != null) { url = "https://" + bonjourService.getInet4Address().getHostAddress() + "/spreedbox-notify/api/v1/static/scripts/spreedbox-notify.js"; } else { url = "https://" + bonjourService.getInet6Address().getHostAddress() + "/spreedbox-notify/api/v1/static/scripts/spreedbox-notify.js"; } CheckSpreedbox checkSpreedbox = new CheckSpreedbox(); checkSpreedbox.bonjourService = bonjourService; try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { checkSpreedbox.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, url); } else { checkSpreedbox.execute(url); } } catch (RejectedExecutionException e) { e.printStackTrace(); } } else { mAdapter.remove(bonjourService); } ServiceBrowserFragment.this.showList(itemsCount); mAdapter.notifyDataSetChanged(); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { Log.e("DNSSD", "Error: ", throwable); ServiceBrowserFragment.this.showError(throwable); } }); }
From source file:com.ieeton.agency.activity.ContactlistFragment.java
private void refreshData(int mode) { mLoadMode = mode;/*from w w w . java2 s.c om*/ if (!mIsTaskFree) { return; } if (mode == LOAD_REFRESH) { mPageNum = 1; mPullDownView.update(); } else { mPageNum += 1; mPullDownView.updateWithoutOffset(); } mTask = new FechDataTask(); try { mTask.execute(mPageNum); } catch (RejectedExecutionException e) { e.printStackTrace(); } }
From source file:com.ieeton.agency.DemoApplication.java
@Override public void onCreate() { super.onCreate(); Utils.saveIeetonFrom(this); int pid = android.os.Process.myPid(); String processAppName = getAppName(pid); // ?remote serviceif? if (processAppName == null || processAppName.equals("")) { // workaround for baidu location sdk // ?sdk????????application::onCreate // /*from w w w . java 2s . c om*/ // sdk??? ?pid ?processInfo // processName // application::onCreate service return; } //? //BaiduLocationHelper.startRequestLocation(this, mIeetonLocationListener); //?domain urls try { GetDomainUrlsTask task = new GetDomainUrlsTask(); task.execute(); } catch (RejectedExecutionException e) { e.printStackTrace(); } applicationContext = this; instance = this; // ?SDK,?init() EMChat.getInstance().init(applicationContext); EMChat.getInstance().setDebugMode(false); Log.d("EMChat Demo", "initialize EMChat SDK"); // debugmodetrue?sdk?log // ?EMChatOptions EMChatOptions options = EMChatManager.getInstance().getChatOptions(); // ??app??true options.setUseRoster(true); // ??????? options.setAcceptInvitationAlways(false); // ???true options.setNotifyBySoundAndVibrate( PreferenceUtils.getInstance(applicationContext).getSettingMsgNotification()); // ????true options.setNoticeBySound(PreferenceUtils.getInstance(applicationContext).getSettingMsgSound()); // ?? true options.setNoticedByVibrate(PreferenceUtils.getInstance(applicationContext).getSettingMsgVibrate()); // ?? true options.setUseSpeaker(PreferenceUtils.getInstance(applicationContext).getSettingMsgSpeaker()); // notification?intentintent options.setOnNotificationClickListener(new OnNotificationClickListener() { @Override public Intent onNotificationClick(EMMessage message) { // Intent intent = new Intent(applicationContext, ChatActivity.class); // ChatType chatType = message.getChatType(); // if (chatType == ChatType.Chat) { // ??? // intent.putExtra(ChatActivity.EXTRA_USERID, message.getFrom()); // intent.putExtra("chatType", ChatActivity.CHATTYPE_SINGLE); // } else { // ?? // // message.getTo()?id // intent.putExtra("groupId", message.getTo()); // intent.putExtra("chatType", ChatActivity.CHATTYPE_GROUP); // } Intent intent = new Intent(applicationContext, MainActivity.class); return intent; } }); // connectionlistener??? EMChatManager.getInstance().addConnectionListener(new MyConnectionListener()); // ?app??????????? options.setNotifyText(new OnMessageNotifyListener() { @Override public String onNewMessageNotify(EMMessage message) { // ??message????(??qq)demo???? String notify = ""; String passport = message.getFrom(); String nick = Utils.getNickCache(getApplicationContext(), passport); if (nick != null && !"".equals(nick)) { String formatStr = getResources().getString(R.string.new_incoming_messages); notify = nick + String.format(formatStr, "1"); } else { notify = getString(R.string.new_message); } return notify; } @Override public String onLatestMessageNotify(EMMessage message, int fromUsersNum, int messageNum) { //return fromUsersNum + "???" + messageNum + "??"; String formatStr = getResources().getString(R.string.receive_new_messages); String notify = String.format(formatStr, fromUsersNum, messageNum); return notify; } @Override public String onSetNotificationTitle(EMMessage message) { // return getString(R.string.app_name); } @Override public int onSetSmallIcon(EMMessage arg0) { // TODO Auto-generated method stub return 0; } }); //? IntentFilter callFilter = new IntentFilter( EMChatManager.getInstance().getIncomingVoiceCallBroadcastAction()); registerReceiver(new VoiceCallReceiver(), callFilter); }
From source file:com.ieeton.user.activity.ChatActivity.java
@Override protected void onResume() { super.onResume(); adapter.refresh();// ww w . j a v a 2s .co m if (isFirstIn) { isFirstIn = false; if (mUser == null) { try { FetchUserInfoTask task = new FetchUserInfoTask(); task.execute(); } catch (RejectedExecutionException e) { e.printStackTrace(); } } Intent intent = getIntent(); boolean auto_begin_conversation = intent.getExtras().getBoolean(EXTRA_AUTO_BEGIN_CONVERSATION); if (auto_begin_conversation && conversation.getMsgCount() <= 0) { //??? boolean[] onoff = Utils.getMessageNotifySetting(ChatActivity.this); if (onoff[0]) { mSoundID = initSoundPool(); mSoundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() { @Override public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { playSound(); } }); } if (onoff[1]) { mVibrator = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE); playVibrator(); } EMMessage message = EMMessage.createSendMessage(EMMessage.Type.TXT); String msgID = message.getMsgId(); message.setMsgId("ieeton" + msgID); String content; if (toChatUsername.equals(NetEngine.getSecretaryID())) { content = getString(R.string.mishu_begin_conversation); } else { content = getString(R.string.doctor_begin_conversation); } TextMessageBody txtBody = new TextMessageBody(content); message.addBody(txtBody); message.setFrom(toChatUsername); message.setTo(IeetonApplication.getInstance().getUserName()); message.direct = EMMessage.Direct.RECEIVE; conversation.addMessage(message); EMChatManager.getInstance().saveMessage(message); adapter.refresh(); } } }