Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static final int ACTION_UPDATE_WATCH = 1;
- private void refreshWatch() {
- Message msg = Message.obtain(null, MyeBayService.ACTION_UPDATE_WATCH);
- msg.replyTo = incoming;
- try {
- log("Refresh request sent...");
- myeBaySrvc.send(msg);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- private class IncomingHandler extends Handler {
- @Override
- public void handleMessage(final Message msg) {
- Log.v(TAG, "msg.what : " + msg.what);
- final int[] lock = new int[] { 0 };
- executor.execute(new Runnable() {
- @Override
- public void run() {
- Log.v(TAG, "Executor msg.what : " + msg.what);
- synchronized (lock) { lock[0]++; lock.notify() }
- }
- });
- new Thread(new Runnable() {
- @Override
- public void run() {
- Log.v(TAG, "Thread msg.what : " + msg.what);
- synchronized (lock) { lock[0]++; lock.notify() }
- }
- }).run();
- synchronized (lock) { while (lock[0] < 2) lock.wait(); }
- Log.v(TAG, "msg.what after: " + msg.what);
- }
- }
Add Comment
Please, Sign In to add comment