Example usage for java.lang Boolean booleanValue

List of usage examples for java.lang Boolean booleanValue

Introduction

In this page you can find the example usage for java.lang Boolean booleanValue.

Prototype

@HotSpotIntrinsicCandidate
public boolean booleanValue() 

Source Link

Document

Returns the value of this Boolean object as a boolean primitive.

Usage

From source file:net.community.chest.gitcloud.facade.AbstractEnvironmentInitializer.java

protected void contextInitialized(ServletContext context) {
    PlaceholderResolver contextResolver = ServletUtils.toPlaceholderResolver(context);
    Pair<File, Boolean> result = ConfigUtils.resolveGitcloudBase(new AggregatedExtendedPlaceholderResolver(
            contextResolver, ExtendedPlaceholderResolverUtils.SYSPROPS_RESOLVER,
            ExtendedPlaceholderResolverUtils.ENVIRON_RESOLVER));
    File rootDir = result.getLeft();
    Boolean baseExists = result.getRight();
    if (!baseExists.booleanValue()) {
        System.setProperty(ConfigUtils.GITCLOUD_BASE_PROP, rootDir.getAbsolutePath());
        logger.info("contextInitialized(" + context.getContextPath() + ") - added "
                + ConfigUtils.GITCLOUD_BASE_PROP + ": " + ExtendedFileUtils.toString(rootDir));
    } else {//  w w w  . jav a2  s. c  o m
        logger.info("contextInitialized(" + context.getContextPath() + ") using "
                + ConfigUtils.GITCLOUD_BASE_PROP + ": " + ExtendedFileUtils.toString(rootDir));
    }

    extractConfigFiles(new File(rootDir, ConfigUtils.CONF_DIR_NAME));
}

From source file:com.cndatacom.ordersystem.manager.RetryHandler.java

public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    boolean retry = true;

    Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());

    if (executionCount > maxRetries) {
        // Do not retry if over max retry count
        retry = false;/*  w w w  .j a  v  a2  s  .  com*/
    } else if (exceptionBlacklist.contains(exception.getClass())) {
        // immediately cancel retry if the error is blacklisted
        retry = false;
    } else if (exceptionWhitelist.contains(exception.getClass())) {
        // immediately retry if error is whitelisted
        retry = true;
    } else if (!sent) {
        // for most other errors, retry only if request hasn't been fully sent yet
        retry = true;
    }

    if (retry) {
        // resend all idempotent requests
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
        String requestType = currentReq.getMethod();
        retry = !requestType.equals("POST");
    }

    if (retry) {
        SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS);
    } else {
        exception.printStackTrace();
    }

    return retry;
}

From source file:be.agiv.security.handler.AuthenticationHandler.java

public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);

    if (true == outboundProperty.booleanValue()) {
        try {// w  w  w  .ja  v  a  2  s  .c  om
            handleOutboundMessage(context);
        } catch (Exception e) {
            throw new ProtocolException(e);
        }
    }

    return true;
}

From source file:net.lightbody.bmp.proxy.jetty.http.jmx.HttpContextMBean.java

public void postRegister(Boolean ok) {
    super.postRegister(ok);
    if (ok.booleanValue())
        getHandlers();
}

From source file:com.mxhero.plugin.cloudstorage.onedrive.api.command.HttpRequestRetryHandler.java

@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    if (executionCount >= retries) {
        logger.debug("no more retries, cancel");
        return false;
    }/*from  ww  w . j  a  va  2  s  . com*/
    if (exception instanceof NoHttpResponseException) {
        logger.debug("is NoHttpResponseException, retrying...");
        return true;
    }
    if (exception instanceof ConnectTimeoutException || exception instanceof ConnectionPoolTimeoutException) {
        logger.debug("is ConnectTimeoutException or ConnectionPoolTimeoutException, retrying...");
        return true;
    }
    if (exception instanceof InterruptedIOException) {
        logger.debug("is InterruptedIOException, retrying...");
        return true;
    }
    if (exception instanceof UnknownHostException) {
        logger.debug("is UnknownHostException, cancel");
        return false;
    }
    if (exception instanceof ConnectException) {
        logger.debug("is ConnectException, cancel");
        return false;
    }
    if (exception instanceof SSLException) {
        logger.debug("is SSLException, cancel");
        return false;
    }
    HttpRequest request = (HttpRequest) context.getAttribute(HttpCoreContext.HTTP_REQUEST);
    boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
    if (idempotent) {
        logger.debug("is idempotent, retrying...");
        return true;
    }
    Boolean b = (Boolean) context.getAttribute(HttpCoreContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());
    if (!sent) {
        logger.debug("is not sent, retrying...");
        return true;
    }
    return false;
}

From source file:com.example.wechatsample.library.http.RetryHandler.java

public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    boolean retry = true;

    Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());

    if (executionCount > maxRetries) {
        // Do not retry if over max retry count
        retry = false;//  ww w  .j a  v a  2s. c  o m
    } else if (exceptionBlacklist.contains(exception.getClass())) {
        // immediately cancel retry if the error is blacklisted
        retry = false;
    } else if (exceptionWhitelist.contains(exception.getClass())) {
        // immediately retry if error is whitelisted
        retry = true;
    } else if (!sent) {
        // for most other errors, retry only if request hasn't been fully
        // sent yet
        retry = true;
    }

    if (retry) {
        // resend all idempotent requests
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
        String requestType = currentReq.getMethod();
        retry = !requestType.equals("POST");
    }

    if (retry) {
        SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS);
    } else {
        exception.printStackTrace();
    }

    return retry;
}

From source file:com.xpn.xwiki.doc.AbstractMandatoryDocumentInitializer.java

/**
 * @param value the {@link Boolean} value to convert.
 * @return the converted <code>int</code> value.
 *///  w  w  w.  j ava2 s. c om
protected int intFromBoolean(Boolean value) {
    return value == null ? -1 : (value.booleanValue() ? 1 : 0);
}

From source file:com.blazeroni.reddit.http.RetryHandler.java

public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    boolean retry;

    Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());

    if (executionCount > this.maxRetries) {
        // Do not retry if over max retry count
        retry = false;/*w  w w. jav  a2 s.  c  o  m*/
    } else if (EXCEPTION_MAP.containsKey(exception.getClass())) {
        // immediately cancel retry if the error is blacklisted
        // immediately retry if error is whitelisted
        return EXCEPTION_MAP.get(exception.getClass());
    } else if (!sent) {
        // for most other errors, retry only if request hasn't been fully sent yet
        retry = true;
    } else {
        // resend all idempotent requests
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
        String requestType = currentReq.getMethod();
        if (!requestType.equals("POST")) {
            retry = true;
        } else {
            // otherwise do not retry
            retry = false;
        }
    }

    if (retry) {
        SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS);
    } else {
        Log.debug("Not retrying request", exception);
    }

    return retry;
}

From source file:com.damytech.HttpConn.RetryHandler.java

public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    boolean retry = true;

    Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());

    if (executionCount > maxRetries) {
        // Do not retry if over max retry count
        retry = false;/*  ww  w  .j av a  2 s  . c  o m*/
    } else if (exceptionBlacklist.contains(exception.getClass())) {
        // immediately cancel retry if the error is blacklisted
        retry = false;
    } else if (exceptionWhitelist.contains(exception.getClass())) {
        // immediately retry if error is whitelisted
        retry = true;
    } else if (!sent) {
        // for most other errors, retry only if request hasn't been fully sent yet
        retry = true;
    }

    if (retry) {
        // resend all idempotent requests
        HttpRequest currentReq = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
        /*String requestType = currentReq.getMethod();
        retry = !requestType.equals("POST");*/
        retry = !(currentReq instanceof HttpEntityEnclosingRequest);
    }

    if (retry) {
        SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS);
    } else {
        exception.printStackTrace();
    }

    return retry;
}

From source file:be.fedict.hsm.client.WSSecuritySOAPHandler.java

@Override
public boolean handleMessage(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (true == outboundProperty.booleanValue()) {
        try {// w w  w  . ja  va  2  s. co  m
            handleOutboundMessage(context);
        } catch (Exception e) {
            throw new ProtocolException(e);
        }
    }
    return true;
}