Example usage for java.util.concurrent ScheduledThreadPoolExecutor getClass

List of usage examples for java.util.concurrent ScheduledThreadPoolExecutor getClass

Introduction

In this page you can find the example usage for java.util.concurrent ScheduledThreadPoolExecutor getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.amazonaws.http.HttpRequestTimer.java

/**
 * {@link ScheduledThreadPoolExecutor#setRemoveOnCancelPolicy(boolean)} is not available in Java
 * 6 so we invoke it with reflection to be able to compile against Java 6.
 * /*  w w  w .j  a v a2s .co m*/
 * @param executor
 */
private static void safeSetRemoveOnCancel(ScheduledThreadPoolExecutor executor) {
    try {
        executor.getClass().getMethod("setRemoveOnCancelPolicy", boolean.class).invoke(executor, Boolean.TRUE);
    } catch (IllegalAccessException e) {
        throwSetRemoveOnCancelException(e);
    } catch (IllegalArgumentException e) {
        throwSetRemoveOnCancelException(e);
    } catch (InvocationTargetException e) {
        throwSetRemoveOnCancelException(e.getCause());
    } catch (NoSuchMethodException e) {
        throw new AmazonClientException(
                "The request timeout feature is only available for Java 1.7 and above.");
    } catch (SecurityException e) {
        throw new AmazonClientException("The request timeout feature needs additional permissions to function.",
                e);
    }
}