Java Code Examples for com.android.volley.VolleyLog.MarkerLog#ENABLED

The following examples show how to use com.android.volley.VolleyLog.MarkerLog#ENABLED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Request.java    From product-emm with Apache License 2.0 6 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example 2
Source File: Request.java    From TitanjumNote with Apache License 2.0 6 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
        onFinish();
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example 3
Source File: Request.java    From CrossBow with Apache License 2.0 6 votes vote down vote up
public void logMarkers() {
    if (MarkerLog.ENABLED) {;
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }
        mEventLog.finish(this.toString());
    }
}
 
Example 4
Source File: Request.java    From android-common-utils with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example 5
Source File: Request.java    From android_tv_metro with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example 6
Source File: Request.java    From volley with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example 7
Source File: Request.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully
 * or with error).
 * <p>
 * Also dumps all events from this request's event log; for debugging.
 * </p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime()
                        - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example 8
Source File: Request.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 * <p/>
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example 9
Source File: Request.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example 10
Source File: Request.java    From WayHoo with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example 11
Source File: Request.java    From android-common-utils with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example 12
Source File: Request.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example 13
Source File: Request.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example 14
Source File: Request.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example 15
Source File: Request.java    From okulus with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example 16
Source File: Request.java    From FeedListViewDemo with MIT License 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example 17
Source File: Request.java    From jus with Apache License 2.0 4 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    }
}
 
Example 18
Source File: Request.java    From CrossBow with Apache License 2.0 4 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    }
}
 
Example 19
Source File: Request.java    From device-database with Apache License 2.0 4 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    }
}
 
Example 20
Source File: Request.java    From volley_demo with Apache License 2.0 4 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    }
}